# Connect an agent

Legato comes with `legato`, a command-line tool inside the app at `/Applications/Legato.app/Contents/Helpers/legato`. `legato mcp` runs it as a [Model Context Protocol](https://modelcontextprotocol.io) server, so an agent can write pages through tool calls. There's nothing else to install and nothing to sign in to: the server reads and writes the page files in `~/Library/Application Support/Legato/Pages`.

The server runs on your Mac, started by the agent's app over stdio. That means the agent has to run on the same Mac: Claude Code, Codex, Claude Desktop, or any other client that starts a local command. Chat apps that only take a remote connector URL, such as claude.ai or ChatGPT in a browser, can't reach it.

## Claude Code

```bash
claude mcp add legato -- /Applications/Legato.app/Contents/Helpers/legato mcp
```

That adds Legato for the project you're in. To have it in every project, add it for your user instead:

```bash
claude mcp add --scope user legato -- /Applications/Legato.app/Contents/Helpers/legato mcp
```

Check the connection with `claude mcp list`, or `/mcp` inside a session.

To share the setup with a project, put it in the project's `.mcp.json`:

```json
{
  "mcpServers": {
    "legato": {
      "type": "stdio",
      "command": "/Applications/Legato.app/Contents/Helpers/legato",
      "args": ["mcp"]
    }
  }
}
```

There's no key to keep out of the file.

## Codex

```bash
codex mcp add legato -- /Applications/Legato.app/Contents/Helpers/legato mcp
```

`codex mcp list` shows it. Start a new session to pick it up.

## Claude Desktop

[Download the Legato extension](https://legatobar.com/legato.mcpb) and open it. Claude Desktop asks before installing it; click **Install**, then start a new chat.

The extension has no server of its own. It starts `legato mcp` from Legato.app, so it always matches the Legato you have, and it won't start until Legato is installed. It shows in **Settings → Extensions**, where you can turn it off or remove it.

To add Legato by hand instead, open **Settings → Developer → Edit Config**. That opens `~/Library/Application Support/Claude/claude_desktop_config.json`. Add Legato under `mcpServers`:

```json
{
  "mcpServers": {
    "legato": {
      "command": "/Applications/Legato.app/Contents/Helpers/legato",
      "args": ["mcp"]
    }
  }
}
```

If the file already has other servers, add the `legato` entry beside them. Quit and reopen Claude Desktop, and start a new chat; Legato's tools are listed among its tools.

## Other MCP clients

Any client that runs a local MCP server over stdio can connect. Most take a JSON config like Claude Desktop's; fill in its settings like this:

| Setting | Value |
| --- | --- |
| Name | `legato` |
| Type or transport | stdio (sometimes called "command" or "local") |
| Command | `/Applications/Legato.app/Contents/Helpers/legato` |
| Arguments | `mcp` |
| Environment, URL, headers | None |

The server speaks JSON-RPC, one message per line, and accepts protocol versions `2024-11-05` through `2025-11-25`; a client asking for another version gets the newest. It offers tools only (no resources or prompts), and answers requests one at a time, in order. When Settings → Agent Access changes after the client listed the tools, it sends `notifications/tools/list_changed` before its next answer.

When it connects, the client should list Legato's twenty-three tools: five for pages (`set_page`, `get_page`, `list_pages`, `delete_page` and `get_page_schema`), six for the sidebar, four for [History](https://legatobar.com/docs/history-rows.md#rows-from-outside-legato), three for [Lists](https://legatobar.com/docs/mcp-tools.md#lists-and-history), three for [secrets](https://legatobar.com/docs/mcp-tools.md#secrets) and two for [templates](https://legatobar.com/docs/mcp-tools.md#templates), fewer if some are off in Settings → Agent Access.

Anything that can run the command can read and write every page, as you. There are no keys and no per-page permissions. Settings → [Agent Access](https://legatobar.com/docs/settings.md#agent-access) chooses which tools the MCP server offers, such as leaving out `delete_page`; the `legato` command and the Pages folder stay open to anything on the Mac.

## After you update Legato

An agent keeps the tools Legato gave it when it connected, so a session that was open before an update doesn't know about new card types or fields. Start a new session after you update. In Claude Code, `/mcp` can reconnect `legato` in the session you're in; Claude Desktop needs quitting and reopening.

## A prompt that works

Once the agent is connected, ask it in plain words. Something like this, in Claude Code, Codex or Claude Desktop:

> Keep a Legato page called "budget" current. Work out this month's spending so far, my monthly target ($3,200), the fraction of the month that has passed, and the largest charges this week. Then call `set_page` with page_id "budget": title "Budget", icon "dollarsign.circle", a `pacing` card for the month, a `list` of the largest charges ("Costco · $212"), and a one-sentence `text` note, tone "warning" if anything is over pace. Always send the whole page. If you get an error, fix what its message names and try again.

Add Legato's [page design skill](https://legatobar.com/docs/design.md#the-page-design-skill), and the agent checks each page against the design guide before it writes one.

For data that changes on its own, such as a service's API or your calendar, the agent can give the page [sources](https://legatobar.com/docs/sources.md) instead: Legato then fetches the data on a schedule, and the page stays current without the agent. For the rest, [A scheduled agent](https://legatobar.com/docs/scripts.md#a-scheduled-agent) shows how to run the agent on a schedule.
