# Use kumoba as an MCP server (https://kumoba.dev/guide/mcp)

`kumoba mcp` serves kumoba to any [Model Context Protocol](https://modelcontextprotocol.io) client, such as Claude Code, Claude Desktop, Cursor, VS Code and Codex. Each command the daemon serves becomes a tool with the same name and arguments, so an agent can create a sandbox, run programs in it, move files and drive its desktop through tool calls, without a shell. The tools come from the daemon's command catalog, the same one the CLI is built from, so a newer daemon's commands show up as tools with no change to the client.

Before you begin, [install kumoba and start `kumobad`](/getting-started). Without the native CLI, `npx -y kumoba mcp` runs the same server from the npm package, with Node 22 or later.

## Add it to your client [#add-it-to-your-client]

The server talks over stdio: the client starts `kumoba mcp` and owns the process. Use the snippet for your client, then restart it or reload its MCP servers.

### Claude Code [#claude-code]

```sh
claude mcp add kumoba -- kumoba mcp
```

Add `--scope user` before `kumoba` to have it in every project, or `--scope project` to write it to the project's `.mcp.json` for everyone who works on it.

### Claude Desktop [#claude-desktop]

Open **Settings > Developer > Edit Config**, which opens `claude_desktop_config.json` (`~/Library/Application Support/Claude/` on macOS, `%APPDATA%\Claude\` on Windows), and add:

```json
{
  "mcpServers": {
    "kumoba": {
      "command": "kumoba",
      "args": ["mcp"]
    }
  }
}
```

Claude Desktop does not start from your shell, so it may not find `kumoba` on your `PATH`. Give the full path that `command -v kumoba` prints, or use `npx`.

### Cursor [#cursor]

Add the server to `.cursor/mcp.json` in a project, or to `~/.cursor/mcp.json` for every project:

```json
{
  "mcpServers": {
    "kumoba": {
      "type": "stdio",
      "command": "kumoba",
      "args": ["mcp"]
    }
  }
}
```

### VS Code [#vs-code]

GitHub Copilot in VS Code reads `.mcp.json` at the root of the workspace, or `~/.copilot/mcp-config.json` for every workspace:

```json
{
  "mcpServers": {
    "kumoba": {
      "type": "stdio",
      "command": "kumoba",
      "args": ["mcp"]
    }
  }
}
```

To add it to your VS Code user profile from the command line instead:

```sh
code --add-mcp '{"name":"kumoba","type":"stdio","command":"kumoba","args":["mcp"]}'
```

### Codex [#codex]

```sh
codex mcp add kumoba -- kumoba mcp
```

That writes this table to `~/.codex/config.toml`, which you can also add by hand:

```toml
[mcp_servers.kumoba]
command = "kumoba"
args = ["mcp"]
```

### Without the native CLI [#without-the-native-cli]

In any of the configurations above, run the npm package instead of `kumoba`:

```json
{
  "mcpServers": {
    "kumoba": {
      "command": "npx",
      "args": ["-y", "kumoba", "mcp"]
    }
  }
}
```

With Claude Code, that is `claude mcp add kumoba -- npx -y kumoba mcp`, and with Codex `codex mcp add kumoba -- npx -y kumoba mcp`.

## Point it at a sandbox or another daemon [#point-it-at-a-sandbox-or-another-daemon]

The server finds `kumobad` the way the CLI does: through `KUMOBA_URL`, `KUMOBA_TOKEN` or `KUMOBA_TOKEN_FILE` and `KUMOBA_HOME`, defaulting to the local daemon, and through the TLS settings in [Run sandboxes on another machine](/guide/remote-daemon) for a remote one. Set `KUMOBA_SANDBOX` to a sandbox id and the tools that act inside one sandbox, such as `exec`, `read-file`, `screenshot` and `click`, use it when the agent leaves `id` out; their `id` argument is then optional. Pass the variables in the client's `env`:

```json
{
  "mcpServers": {
    "kumoba": {
      "command": "kumoba",
      "args": ["mcp"],
      "env": {
        "KUMOBA_SANDBOX": "8f0c2d1e-4b7a-4c3e-9d2f-6a1b5e7c9d0f"
      }
    }
  }
}
```

With Claude Code, pass each one with `--env`, as in `claude mcp add --env KUMOBA_SANDBOX=<id> --transport stdio kumoba -- kumoba mcp`.

## What the tools return [#what-the-tools-return]

| Tool | Returns |
| --- | --- |
| `exec`, `run` | JSON with `exitCode`, `stdout` and `stderr`, or `timedOut: true` instead of the exit code. A command that exits non-zero is a normal result: read `exitCode`. Past 48 KiB, each stream keeps its first and last 24 KiB around a note of how many bytes were cut |
| `screenshot` | The screen as a PNG image, and a JSON line with its `width`, `height` and `bytes`. `click` and the other desktop tools take points in those pixels. A PNG over 3 MiB is refused with an error; the default 1024x768 screen stays well below that |
| `ui-tree` | One line per element, as `push button "Send" at 812,440`, the same as the CLI prints |
| `read-file` | The file as text, or JSON with `base64` and `bytes` when it is not UTF-8 text or holds control characters other than tabs and line breaks. Past 96 KiB, text keeps its first and last 48 KiB around a note, and base64 holds the first 48 KiB, so read the rest with `exec`, such as with `sed` or `tail` |
| `write-file` | Takes `content` as UTF-8 text. For a binary file, write it base64-encoded and decode it with `exec`, as in `base64 -d` |
| every other tool | The daemon's JSON reply. Past 96 KiB, it keeps its first and last 48 KiB around a note; ask for less with arguments such as `limit` |

Tools that only read, such as `list`, `get` and `screenshot`, carry the `readOnlyHint` annotation. Every tool is listed except `shell`, which needs a terminal, `commands`, which the tool list replaces, and `export` and `import`, which move whole sandbox archives: in the [catalog](/http-api) they are the commands with output `terminal` or `"mcp": false`.

The limits keep a result within what clients pass to a model: Claude Code, for one, warns past 10,000 tokens and caps tool output at 25,000 by default.

A failed call returns the error the CLI would print, as a tool result the agent can read:

```text
kumoba: sandbox 8f0c2d1e not found [not_found]
hint: `kumoba list` shows the sandboxes on this daemon
```

The server checks each argument against the tool's input schema before it calls the daemon, so an argument the tool does not take, or one of the wrong type, is an error that names it, as in ``argv must be a list`` or ``did you mean `cwd`?``. A `null` for an argument that does not take one counts as left out, so `KUMOBA_SANDBOX` still fills a `null` id. A hint that names a CLI command means the tool of the same name, so `kumoba list` means the `list` tool. [Errors](/cli#errors) lists every code.

## Protocol [#protocol]

The server speaks MCP over stdio, one JSON-RPC 2.0 message per line, and writes nothing else to stdout. It serves revision 2026-07-28, with `server/discover` and the protocol version in each request's `_meta`, and the handshake revisions 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05 through `initialize`. Calls run concurrently, and a `notifications/cancelled` stops its call. Each reply echoes its request's id exactly as sent. When stdin closes, the server gives calls in flight 2 s to finish, cancels the rest and exits. `kumoba mcp --help` prints a summary.

## Next steps [#next-steps]

- [CLI reference](/cli) for every command and its arguments; the tools take the same ones.
- [Let an agent drive the desktop](/guide/desktop#let-an-agent-drive-the-desktop) to set up a sandbox whose screen the agent sees.
- [Control network access](/guide/network) and [give a sandbox a token without revealing it](/guide/secrets) before an agent runs code that reaches the internet.