Skip to content
Sandworld

Search the docs and guides

    Open this page as Markdown
    On this page

      MCP server

      Sandworld's environments are a Model Context Protocol server. Connect any MCP client to it by URL, with nothing to install, or run the same server locally over stdio. Both offer the same tools, with the API's keys and rate limits.

      Connect by URL

      MCP server URL
      https://sandworld.dev/mcp

      The server speaks Streamable HTTP and keeps no session: episodes are stored by id, so a client can reconnect at any time and carry on. There are three ways in:

      • Sign in with Sandworld (OAuth). Claude.ai, ChatGPT, Claude Code, Codex and other clients that support MCP sign-in open a Sandworld window: you sign in, see what the app is asking for and allow it. The app then acts as your workspace, with an API key's limits, episodes private to your workspace and the workspace tools. See how sign-in works.
      • No sign-in. The anonymous sandbox, rate-limited per IP like the anonymous API. Apps that connect from their own cloud (Claude.ai, ChatGPT) share their addresses' budget with every other user of that app.
      • An API key, for clients that can send headers: Authorization: Bearer sw_live_…, with exactly the key's scopes and limits.

      Signing in is lazy: connecting, listing tools and the episode tools work without an account, and the app asks you to sign in when it first needs your workspace (or straight away, if you choose that when adding it). A key or token that isn't valid is refused rather than ignored.

      Claude.ai (custom connector)

      1. Go to Customize → Connectors, click + Add, then Add custom connector.
      2. Name it Sandworld, enter https://sandworld.dev/mcp as the remote MCP server URL, and click Continue through the detected settings.
      3. Under Authentication, choose Sign in when needed. Under OAuth client, choose Use Claude's published identity (Sandworld reads Claude's Client ID Metadata Document, so nothing is registered); Register automatically works too. Click Add.
      4. In a chat, open + → Connectors, switch Sandworld on and ask “show my Sandworld workspace”. Claude shows a Connect card: a Sandworld window opens, you sign in, check that it sends you back to claude.ai, and click Allow. From then on Claude acts as your workspace.

      Free plans allow one custom connector. On Team and Enterprise, an Owner adds the connector for the organization and each member then connects with their own Sandworld account. To stay anonymous, choose No sign-in instead: Claude connects from Anthropic's cloud, so the anonymous limits are shared with every other Claude.ai user of the sandbox. Where your organization has Request headers, a key also works: choose No sign-in and add Authorization with the value Bearer sw_live_….

      Claude Code

      Shell
      claude mcp add --transport http sandworld https://sandworld.dev/mcp

      It starts in the anonymous sandbox. To use your workspace, ask for something that needs it (“show my Sandworld workspace”), then run /mcp, pick Sandworld and authenticate: your browser opens Sandworld's sign-in. Or use a key (add --scope user to use it in every project; the default is this project only):

      Shell
      claude mcp add --transport http sandworld https://sandworld.dev/mcp \
        --header "Authorization: Bearer $SANDWORLD_API_KEY"

      ChatGPT

      1. On ChatGPT on the web, open Plugins, select +, then Add custom MCP server.
      2. Name it Sandworld and, under Connection, enter https://sandworld.dev/mcp as the Server URL.
      3. Under authentication, choose OAuth to use your workspace, or OAuth or no authentication (mixed) to start anonymously and sign in when a workspace tool needs it. ChatGPT registers itself with Sandworld; there's no client ID to enter.
      4. Tick I understand and want to continue, select Create as a plugin, and when ChatGPT asks, sign in to Sandworld, check that it sends you back to chatgpt.com, and click Allow.
      5. Install the plugin, then type @ in a chat and pick Sandworld.

      ChatGPT can't send custom headers, so it's OAuth or the anonymous sandbox, whose limits are shared across ChatGPT's addresses. Workspaces still on the older apps flow add it under Settings → Apps (with developer mode on) and Create. Business, Enterprise and Edu workspaces get full custom MCP support. On Pro, OpenAI currently allows custom MCP servers read and fetch permissions only, so starting episodes and calling tools may be unavailable there.

      Codex

      Shell
      codex mcp add sandworld --url https://sandworld.dev/mcp

      Codex saves it in ~/.codex/config.toml, which the Codex CLI, the IDE extension and the ChatGPT desktop app share (or put it in .codex/config.toml in a trusted project). When you add it, Codex checks whether the server supports sign-in and, if so, opens Sandworld's sign-in in your browser. Run codex mcp login sandworld to sign in at any time; Codex identifies itself to Sandworld, so there's no client ID to enter. Or use a key from your environment:

      TOML
      [mcp_servers.sandworld]
      url = "https://sandworld.dev/mcp"
      bearer_token_env_var = "SANDWORLD_API_KEY"

      Cursor

      In .cursor/mcp.json in your project, or ~/.cursor/mcp.json for every project:

      JSON
      {
        "mcpServers": {
          "sandworld": {
            "url": "https://sandworld.dev/mcp"
          }
        }
      }

      With a key, add "headers": { "Authorization": "Bearer ${env:SANDWORLD_API_KEY}" }; Cursor reads the variable from your environment. Without a key, Cursor signs in with OAuth: it registers itself, and Sandworld accepts each of its callbacks, its loopback and web ones and its cursor://anysphere.cursor-mcp/oauth/callback app link, which the sign-in page shows as Opens Cursor.

      VS Code

      Run MCP: Add Server from the Command Palette, choose HTTP (HTTP or Server-Sent Events), enter https://sandworld.dev/mcp and the ID sandworld. Or add it to .mcp.json at the workspace root (shared), or ~/.copilot/mcp-config.json (just you):

      JSON
      {
        "mcpServers": {
          "sandworld": {
            "type": "http",
            "url": "https://sandworld.dev/mcp"
          }
        }
      }

      With a key, add "headers": { "Authorization": "Bearer ${SANDWORLD_API_KEY}" } in your personal file, not a shared one.

      OpenAI Agents SDK (Python)

      Python
      import asyncio, os
      from agents import Agent, Runner
      from agents.mcp import MCPServerStreamableHttp
      
      async def main():
          key = os.environ.get("SANDWORLD_API_KEY")  # optional
          async with MCPServerStreamableHttp(
              name="Sandworld",
              params={
                  "url": "https://sandworld.dev/mcp",
                  "headers": {"Authorization": f"Bearer {key}"} if key else {},
                  "timeout": 30,
              },
              cache_tools_list=True,
          ) as sandworld:
              agent = Agent(
                  name="Support agent",
                  instructions="Use the Sandworld tools. Follow the environment's policy.",
                  mcp_servers=[sandworld],
              )
              result = await Runner.run(agent, "Start Quickbasket task qb-01, do what the customer asks, then submit it.")
              print(result.final_output)
      
      asyncio.run(main())

      How sign-in works (OAuth)

      Sandworld follows the MCP authorization spec (OAuth 2.1). When an app connects, Sandworld shows the app's name, the address it will send you back to and what it's asking for, under your account and workspace. Nothing is shared until you click Allow. The app can then:

      • environments: See the worlds, including your workspace's private worlds, and your workspace's plan and limits.
      • episodes: Start, step and submit episodes. They are recorded to your workspace and count against its limits.
      • evals: Start baseline eval runs and read your workspace's eval runs and results.

      Apps ask for all three when you sign in. One that asks for nothing in particular gets environments and episodes, an API key's default scopes, and is asked to add evals when a tool needs it. It never sees your password, API keys, billing or data projects. Its access tokens last an hour and are refreshed in the background; disconnect it any time under Connected apps, which ends its tokens at once.

      For client developers:

      • Protected resource metadata: https://sandworld.dev/.well-known/oauth-protected-resource/mcp (and at the root). Calling a workspace tool without a token gets a 401 whose WWW-Authenticate names it and the scopes to ask for; a token without a scope a tool needs gets a 403 with error="insufficient_scope".
      • Authorization server metadata: https://sandworld.dev/.well-known/oauth-authorization-server. Authorization code with PKCE S256 only; resource is https://sandworld.dev/mcp; the response carries iss (RFC 9207).
      • Two ways to identify your app. A Client ID Metadata Document(client_id_metadata_document_supported): use the https URL of your metadata document as the client_id. Sandworld fetches it when a signed-in user opens the sign-in page: https (port 443 or 8443), public addresses only, no redirects, 5 KB and 3 seconds at most, cached for its max-age (1 minute to 1 hour). Its client_id must equal the URL, it's a public client (token_endpoint_auth_method none), and its https redirect URIs must be on its own host. The sign-in page names that host. Or dynamic client registration at /oauth/register.
      • Redirect URIs: https; http on a loopback address (any port); or, for a native app registered as a public client, its own scheme named after its domain in reverse, like com.example.app:/callback (RFC 8252). The sign-in page then says which app it opens. Every other scheme is refused.
      • Tokens are opaque and valid only on /mcp, not on the REST API. Refresh tokens rotate on every use, and reusing an old one ends the connection. Revoke at /oauth/revoke.

      Tools it provides

      ToolWhat it does
      list_environmentsLists the app twins.
      describe_environmentPolicy, tools and tasks for one twin.
      list_tasksPublic tasks with how often the published models solve them. Optional filters: environment, suite (v1, hard or all), model, pass_min and pass_max (0 to 1, inclusive), and limit (default 50).
      start_episodeStarts a task (or free play) and returns the instruction, policy and tools. Optional user_style for how the simulated user phrases its replies, and variant for the same world under different names, so a memorised answer fails (see the API reference: variants).
      call_toolRuns one environment tool inside the episode and returns the observation.
      get_episodeThe episode's status, every call made so far and, once submitted, the verdict.
      submit_episodeCloses the episode and returns every verifier check.

      Then ask: “Start Quickbasket task qb-10, handle the customer's request according to the policy, and submit it.” The model reads the policy, looks up the order, declines the out-of-window refund and submits — and the verifier tells you whether it was right.

      Tasks by difficulty

      list_tasks is GET /api/v1/tasks as a tool, with the same filters and the same errors, open to everyone like list_environments. Each task comes with its world, title, suites and a difficulty summary: the authored difficulty, the band, every published model pooled (any_model) and, when you name a model, that model's own pass rate. The result also says how many tasks match (total) and lists the published models by slug. Most published runs have one seed, so one model's rate on a task is 0 or 1, and a band in between comes from pooling the models. Try: “List the tasks some published models solve and others don't” or “Which Bench Hard tasks does gemini-3.5-flash-lite fail?”

      list_tasks arguments
      { "pass_min": 0.01, "pass_max": 0.99, "limit": 20 }
      { "suite": "hard", "model": "gemini-3.5-flash-lite", "pass_max": 0 }

      User styles

      On tasks where the agent can ask the user (ask_user), start_episode takes a user_style: default, impatient, vague or skeptical. It changes how the simulated user phrases its replies, never what it knows, and the result names any style but the default. It's checked as the episode API checks it: anything else is an error, and terse and non-native are refused because they need an LLM-played user, which only the HTTP API starts ("user_simulator": "llm").

      start_episode arguments
      { "environment": "quickbasket", "task_id": "qb-16", "seed": 1, "user_style": "vague" }

      Workspace tools

      On the remote server, signed in (or with an API key that has the scope), these act on your own workspace. Called without an account, they ask you to sign in.

      Episodes on your private worlds run on the same runtime as every other world: start one with start_private_episode, then use call_tool, get_episode and submit_episode with its episode id. Only tasks that passed check my task start. The episode belongs to your workspace: for anyone else, and without an account, it doesn't exist, and nor does the world. Try: “List my private worlds, start the first ready task on my clinic twin and solve it.”

      ToolWhat it doesScope
      get_workspaceYour workspace, its plan, limits and usage this month. Ask for it to sign in.environments
      list_private_worldsYour private worlds from the twin builder, with how many tasks are ready.environments
      describe_private_worldPolicy, tools and ready tasks for one of your private worlds.environments
      start_private_episodeStarts a task (or free play) on one of your private worlds; then call_tool and submit_episode as for any world. Pro and Team.episodes
      list_evalsYour workspace's recent eval runs, from the app, CI or here.evals
      get_evalOne run: progress, pass rate and every task × seed with its failure reason.evals
      start_evalRuns a baseline (oracle, random or null) on a public or private world. Model runs start from the app or CI, so your model key never passes through a chat.evals

      Run it locally (stdio)

      For clients that start a local command instead of connecting by URL, sandworld-mcp.mjs serves the same tools over stdio. It calls Sandworld's HTTP API at https://sandworld.dev/api/v1 unless you point it elsewhere, so it works as soon as it's added. It isn't a public download yet, because it's built from Sandworld's private source: ask us for it with a licence or pilot.

      Claude Code

      Shell
      claude mcp add sandworld \
        --env SANDWORLD_API_KEY=sw_live_… \
        -- node /path/to/sandworld-mcp.mjs

      Claude Desktop

      JSON
      {
        "mcpServers": {
          "sandworld": {
            "command": "node",
            "args": ["/path/to/sandworld-mcp.mjs"],
            "env": { "SANDWORLD_API_KEY": "sw_live_…" }
          }
        }
      }

      Environment variables

      • SANDWORLD_API_KEY — optional; without it the server uses the anonymous sandbox.
      • SANDWORLD_API_URL — optional; the API it calls, https://sandworld.dev/api/v1 by default (the same variable and default as the Python client and sw). Set it to use another Sandworld server, such as a lab image delivered with a licence: SANDWORLD_API_URL=http://localhost:8000. A bare host gets /api/v1 added.