# Connect an agent

> Add the Stuarty MCP server to Claude Code, Cursor or another MCP client, or drive the CLI from a shell.

Source: https://stuarty.com/docs/agents/connect/

## Claude Code

```bash
claude mcp add stuarty -- stuarty mcp
```

The server speaks MCP over standard input and output. When no other process owns your workspace, `stuarty mcp` becomes its owner for as long as it runs; when the editor server is already running, it talks to that server instead, so the agent and the browser see the same project.

## Other MCP clients

Any client that starts a stdio server takes the same command. In a JSON configuration file it looks like this:

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

The server names the actor of each edit after the client, as `local:<client name>`, so the history shows who did what.

## A remote server

Set `STUARTY_URL` and `STUARTY_KEY` and the CLI and the stdio server talk to that server with the API key. See the [configuration variables](/docs/reference/configuration).

## The CLI

An agent with a shell can use the CLI instead. Add `--json` for one JSON document per command and `--actor <label>` to name itself:

```bash
stuarty project:create --name "Launch teaser" --description "A 30 second vertical video for people who follow the channel, with captions and a thumbnail." --specific "Publish one video that explains the idea" --measurable "One hundred views in the first week" --achievable "The footage and the script exist" --relevant "It brings the first audience" --time-bound "Edit on Monday, publish on Tuesday" --due 2027-03-31 --json --actor claude-code
stuarty media:import clip.mov --project prj_7k2m9x4q1b --json
stuarty export --project prj_7k2m9x4q1b --json
```

Exit code `0` is success, `2` is a retryable error or a `--wait` that timed out, and `1` is any other failure. Every command is in the [CLI reference](/docs/reference/cli).

## Next steps

- [Prompts for Claude Code, Codex, OpenCode, Cursor and Gemini CLI](/docs/prompts/overview)
- [The MCP reference](/docs/mcp/overview)
