# Connect via MCP

Hosted Model Context Protocol at `https://mcp.pzero.studio/mcp`. Point Cursor, Claude, Claude Code, or any remote MCP client at that URL. MCP spends your prepaid Studio / agent USDC balance. It never moves money itself.

## Fund first

1. Top up in Studio (session x402), or run agent HTTP `POST /v1/x402/signup` / refill.
2. Wait until `confirmedUsdc` covers your first call (`GET /v1/agent/me`).
3. Mint or copy a `pzero_…` API key.

Pending credit is not spendable. See `https://api.pzero.studio/SKILL.md` and `https://api.pzero.studio/llms.txt`.

## 1. Copy the connector URL

```
https://mcp.pzero.studio/mcp
```

## 2. Add it in your client

### Cursor

`~/.cursor/mcp.json` or project `.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "pzero": {
      "url": "https://mcp.pzero.studio/mcp",
      "headers": {
        "Authorization": "Bearer ${env:PZERO_API_KEY}"
      }
    }
  }
}
```

Set `PZERO_API_KEY` in your environment to a `pzero_…` key. Restart Cursor or reload MCP servers.

### Unity (AI Assistant)

Requires Unity AI Assistant with MCP Extensions. In the Editor: Edit → Project Settings → AI → Assistant MCP Extensions → Open. That opens `UserSettings/mcp.json` (plain-text tokens; do not commit).

```json
{
  "enabled": true,
  "path": "",
  "mcpServers": {
    "pzero": {
      "type": "http",
      "url": "https://mcp.pzero.studio/mcp",
      "headers": {
        "Authorization": "Bearer pzero_YOUR_KEY"
      }
    }
  }
}
```

Save, then Refresh File and Servers. Confirm the `pzero` server shows tools such as `agent_me` and `get_models`.

### Claude (Customize → Connectors)

1. Open Customize → Connectors → Add custom connector.
2. Name it `PZERO`.
3. URL: `https://mcp.pzero.studio/mcp`.
4. Send `Authorization: Bearer pzero_…` (your key).

### Claude Code

```bash
claude mcp add --transport http --scope user pzero https://mcp.pzero.studio/mcp
```

Then ensure the client sends your Bearer API key. Verify with `claude mcp list`.

### Headless / other MCP hosts

```json
{
  "mcpServers": {
    "pzero": {
      "url": "https://mcp.pzero.studio/mcp",
      "headers": {
        "Authorization": "Bearer ${env:PZERO_API_KEY}"
      }
    }
  }
}
```

## 3. Call tools

Ask the agent to check `agent_me`, list models, run chat, or generate image/video. Useful tools: `funding_instructions`, `get_models`, `chat_completions`, `generate_image`, `generate_video`, `wait_for_video`, `get_capacity`.

## FAQ

Do I need an API key?

Yes for v1. Put `Authorization: Bearer pzero_…` on the MCP connection.

How does pricing work?

Same prepaid USDC as Studio and the Agents HTTP API. No monthly credit plan on MCP. Tool results surface cost when the API returns it.

Where is the HTTP contract?

`https://api.pzero.studio/llms.txt` and `https://api.pzero.studio/SKILL.md`.
