> For AI agents: the complete documentation index is available at https://enclo.nstlopez.com/llms.txt, the full documentation bundle is available at https://enclo.nstlopez.com/llms-full.txt.

# Connect your harness

Harnesses connect to enclo by running `enclo mcp` as an MCP server.
`enclo setup` registers the server using each harness's own CLI rather than
editing configuration files directly.

```sh
enclo setup                # Claude Code and Codex, whichever are on PATH
enclo setup claude-code    # only Claude Code
enclo setup codex          # only Codex
enclo setup --print        # prints the commands and registers nothing
enclo setup --remove       # takes the registration out again
```

Before registering anything, `enclo setup` runs the `enclo doctor` checks and
stops if any fail, so it will not register an installation that cannot boot a
sandbox.

Start a new harness session after registering enclo so the harness loads the
new MCP tools.

## What setup runs

`enclo setup` runs the commands below using the full path to your `enclo`
binary (`/opt/homebrew/bin/enclo` for Homebrew installs, or
`~/.enclo/bin/enclo` when built from source). Run `enclo setup --print` to see
the commands with your local path.


**Claude Code**

```sh
claude mcp add --scope user enclo -- /opt/homebrew/bin/enclo mcp
```
Run `claude mcp list` to verify the entry.


**Codex**

```sh
codex mcp add enclo -- /opt/homebrew/bin/enclo mcp
```
Run `codex mcp list` to verify the entry.


**Other harnesses**

For any other harness that configures MCP servers in JSON, add this entry:
```json
{"mcpServers":{"enclo":{"command":"/opt/homebrew/bin/enclo","args":["mcp"]}}}
```


## Run Codex unattended

In non-interactive mode, `codex exec` rejects enclo tool calls with
`"MCP tool call requires approval, but approval policy is never"` unless the
tools are pre-approved. Add the setting below to the `[mcp_servers.enclo]`
table in `~/.codex/config.toml`:

```toml
[mcp_servers.enclo]
default_tools_approval_mode = "approve"
```

:::info What was tested
Our test passed this setting on the command line with
`-c 'mcp_servers.enclo.default_tools_approval_mode="approve"'`. The
`config.toml` file form is untested, as is an interactive Codex session
(which can prompt for approval).
:::

## Tell your agent when to use it

This snippet is optional because the MCP server already includes tool
instructions. If you want extra guidance, add it to `AGENTS.md` for Codex or
`CLAUDE.md` for Claude Code (`enclo setup --print` also outputs this block):

```markdown
## Sandboxes

Use the enclo tools to run code you have not read, to install packages,
and for builds and tests that should not touch this computer.

- A sandbox is an Alpine Linux microVM and you are root. Install tools with
  `apk add`. It uses musl, so binaries built for glibc do not run as they are.
- It has internet access and no access to this computer: no directory of it
  is shared. Copy a project in with `push`, which leaves out what .gitignore
  does, and read files back with `read_file`, with `encoding: "base64"` for
  binary ones.
- The sandbox stays up between calls. The first `run` boots it and later
  ones start at once. Files and packages always persist.
- Background processes persist while the sandbox is up, and it shuts down
  after 15 minutes with no command running, even if a server in it is still
  serving. Start a server with `nohup CMD > /tmp/server.log 2>&1 &` and use
  it from later calls. What a background process prints after its command
  returned is lost unless it is redirected.
- Several commands can run at once.
- A command that takes over 45 seconds comes back with an `exec_id`. Call
  `run` again with it to wait for more.
- `stop` ends a command and leaves the sandbox up. `shutdown` powers the
  sandbox off, and the next `run` boots it again with its files.
- Docker and other container runtimes do not work inside a sandbox. Start
  services directly.
```

## What was tested

`enclo setup` has only been tested against temporary Claude Code and Codex
configuration directories, not live user configs. In those tests, a Claude Code
session used the registered server directly. For Codex, `enclo setup` wrote the
expected config entry, while the test session itself received the same settings
via command-line flags.
