Skip to content
Guides · Integrations

How to Add an MCP Server to ChatGPT That Runs Code in a VM

Updated November 10, 2026 .md

Short answer: In ChatGPT on the web, open Plugins, click +, choose Add custom MCP server, enter https://sandboxer.com/mcp with OAuth, create and install the plugin, then type @ in a chat. Your ChatGPT plan and workspace policies decide whether you can add it and run its write tools; OpenAI's help center lists the plans.

At a glance#

Detail
Server URL https://sandboxer.com/mcp
Transport Streamable HTTP (ChatGPT supports SSE and streaming HTTP)
Sign-in in ChatGPT OAuth: you sign in to Sandboxer and click Allow. ChatGPT doesn't take an API key
Sign-in from code Authorization: Bearer <Sandboxer API key>
Tools 20 on November 10, 2026: 6 read-only, 14 that ChatGPT treats as write actions and asks you to confirm
Where it runs Ubuntu microVMs on Sandboxer, not on OpenAI's servers or your computer
ChatGPT surface ChatGPT on the web, per OpenAI's guide

Which ChatGPT plans can do this#

OpenAI's developer guide, Add custom MCP server, names no plans. It says to use ChatGPT on the web and that workspace permissions and security restrictions, including Lockdown, apply. For which plans can add custom MCP servers and use their write tools, check OpenAI's help article Connecting custom MCP servers in ChatGPT.

What that means for running code: create_sandbox and exec are write tools (readOnlyHint is false), so your account needs a plan and workspace settings that allow write actions from custom MCP servers.

Developer mode: OpenAI's current steps start at Plugins and include no developer-mode step. You accept a risk warning for each server instead.

search and fetch tools: not required. The same guide says custom MCP servers "do not require search/fetch tools". Sandboxer has no search or fetch tool, so use it in a normal chat.

Add Sandboxer to ChatGPT#

These steps follow OpenAI's Add custom MCP server and Connect from ChatGPT pages:

  1. Open chatgpt.com/plugins on the web.
  2. Click +, then Add custom MCP server.
  3. Name it Sandboxer. Under Connection, enter https://sandboxer.com/mcp, with the /mcp path and no trailing slash.
  4. Choose OAuth for authentication. Sandboxer's authorization server advertises Client ID Metadata Documents and has a dynamic client registration endpoint, the two methods OpenAI says ChatGPT can use without static credentials, so leave the client fields empty.
  5. Read the risk warning, select I understand and want to continue, then Create as a plugin, and review the 20 discovered tools.
  6. Install the plugin from your personal plugins (or the workspace where you created it), sign in to Sandboxer and click Allow.
  7. In a new conversation, type @ and pick Sandboxer.

What ChatGPT asks before each tool runs#

ChatGPT treats any tool without readOnlyHint as a write action and asks you to confirm it by default. You can tell it to remember approve or deny for one tool for the rest of a conversation. A new or refreshed conversation asks again. These are the annotations the server returns from tools/list today:

Treated as write actions (confirm by default) Read-only (readOnlyHint: true)
create_sandbox, create_task, exec, kill_command, write_file, host_port, stop_sandbox, resume_sandbox, extend_sandbox, rename_sandbox, label_sandbox, delete_sandbox, save_snapshot, delete_snapshot list_sandboxes, get_sandbox, task_status, command_status, read_file, list_snapshots

create_task, exec, kill_command, write_file, delete_sandbox and delete_snapshot also carry destructiveHint: true. create_task and task_status are the newest pair: create_task runs a coding agent on a connected GitHub repo in its own sandbox and ends in a pull request (see MCP server docs). Remembering approval for exec is reasonable inside a sandbox you just created, since it only runs in that VM. Keep delete_sandbox on confirm.

The hosted server has no handoff_session. That tool moves a local Claude Code or Codex session into a sandbox, so it exists only in the local sbx mcp server.

A prompt to try#

@Sandboxer Create a small sandbox named demo. Run python3 -c 'print(2**100)'.
Then start `sleep 30; echo done` as a detached command, poll command_status
until it exits, and delete the sandbox.

We didn't drive ChatGPT for this page (no OpenAI account in the test). We sent the same tool calls ChatGPT would send to https://sandboxer.com/mcp on production, with an API key, on November 10, 2026. These are the real results, trimmed:

create_sandbox  {"name":"aeo-add-an-mcp-server-to-chatgpt-1","type":"small","ttlSeconds":900}
→ Sandbox sb_1ihnexfk5x is ready. URL: https://silent-level-violet.box.sandboxer.com. Stops automatically at 2026-11-10T11:18:55Z.

