> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fibre.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Give your coding agent sandboxes

> Add Fibre's MCP server to Claude Code, Codex, Cursor or OpenCode with one command, so your agent can run tests, builds, servers and untrusted code in sandboxes instead of on your machine. Add the Fibre skill so it knows when and how.

Your coding agent runs commands on your computer: installs, test suites, scripts it just wrote. With Fibre's MCP
server, it can run them in a **Fibre sandbox** instead, a clean Linux machine of its own in the cloud. Your machine
stays as it was, the agent can install anything it needs, it can run several things side by side, and when it
starts a server you get a public URL you can open or share.

**MCP** (Model Context Protocol) is the standard way for an agent to use outside tools. The Fibre CLI includes an
MCP server: you add it to your agent once, and from then on the agent starts it by itself and sees tools such as
`create_sandbox`, `run_command` and `get_url`.

> [!NOTE]
>
> This page is about your agent **using** sandboxes. To have your agent **write code** that uses Fibre, give it these
> docs instead: see [use Fibre from your coding agent](https://docs.fibre.dev/build-with-ai/coding-agents.md).

## Before you start

The MCP server is part of the [Fibre CLI](https://docs.fibre.dev/sdks/cli.md). Install it and sign in once:

```bash title="Terminal" norun reason="installs on your own machine" theme={null}
curl -fsSL https://fibre.dev/install.sh | sh
fibre login
```

The server uses the key you signed in with, so **no API key goes into your agent's settings**, where it could end up
in a file you share.

## Add it to your agent

Run the command for your agent. Each one adds the server for all your projects; add `--project` to add it only for
the project in the current folder.

```bash title="Claude Code" norun reason="changes your agent's settings" theme={null}
fibre mcp add claude
```

```bash title="Codex" norun reason="changes your agent's settings" theme={null}
fibre mcp add codex
```

```bash title="Cursor" norun reason="changes your agent's settings" theme={null}
fibre mcp add cursor
```

```bash title="OpenCode" norun reason="changes your agent's settings" theme={null}
fibre mcp add opencode
```

For Claude Code, Codex and OpenCode, this runs the agent's own `mcp add` command for you, so the server is set up
exactly the way that agent expects. For Cursor, it adds the server to `~/.cursor/mcp.json` and keeps every other
server in the file.

Start a new session of your agent afterwards: agents read their MCP servers when a session starts.

### Any other agent

Most agents that support MCP read the same JSON block. `fibre mcp config` prints it for you to paste into the agent's
settings. With `--project`, the command is plain `fibre`, which suits a settings file you commit and share:

```bash title="Terminal" run theme={null}
fibre mcp config --project
```

> [accordion] Output
>
> ```json title="output" expected theme={null}
> {
>   "mcpServers": {
>     "fibre": {
>       "command": "fibre",
>       "args": [
>         "mcp"
>       ]
>     }
>   }
> }
> ```

## Add the Fibre skill

A **skill** is a short guide an agent reads when a task calls for it. The Fibre skill tells your agent when a sandbox
is the better place to run something, the usual steps, and the rules that keep it cheap, such as deleting sandboxes
when the work is done. It also covers the CLI, the TypeScript and Python SDKs and the HTTP API, for agents that write code
against Fibre.

```bash title="Terminal" norun reason="writes to your home folder" theme={null}
fibre skill install
```

This writes the skill to `~/.agents/skills/fibre`, which Codex, Cursor, OpenCode and VS Code read, and to
`~/.claude/skills/fibre`, which Claude Code reads. With `--project`, it goes into the current project instead, so you
can commit it for your team.

## Try it

Ask your agent in plain words. For example:

* "Run the test suite in a Fibre sandbox and tell me what fails."
* "Try this pull request's install script in a sandbox before I run it here."
* "Start the app in a sandbox and give me a link I can send to the designer."
* "Run these five benchmark configurations in parallel sandboxes and compare them."

A typical run looks like this: the agent creates a sandbox, uploads your project folder, runs the command, reads the
output, fixes what it needs to, and deletes the sandbox at the end.

## The tools

| Tool | What it does |
| - | - |
| `create_sandbox` | Starts a sandbox, with the same options as the API: image, size, runtime, labels, lifetime, port, network rules |
| `list_sandboxes`, `get_sandbox` | Finds sandboxes and shows one |
| `delete_sandbox` | Deletes a sandbox with its files |
| `run_command` | Runs a command line and returns its exit code and output |
| `get_command`, `kill_command` | Reads more output of a long or background command; stops one |
| `write_file`, `read_file`, `list_files` | Works with files in the sandbox |
| `upload`, `download` | Copies a file or a whole folder between your project and a sandbox, in one call |
| `get_url` | The sandbox's public HTTPS address |
| `create_snapshot` | Saves a sandbox with its memory, so new ones start from that state |

The tools that delete something are marked as destructive, and the ones that only read are marked read-only, so
your agent can treat them differently when it asks for your approval.

### Long commands

Some agents stop waiting for a tool after about a minute. So `run_command` waits up to 45 seconds by default. If the
command is still running then, it keeps running in the sandbox, and the result tells the agent its ID. The agent
then reads the rest with `get_command`, from where it left off, until the command ends. For servers and watchers,
the agent starts the command in the background and gets the ID straight away.

Long output is cut in the middle, keeping the start and the end, so one noisy build does not fill the agent's
context.

## What the agent can reach

* **Your files:** `upload` and `download` work only inside the folder the agent started the server in, which is
  usually your project. A path outside it is refused.
* **Your account:** the server can do what your signed-in key can do. To give an agent less, create a key with fewer
  permissions (see [API keys](https://docs.fibre.dev/get-started/api-keys.md)) and set it for the server only, as `FIBRE_API_KEY` in the
  server's `env` in your agent's settings.
* **Your spending:** sandboxes cost money while they run, and their storage while they sleep. Each one the agent
  creates is kept until it is deleted, unless the agent gives it a lifetime, and the skill tells the agent to delete
  sandboxes it no longer needs. `fibre list` shows every sandbox you have.

## Check that it works

`fibre mcp` is what your agent runs. You can start it yourself to see that it signs in and starts:

```bash title="Terminal" norun reason="waits for an agent on its input" theme={null}
fibre mcp
```

It prints a line saying the MCP server is ready, and then waits for an agent on its input; press Ctrl-C to stop it.
If a tool answers that Fibre is not signed in, run `fibre login` again. To call the tools by hand, the MCP Inspector
starts the server and lists them in your browser:

```bash title="Terminal" norun reason="opens a browser" theme={null}
npx @modelcontextprotocol/inspector fibre mcp
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.