# MCP server

Agents that speak the Model Context Protocol use Rebasely's tools directly: live branches, sandboxes, checks, pull requests, the knowledge base and the architecture. Each tool has the same permissions as the API request behind it.

## Connect

Remote:

```
https://rebasely.com/mcp
Authorization: Bearer dga_...
```

Local proxy:

```sh
rebasely mcp                      # a stdio MCP server; --host staging|production|<url>
```

- **Remote:** point the client at `https://rebasely.com/mcp` (Streamable HTTP) with the header `Authorization: Bearer dga_...` (an agent token) or `dgp_...` (a personal token). Tokens are accepted in that header only, never in the URL; a request from another site's page is refused.
- **Local:** `rebasely mcp` runs a stdio server that forwards to `/mcp` with the credential the CLI has (`REBASELY_TOKEN`, or the token `rebasely auth login` stored).

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

## Tools

| Tool | What it does | Scope |
| --- | --- | --- |
| `live.read` | A file with line numbers and its version | `live:read` |
| `live.tree` | Paths of a directory with their versions | `live:read` |
| `live.write` | Line-range edits against a version, or a whole file (at most 100 edits) | `live:write` |
| `live.subscribe` | Changes since a point, each with a one-line summary; waits up to 25 seconds for the next | `live:read` |
| `live.presence` | Say what you are looking at; see who is connected | `live:read` |
| `live.lock`, `live.unlock` | A soft lock on a file, for up to 5 minutes | `live:write` |
| `live.checkpoint` | Write a checkpoint now, at most one per 10 seconds | `live:write` |
| `sandbox.create`, `sandbox.list`, `sandbox.merge`, `sandbox.delete` | Sandboxes | `sandbox:write or repo:write` |
| `checks.run` | Run a sandbox's on: sandbox workflows | `sandbox:write or repo:write` |
| `checks.status` | The commit statuses of a commit | `repo:read` |
| `pr.list`, `pr.get`, `pr.diff` | Pull requests, one with its merge box, reviews and comments, its diff | `repo:read` |
| `pr.architecture` | What a pull request changes in the architecture and the knowledge base | `repo:read` |
| `pr.create`, `pr.comment`, `pr.review`, `pr.merge` | Open, comment, review and merge | `repo:write` |
| `kb.list`, `kb.read`, `kb.search` | The knowledge base: notes, one note with its links and backlinks, a search | `repo:read` |
| `arch.get` | The architecture: all of it, one view's or one component's | `repo:read` |
| `repo.create` | Create a private repository | `repo:create` |
| `repo.visibility`, `agent.request`, `approval.status` | Ask an owner to approve, and follow the request | no scope |

Every tool names its repository as `<org>/<repo>`. A private repository the token cannot reach gets the same answer as one that does not exist.

## Limits

The same as the API: 1,200 requests a minute per token, 600 a minute per agent across all its tokens, a batch of at most 20 messages and 2 MiB. Protocol versions 2025-06-18, 2025-03-26 and 2024-11-05.

> **Tip:** Start an agent with `kb.list` and `arch.get`: the [.rebasely folder](https://rebasely.com/docs/dot-rebasely) tells it how the system fits together before it changes anything.

---

Source: https://rebasely.com/docs/mcp
