# MCP server

URL: https://skywake.dev/docs/agents/mcp

skywake mcp gives an MCP-capable agent tools for files on a disk, a bash shell, and search.

Use the MCP server when your agent speaks MCP and you want it to work on a disk through tools, without a mount or a local folder. There is one server, started by `skywake mcp`, `npx skywake mcp` or `uvx skywake mcp`. Add it to the agent's MCP config:

```json
{
  "mcpServers": {
    "skywake": {
      "command": "npx",
      "args": ["-y", "skywake", "mcp"],
      "env": {
        "SKYWAKE_API_KEY": "sw_...",
        "SKYWAKE_DISK": "app"
      }
    }
  }
}
```

The server is written in TypeScript, so it needs Node.js in every case. `skywake mcp` and `uvx skywake mcp` start it through `npx`. If you installed the CLI, you can use it instead:

```json
{
  "mcpServers": {
    "skywake": {
      "command": "skywake",
      "args": ["mcp"],
      "env": { "SKYWAKE_DISK": "app", "SKYWAKE_BRANCH": "agent-1" }
    }
  }
}
```

With no `SKYWAKE_API_KEY`, the server uses the key that `skywake login` saved.

## Settings [#settings]

The server reads the same settings as the SDKs and the CLI, plus two of its own.

| Variable          | Meaning                                                                                                      |
| ----------------- | ------------------------------------------------------------------------------------------------------------ |
| `SKYWAKE_API_KEY` | An [API key](../security/api-keys.mdx). Defaults to the one `skywake login` saved.                           |
| `SKYWAKE_URL`     | The API, for a self-hosted server. `https://api.skywake.dev` by default.                                     |
| `SKYWAKE_ENV`     | The environment, for a key that may use every one.                                                           |
| `SKYWAKE_PROFILE` | Which saved profile to use.                                                                                  |
| `SKYWAKE_DISK`    | The disk the file tools use. Without it, each file tool call must name a `disk`.                             |
| `SKYWAKE_BRANCH`  | The branch the file tools read and write. Without it, the server forks a branch for the session (see below). |

## Its own branch [#its-own-branch]

Without `SKYWAKE_BRANCH`, the server never writes to `main`. The first write to a disk forks `main` into a branch named `mcp-` and a random suffix, and every later read and write in the session uses that branch. If the disk doesn't exist yet, the server makes it first. The agent calls `merge` when its work is ready, or you merge the branch yourself.

With `SKYWAKE_BRANCH`, every tool works on that branch, which must exist. To give each agent its own fork, start one server per agent, each with its own branch.

## Tools [#tools]

File tools take an optional `disk`, which defaults to `SKYWAKE_DISK`.

| Tool     | What it does                                                                                                 |
| -------- | ------------------------------------------------------------------------------------------------------------ |
| `read`   | Read a file as text, or part of it (`offset`, `length`).                                                     |
| `write`  | Write files as one commit.                                                                                   |
| `delete` | Delete files or folders as one commit.                                                                       |
| `list`   | List a folder: each entry's path, kind, size and modified time.                                              |
| `grep`   | Find lines that match a regular expression, on the server.                                                   |
| `find`   | Find paths that match a glob, such as `**/*.md`.                                                             |
| `query`  | Search the disk's files by meaning and keywords; the best file first, with a snippet. Needs search on.       |
| `bash`   | Run a command in a [bash shell](./bash.mdx) over the branch. Each command that changes files is one commit.  |
| `fork`   | Fork the branch in use as `name`, and work there from then on.                                               |
| `merge`  | Merge the branch in use into another, `main` by default. Takes `prefer` and `dry_run`. Conflicts are listed. |
| `log`    | The newest commits of the branch, or of one path.                                                            |
| `diff`   | What the branch changed compared with another, `main` by default.                                            |

A `read` key hides `write`, `delete`, `fork` and `merge`. Its `bash` tool still runs, but commits nothing.

When the API rejects a call, the agent gets the API's message and hint as the tool's error. That lets it fix the call and try again.

## Next [#next]

<Cards>
  <Card href="./bash.mdx" />
  <Card href="./cli.mdx" />
  <Card href="/reference/cli/mcp" />
</Cards>