---
title: "Agents and MCP"
description: "Connect Claude Code, Codex, Cursor, Gemini CLI or any other MCP client to the runtime, see the tools and recipes it offers, know what leaves the machine, and write nodes that agents understand."
type: "docs-page"
url: "https://tatolab.com/docs/share/agents"
site: "Tatolab"
section: "Share"
---

# Agents and MCP

> Connect Claude Code, Codex, Cursor, Gemini CLI or any other MCP client to the runtime, see the tools and recipes it offers, know what leaves the machine, and write nodes that agents understand.

The runtime serves [MCP](https://modelcontextprotocol.io), the protocol AI assistants use to call tools. An agent connected to it can do everything the CLI and Tato Studio do: list streams, read a stream's graph and a project's log, create, open, play and stop projects, and add, link, set and remove nodes in a running stream, each change saved to the graph document like one you make in Studio. To work with an agent beside Studio, see [Build with an agent](https://tatolab.com/docs/studio/agents); this page is the full reference.

Any agent that can run a local MCP server works, including these:

- Claude Code
- Claude Desktop
- Cline
- Codex
- Cursor
- Devin Desktop
- Gemini CLI
- GitHub Copilot
- Grok Build
- Zed

## Connect

### Claude Code

```sh
claude mcp add tatolab -- tatolab mcp
```

Run it in your project's folder: by default, Claude Code keeps an MCP server for the folder you added it in. Add `--scope user` to have it in every folder. Then start a new Claude Code session.

### Codex, Gemini CLI and Grok Build

Each adds the server with one command:

```sh
codex mcp add tatolab -- tatolab mcp
gemini mcp add tatolab tatolab mcp
grok mcp add tatolab -- tatolab mcp
```

Codex keeps it in `~/.codex/config.toml`, which its CLI and IDE extension share. Gemini CLI adds it to the project's `.gemini/settings.json`; add `-s user` to have it in every project. Grok Build keeps it in `~/.grok/config.toml`; add `--scope project` to keep it with the project instead.

### Clients configured with JSON

Claude Desktop, Cursor, GitHub Copilot in VS Code, Cline and Devin Desktop take:

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

- **Claude Desktop:** Settings → Developer → Edit Config opens `claude_desktop_config.json`. Restart the app after you save it.
- **Cursor:** `.cursor/mcp.json` in the project, or `~/.cursor/mcp.json` for every project.
- **GitHub Copilot in VS Code:** `.mcp.json` at the top of the workspace, or `~/.copilot/mcp-config.json` for every workspace.
- **Cline:** the MCP Servers icon in Cline's panel opens `cline_mcp_settings.json`.
- **Devin Desktop**, formerly Windsurf: `~/.config/devin/mcp_config.json`.

### Zed

Add it in **Settings → AI → MCP Servers → Add Server → Add Local Server**, or in Zed's `settings.json`:

```json
{
  "context_servers": {
    "tatolab": { "command": "tatolab", "args": ["mcp"], "env": {} }
  }
}
```

### How it connects

`tatolab mcp` connects to the runtime through its local socket and passes messages between it and the client. The MCP server belongs to the runtime: it's there whenever the runtime is running.

If a client can't find `tatolab`, give its full path as the command: `~/.local/bin/tatolab`, where Tato Studio and the Linux installer both put it, written out in full: `/Users/you/.local/bin/tatolab` on a Mac, `/home/you/.local/bin/tatolab` on Linux, with your user name in place of `you`.

### Another machine

Run `tatolab mcp` on the other machine over `ssh`:

```sh
claude mcp add lab-camera -- ssh lab-camera .local/bin/tatolab mcp
```

A command run over `ssh` gets a non-interactive shell, and on Debian and Ubuntu that shell doesn't have `~/.local/bin` on its `PATH`, so give the path to `tatolab`, relative to your home folder on that machine. (After a source build, it's wherever you put the binaries.) On a tailnet, use the machine's Tailscale name as the host.

## The tools

The runtime lists a few tools of its own, and reaches every other operation through `call_operation`:

| Tool | Does |
|---|---|
| `list_streams` | Lists every stream by its ID, with its display name, project, and state: running, stopped, paused, closed, failed, or preparing with the action and step loading it |
| `graph` | Returns the live graph of one stream or all of them: nodes by UUID and name, their types, ports, input values, links, and each node's metrics and state |
| `logs` | Reads a project's log from a given point on, narrowed to one stream or one stream action if asked |
| `describe_runtime` | Returns the runtime's version, build and uptime |
| `start_playback`, `stop_playback`, `pause_playback`, `resume_playback` | Play, stop, pause and resume a project, as a whole |
| `transact` | Applies several graph edits as one transaction, whole or not at all |
| `undo` | Reverses the agent's own latest transaction in a project |
| `list_operation_groups` | Lists every other operation, by group |
| `describe_operations` | States what an operation takes and answers |
| `call_operation` | Calls any operation by name, with its params |

