# Tractorbeam MCP

> Connect an MCP client to Tractorbeam with one MCP server URL, and read and change your Workspaces' data as yourself.

The **Tractorbeam MCP** is one MCP server for every organization. MCP clients use it to read and change your data:

```text
https://mcp.tractorbeam.ai/mcp
```

Add it to an MCP client, such as Claude, ChatGPT, or Cursor, as a remote server. The client opens Tractorbeam’s sign-in, where you pick the organization to connect. Every call then acts as you, in that organization, with your permissions. Nothing else, such as an API key, signs in to it.

Each client address can send 50 requests a second to Tractorbeam’s MCP server, API, and Console together. Past that, its requests get `429` for a minute.

## Workspaces and Branches

Every tool except `list_workspaces` takes two optional arguments:

* `workspace`, the Workspace’s name. You can leave it out when your organization has only one Workspace; with several, a call without one fails with `INVALID_ARGUMENT` and lists their names.
* `branch`, the Branch’s name. It defaults to the Workspace’s default Branch.

The server doesn’t remember anything between calls. Each call names where it acts.

## Tools

| Tool                 | What it does                                                                                                                                                                                                    | Needs                                                |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
| `list_workspaces`    | Lists your organization’s Workspaces and the permissions you hold.                                                                                                                                              |                                                      |
| `describe_workspace` | Lists a Branch’s Queries, Mutations, and Actions, with the input each takes and what it returns, and its Tables and Object types, with the type of what a read returns and each Table’s indexes.                |                                                      |
| `query`              | Reads data. Give a Query’s `name`, or `code` for a read-only query function. It returns at most 1 MiB.                                                                                                          | `queries:invoke`                                     |
| `mutate`             | Changes data. Give a Mutation’s `name`, or `code` for a Mutation’s function. Its writes make one Commit.                                                                                                        | `mutations:invoke`, and `mutations:write` for `code` |
| `run_action`         | Runs an Action by `name`, or runs `code` as an Action, and waits up to 2 minutes for its Invocation to succeed. An Invocation still running then goes on, and the tool returns `DEADLINE_EXCEEDED` with its ID. | `actions:invoke`, and `actions:write` for `code`     |
| `show_page`          | Shows you a page in the conversation: a Query’s result, or HTML the MCP client writes. Only clients rendering MCP Apps list it.                                                                                 | `queries:invoke`                                     |

`query` and `show_page` only read. `mutate` and `run_action` change data, and `run_action` can reach other systems, so your client can ask before it runs them. Resources a Marking restricts never appear.

## Code

`query` and `mutate` take `code`, the source of an async function, in place of a Function’s `name`:

```js
async (input, { tables, objects }) => {
  const rows = await tables.billing.withIndex("by-plan", (q) => q.eq("plan", input.plan)).collect();
  return rows.length;
};
```

* `tables.x.query()` reads a Table’s documents in `id` order. `.withIndex(index, (q) => …)` reads one range of an index, then `.filter`, `.order("desc")`, and `.take(n)`, `.first()`, or `.collect()`. `tables.x.get(id)` reads one document, and `tables.x.search(index, { query })` searches a search or vector index.
* `objects.X.query()` and `objects.X.get(id)` read Objects the same way.
* In `mutate`, `tables.x.insert(fields)`, `tables.x.update(id, fields)`, and `tables.x.delete(id)` write. An error the function throws lands none of its writes.

`run_action`’s `code` is an Action’s function, `async (input, { queries, mutations, secrets, connectors }) => …`, It calls Queries and Mutations by name. List the Secrets, Connectors, and origins it uses in `secrets`, `connectors`, and `egress`.