> ## Documentation Index
> Fetch the complete documentation index at: https://docs.machina.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# Connecting External Agents

> Wire Claude Code, Cursor, Codex, Claude Desktop, or SportsClaw to your project MCP endpoint.

Any MCP-capable client can connect to your project's endpoint — remote SSE (FastMCP) at `<pod-address>/mcp/sse`, authenticated with an `X-Api-Token` header. Get the URL and a paired token with:

```bash theme={null}
machina connect --probe                      # resolve + verify, token masked
machina connect <project-id> --mint --reveal  # durable dedicated key, revealed
```

See [`connect`](/cli/commands/connect) and [`mcp`](/cli/commands/mcp) for the full flag reference.

## Claude Code

```bash theme={null}
claude mcp add --transport sse <name> <url> --header "X-Api-Token: <key>"
```

## Cursor

`~/.cursor/mcp.json` (or your project's `.cursor/mcp.json`):

```json theme={null}
{
  "mcpServers": {
    "<name>": {
      "type": "sse",
      "url": "<url>",
      "headers": { "X-Api-Token": "<key>" }
    }
  }
}
```

## Codex

Codex speaks stdio only, not remote SSE with custom headers, so it goes through the `mcp-remote` bridge. `~/.codex/config.toml`:

```toml theme={null}
[mcp_servers.<name>]
command = "npx"
args = ["-y", "mcp-remote", "<url>", "--header", "X-Api-Token:<key>"]
```

## Claude Desktop

Same bridge situation as Codex — Claude Desktop's config is stdio-only and can't send custom headers natively. `claude_desktop_config.json`:

```json theme={null}
{
  "mcpServers": {
    "<name>": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "<url>", "--header", "X-Api-Token:<key>"]
    }
  }
}
```

## Any other MCP client

If your client isn't listed above, the raw connection facts:

```text theme={null}
Transport:  SSE (remote)
URL:        <url>
Header:     X-Api-Token: <key>

# Clients that only speak stdio (no custom headers) can bridge via:
#   npx -y mcp-remote <url> --header "X-Api-Token:<key>"
```

## SportsClaw

SportsClaw is the reference external agent this connection flow was built around — see [Ecosystem → SportsClaw](/ecosystem/sportsclaw) for its own `sportsclaw mcp add` command and how it fits together end to end.

## Related

* [MCP Overview](/mcp/overview) — the shared endpoint these snippets connect to.
* [`connect`](/cli/commands/connect) — mint a durable, project-scoped token instead of using an ambient session/API key.
