Skip to main content
axed can serve the Model Context Protocol (MCP), so an agent host such as Claude Code, or your own harness, can use the sandbox through tools, with no SDK or glue code in between. It is off by default. Each --mcp-listen endpoint you add serves MCP at the path /mcp. MCP drives a sandbox that already exists. Creating, routing to and deleting sandboxes stays with your platform.

Turn it on

With the default image, publish the port and pass the flags after the image name. The image runs as user 1000, so the token file must be readable by it:
--mcp-listen takes the same URIs as --listen: tcp://, unix://, vsock:// and fd://, repeatable, with ?auth=none allowed except on TCP. See Listeners and auth. It is independent of the other APIs: the native API, the Agent Sandbox adapter and the Agent Substrate adapter keep running as configured, and processes started over MCP show up in axectl ps like any other. With a token configured, clients send it as Authorization: Bearer <token>. Anyone who can call these tools can run any command as axed’s user, so always set a token on a TCP endpoint. See Security.

Connect a client

Point any MCP client that supports the Streamable HTTP transport at http://<sandbox>:7070/mcp, with the token as a header. For example, with Claude Code:
From the official SDKs, pass the header to the Streamable HTTP transport. In TypeScript:
In Python, with the mcp package (version 2), pass an HTTP client that carries the header. Turn off its read timeout, which defaults to 5 seconds, shorter than run waits:
The end-to-end suite (tests/run.sh mcp) runs the TypeScript SDK v1, the TypeScript client v2 and the Python SDK against axed. Each connects with the 2025-11-25 handshake, and the TypeScript client v2 and the Python SDK also with 2026-07-28.

Tools

Processes are named by their id or by the name given to run. Paths are relative to --root-dir and confined to it like every other file operation. Each tool’s input schema in tools/list describes every argument. Each result has a text part and structuredContent with the same information: process results carry id, output, state, exit_code, signal, exit_reason, next_offset, output_end and dropped_bytes. A tool that fails returns its error as a result with isError: true, so the model can read it and correct the call.

Long-running commands

run returns after wait_seconds even if the command is still running, so a build or a dev server never blocks the agent or hits the client’s request timeout. The process keeps running whether or not the client stays connected. Continue with read_output from the returned next_offset: each call returns only what is new, and a character is never split between calls. To check on a process without reading everything it printed, such as a dev server started earlier, pass tail for its last bytes instead, for example {"process": "dev", "tail": 4000}. With wait_seconds too, tail waits for the exit first, so it returns the end of a build’s output once the build finishes. A background job the command starts, such as npm run dev &, keeps running after the command exits. While it holds the command’s output open, axed waits up to 5 seconds for more output before reporting the exit. Redirect the job’s output, as in npm run dev > dev.log 2>&1 &, and the exit is reported at once. wait_seconds is at most 300. Keep it below your client’s request timeout, which is 60 seconds in the TypeScript SDK by default.

Limits

  • Each call returns at most max_bytes of output or file content (default 64 KiB, at most 1 MiB). The rest is read from next_offset. Agent hosts limit the size of a tool result: Claude Code, for example, saves a result over about 50,000 characters to a local file and has the model read that file instead. An agent that cannot read local files should pass a smaller max_bytes, such as 32768.
  • axed keeps --retain bytes of output per process (default 1 MiB). Output older than that is discarded, and the next read reports how much as dropped_bytes.
  • list_dir fails on a listing of more than 2,000 entries or 1 MiB of names. List a subdirectory or a smaller depth.
  • A request is at most 16 MiB, which bounds a write_file, base64 included.
  • Default policies and --default-user apply as on every other API. A timeout_seconds above --max-timeout fails.
  • run needs /bin/sh in the sandbox.

Protocol

axed serves MCP’s Streamable HTTP transport without sessions. Every request is a single JSON-RPC message sent with POST /mcp, and gets one application/json response. GET and DELETE get 405, and batches are refused. It serves both generations of the protocol, so older and newer clients both work:

Security

The tools give whoever calls them a shell in the sandbox as axed’s user. Treat an MCP endpoint like any other axed listener:
  • Use a token on TCP. axed logs a warning at startup when any TCP listener, MCP included, has no token. --auth-token-file and --auth-token-sha256 cover MCP listeners too, and rotation works the same way. MCP accepts the token only as Authorization: Bearer.
  • Browsers need a token. Without a token, axed refuses any request that carries an Origin header with 403, so a web page cannot reach a local endpoint through DNS rebinding.
  • Prefer a channel the platform controls. For an agent host on the same machine, unix:///path?auth=none is created with mode 0600. For a microVM, vsock://any:PORT?auth=none refuses connections from inside the guest.
  • Run commands as another user with --default-user, so the agent’s commands do not run with axed’s own permissions. See Run processes as another user.