exec            {"command":"python3 -c 'print(2**100)'"}
→ Exit code 0.
  stdout:
  1267650600228229401496703205376

exec            {"command":"sleep 30; echo done","detached":true}
→ Started process 492 in sb_1ihnexfk5x. Call command_status with processId 492 for its output and exit code.

command_status  {"processId":492}
→ Process 492 is running.

command_status  {"processId":492}          # 35 seconds later
→ Process 492 exited with code 0.
  stdout:
  done

delete_sandbox  {}
→ (isError) sandboxId is required: the exact id (sb_…) of one sandbox; delete_sandbox has no default

delete_sandbox  {"sandboxId":"sb_1ihnexfk5x"}
→ Deleting sb_1ihnexfk5x: its disk, memory and automatic snapshots are removed.

Things worth knowing from that run:

  • Every result has two parts: the text above, and the same data as structuredContent (for example exitCode, stdout, and stdoutNextOffset to pass back so a poll returns only new output).
  • sandboxId is optional after the create. Each tool defaults to the sandbox this MCP session created or used last. delete_sandbox is the exception: called without an id, it returns the tool error above and deletes nothing.
  • exec waits up to 120 seconds by default (600 at most). Anything longer, such as a build or a server, should use detached: true and command_status. command_status is read-only, so ChatGPT doesn't treat a poll as a write action.
  • Sandboxes made over MCP stop after an hour unless ttlSeconds says otherwise. A stopped sandbox bills no running time.
  • Failures come back as tool errors with the API's message (isError: true), for example an unknown sandbox or a plan or start limit, so the model can tell you what went wrong.

Troubleshooting#

All of these responses come from production on November 10, 2026, and need no account.

401 Unauthorized#

A POST to /mcp with no token, or a wrong or revoked one, gets a 401 that points to the OAuth metadata:

curl -si -X POST https://sandboxer.com/mcp \
  -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"check","version":"0"}}}' \
  | grep -i -e '^HTTP' -e '^www-authenticate' -e '^{'
HTTP/2 401
www-authenticate: Bearer resource_metadata="https://sandboxer.com/.well-known/oauth-protected-resource/mcp", scope="sandboxer"
{"error":{"code":-32001,"message":"Unauthorized: send Authorization: Bearer <Sandboxer API key>, or sign in with OAuth."},"id":null,"jsonrpc":"2.0"}

That 401 is how ChatGPT starts sign-in, so it's expected before you connect. ChatGPT reads the metadata it names:

curl -s https://sandboxer.com/.well-known/oauth-protected-resource/mcp
{"authorization_servers":["https://sandboxer.com"],"bearer_methods_supported":["header"],"resource":"https://sandboxer.com/mcp","scopes_supported":["sandboxer"]}

https://sandboxer.com/.well-known/oauth-protected-resource returns the same body. https://sandboxer.com/.well-known/oauth-authorization-server lists the authorize, token, register and revoke endpoints, S256 PKCE, client_id_metadata_document_supported: true and the refresh_token grant.

If you see the 401 after you connected, ChatGPT's token stopped working, for example because someone clicked Disconnect under API keys. Reconnect the plugin and sign in again. In ChatGPT, choose OAuth, not No authentication: Sandboxer has no anonymous access.

Wrong URL#

Only POST https://sandboxer.com/mcp speaks MCP. What the near misses return:

URL you entered What comes back
https://sandboxer.com/mcp/ (trailing slash) 404, No route for POST /mcp/
https://sandboxer.com/mcp/sse 404, No route for POST /mcp/sse
https://sandboxer.com/api/v1/mcp 404, No route for POST /api/v1/mcp
https://www.sandboxer.com/mcp 301 to https://sandboxer.com/mcp. Enter the target directly.
https://sandboxer.com/mcp opened in a browser (GET) 405, Method not allowed: POST JSON-RPC messages to this URL.

So a 405 in a browser tab means the URL is right. A 404 means it isn't.

Tools not showing#

  • Count them. With a valid key, initialize returns server sandboxer on protocol 2025-06-18, and tools/list returns 20 tools. If ChatGPT shows fewer, refresh the plugin's tools from its details page in app settings; OpenAI's developer guide says that's where you turn tools on or off and pull updates.
  • handoff_session is missing on purpose. It's local only.
  • Write tools refused. If ChatGPT won't run create_sandbox or exec, check your plan and workspace permissions against OpenAI's help article. The server doesn't block them for a signed-in account.
  • A tool call fails with a message. Sandboxer returns API failures as tool errors (isError: true) with the API's text, such as a plan or start limit, so read the message ChatGPT shows.

The same server from the OpenAI Responses API#

OpenAI's MCP servers guide uses a mcp tool with server_url in the Responses API. The Responses API supports Streamable HTTP and HTTP/SSE servers, and puts the server's token in the authorization field. For Sandboxer, that token is a Sandboxer API key:

curl https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-6-astra",
    "tools": [{
      "type": "mcp",
      "server_label": "sandboxer",
      "server_description": "Cloud sandboxes that run shell commands.",
      "server_url": "https://sandboxer.com/mcp",
      "authorization": "'"$SANDBOXER_API_KEY"'",
      "allowed_tools": ["create_sandbox", "exec", "command_status", "delete_sandbox"],
      "require_approval": "always"
    }],
    "input": "Create a small sandbox, run python3 -c \"print(2**100)\", then delete it."
  }'

