# Connect Claude Code

> Let your agent do it: Connect Claude Code to my remote Hermitbox install through `hermitbox mcp`. Install the Hermitbox CLI where Claude Code runs, start Claude Code with `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in its private environment, and merge the page's server entry into the project's `.mcp.json`, which names the variables and never their values. After a restart, ask the server for the project's defaults, create a sandbox, run `echo hello` in it and delete it. Never copy the key into the file or this chat. Follow the exact steps in https://docs.hermitbox.dev/v0.3.2/integrations/claude.md.

Claude Code gets tools to create sandboxes, run commands in them, and snapshot, fork, sleep and
delete them, on a Hermitbox install on another machine, through `hermitbox mcp` over stdio.

On the machine where you ran the installer, skip this page: [Connect your
agent](https://docs.hermitbox.dev/v0.3.2/get-started/agents.md) sets Claude Code up without a key.

1. Install the [Hermitbox CLI](https://docs.hermitbox.dev/v0.3.2/get-started/cli.md) where Claude Code runs.
2. Start Claude Code with `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in its private environment.
3. Merge this into the project's `.mcp.json` and restart Claude Code. Ask it for the project's
   defaults, a sandbox, `echo hello` in it and cleanup. A container default needs an image;
   process and Wasm defaults must leave it out.

```json
{
  "mcpServers": {
    "hermitbox": {
      "type": "stdio",
      "command": "hermitbox",
      "args": ["mcp"],
      "env": {
        "HERMITBOX_API_URL": "${HERMITBOX_API_URL}",
        "HERMITBOX_API_KEY": "${HERMITBOX_API_KEY}"
      }
    }
  }
}
```

The file names the two variables, never their values; [Claude Code's
reference](https://code.claude.com/docs/en/mcp) defines it and its variable expansion. Host
admission enforces [tier limits](https://docs.hermitbox.dev/v0.3.2/reference/tiers.md), so an agent can't grant a capability the
host lacks.