Among the operations `call_operation` reaches:

| Group | Operations |
|---|---|
| Projects | `create_project`, `open_project`, `reload_project`, `close_project`, `remove_project`, `list_samples`, `describe_stream_action`, `cancel_stream_action` |
| Graph edits | `add_node`, `remove_node`, `connect`, `disconnect`, `set_node_input_value`, `rename_node`, `import_graph_generator`, `collapse_selection_into_subgraph`, `redo` |
| Streams and clocks | `create_stream`, `delete_stream`, `set_stream_display_name`, `set_stream_clock_scale` |
| Files and assets | `list_project_files`, `read_project_file`, `write_project_file`, `create_node_file`, `list_assets`, `import_asset`, `describe_asset` |
| Node types | `list_project_node_types`, which reads a project's node code without running it |
| Viewers | `open_viewer`, `close_viewer` |

A graph edit names a node by its UUID, which `add_node` answers and `graph` lists as `id`. With `mode: "commit"`, the default, an edit is applied to the running stream, written to the graph document and recorded as one commit on the project's history, so `undo` takes it back and the next load keeps it. With `mode: "live"`, it changes the running stream alone.

Agents also get resources: the **node catalog** (`streamlib://node-catalog`), every node type a stream can add, with its description, inputs and their types and defaults, and outputs; the **live graph** (`streamlib://graph`); and each project's **change feed**, its newest transactions with their authors, which a client can subscribe to.

## Recipes

The runtime offers three prompts, step-by-step recipes made of the operations above, which clients show as ready-made tasks:

| Prompt | Does |
|---|---|
| `insert_node_between_linked_nodes` | Puts a new node into an existing link, such as an effect between the camera and the encoder |
| `fan_output_to_another_consumer` | Adds a node as one more reader of an output, leaving the existing readers alone |
| `show_channel_on_virtual_camera` | Presents an output's video as a camera other apps can select (Linux) |

## Things to ask

- "What's running on this machine?"
- "Is the camera stream healthy? Has anything dropped frames?"
- "Why did the garage stream fail?"
- "Open the project in ~/cameras and play it."
- "Put a Pixelate node between the camera and the encoder."
- "Write a node that blurs faces, and add it after the camera."

That last one is all runtime operations: the agent creates a node file with `create_node_file`, writes its code with `write_project_file`, and adds it by its class path, such as `nodes.blur_faces:BlurFaces`. Like every Python node, it runs in its own process, from the project's `.venv`. An agent that edits files itself, like Claude Code in the project's folder, can do the same with its own tools; `tatolab dev` reloads the project when it saves.

## Changes, and what lasts

- A committed edit is in the graph document, so it lasts, and shows in Tato Studio at once. Each is one commit on the project's history, under the author the agent gives, and `undo` reverses only that author's own.
- A project an agent opens is recorded like any other, and keeps running after the agent's connection closes. An agent's next session finds it with `list_streams`.

## Access and safety

- **What the agent sees leaves the machine.** The logs it reads, the files it reads and the input values in the graph go into the agent's context, and so to its model provider. Decide for each project whether that's acceptable before you connect an agent.
- **Control stays on the machine.** `tatolab mcp` reaches the runtime through a socket only processes running as your user account can open. Reaching another machine is `ssh`'s job, with `ssh`'s keys and permissions.
- **An agent can change and stop streams, and write files in the project.** If you'd rather approve each change, use your client's permission settings: Claude Code, for example, asks before running a tool unless you've allowed it.
- **Input values are visible.** The graph shows each node's input values. Don't put secrets there: hand them to a node from the runtime's environment instead.

## Write nodes agents understand

Agents read what you write. A few habits make them much more useful:

- **Describe each node.** `@node.meta(description="Finds motion in each frame.")` is its description in the catalog.
- **Describe settings.** `Annotated[float, "Ignore detections scored below this."]` on a config field puts that description in the catalog, next to the type and default.
- **Describe ports.** `Output(Records, description="One message per frame: label, score and box for each object")` tells an agent what to expect from an output before it uses one.
- **Name nodes.** A node named `front-door` explains itself in `graph`; one named `camerasource2` doesn't.
- **Log what happened.** `log.info("motion started", changed=0.14)` gives an agent something to read with `logs` long after the moment has passed.