We didn't run this request: the test had no OpenAI key. The shape follows OpenAI's guide, and the Sandboxer side of it (a Bearer API key on /mcp, initialize, tools/list and the four tools) is what we ran above. Notes from OpenAI's guide:

  • Approvals default to on. Each call comes back as an mcp_approval_request that you answer with an mcp_approval_response on the next request. "never" skips them for every tool, and a never object with tool_names skips them for the tools you list.
  • The authorization value isn't stored, so send it on every request.
  • allowed_tools keeps the tool list short. OpenAI notes that many tools can mean high cost and latency. The four above cover create, run, poll and clean up.

Use a scoped API key here. A key with the ci preset can create sandboxes and delete only the ones it created.

FAQ#

Do I need ChatGPT developer mode to add an MCP server?#

OpenAI's current steps start at Plugins: you add the server and accept a risk warning, with no developer-mode step. Account and workspace policies still decide whether you can.

Can ChatGPT Plus or Pro run code through an MCP server?#

Running code uses write tools (create_sandbox, exec). OpenAI decides which plans can use write actions from custom MCP servers, so check its help article Connecting custom MCP servers in ChatGPT for your plan.

Can I paste a Sandboxer API key into ChatGPT instead of signing in?#

No. ChatGPT offers OAuth, no authentication, or a mix of the two for custom MCP servers, and Sandboxer always requires sign-in, so choose OAuth. API keys are for code, such as the Responses API or the Agents SDK.

How do I take away ChatGPT's access?#

Open API keys in Sandboxer. The connection is listed as "ChatGPT (MCP)". Click Disconnect and its token stops working at once. The token only ever worked on /mcp, not on the REST API.

Can ChatGPT connect to sbx mcp on my laptop?#

Not directly. ChatGPT needs a public HTTPS endpoint, or OpenAI's Secure MCP Tunnel for a private server. The hosted https://sandboxer.com/mcp has the same tools as the local server, minus handoff_session, so there's no need for a tunnel.

More guides

Top AI sandbox platforms for code execution in 2026, ranked

For running AI-written code we rank Sandboxer, Freestyle and E2B first: each gives code its own VM with an API or SDK and can pause with memory. Pick Daytona for Windows or GPUs, Modal or Northflank for GPUs at scale, E2B or Northflank to run in your own cloud, and Vercel Sandbox if your app lives on Vercel.

Read the guide
Best sandboxes for running coding agents (Claude Code, Codex, Gemini CLI) in 2026, ranked

For coding agents we rank Sandboxer first: a full Ubuntu VM with Claude Code and Codex preinstalled, Docker, and stop-and-resume that keeps the agent's session in memory. Freestyle and Amp Orbs also keep memory across pauses. Pick E2B for prebuilt agent templates on open source, Docker Sandboxes for free local runs, and Codespaces if you live in GitHub.

Read the guide
Best Daytona sandbox alternatives in 2026, ranked

The best Daytona alternatives depend on why you're switching. For a full Linux microVM on every sandbox with memory-saving stop and Docker, we rank Sandboxer first. E2B suits open source and self-hosting, Modal massive short-job fleets, Northflank bring-your-own-cloud with GPUs, and Vercel Sandbox apps on Vercel.

Read the guide
Best E2B alternatives in 2026, ranked

If you're leaving E2B for longer sessions or a fuller machine, we rank Sandboxer first, then Freestyle: both give each sandbox a full Linux VM that keeps memory across pauses, with Docker and no short session cap. Pick Daytona for Windows or GPUs, Northflank for bring-your-own-cloud, and stay on E2B if you need open source.

Read the guide