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

# MCP server

> Query your Orbitrage analytics from Claude Desktop, VS Code, Cursor, or any MCP client.

Orbitrage exposes its analytics toolbox as a [Model Context Protocol](https://modelcontextprotocol.io) server — the same org-scoped tools as [Ask Analytics](/platform/ask-analytics), over JSON-RPC 2.0.

## Endpoints

| Endpoint                                                                 | Transport                           | Use from                        |
| ------------------------------------------------------------------------ | ----------------------------------- | ------------------------------- |
| `POST https://api.orbitrage.ai/api/mcp`                                  | Streamable HTTP (one-shot JSON-RPC) | VS Code, Cursor (HTTP), curl    |
| `GET https://api.orbitrage.ai/api/mcp`                                   | Health probe                        | Sanity checks                   |
| `GET https://api.orbitrage.ai/api/mcp/sse` + `POST .../api/mcp/messages` | Legacy SSE                          | Claude Desktop via `mcp-remote` |

## Get an MCP key

MCP uses its own key namespace, separate from your `orb_` router keys.

<Steps>
  <Step title="Create the key">
    On the dashboard's **Customise** page, create an MCP key. It looks like `mcp_a1b2c3d4_…` and is shown **once**.
  </Step>

  <Step title="Authenticate">
    Send it as `Authorization: Bearer mcp_…` (or `?key=mcp_…` for clients that can't set headers).
  </Step>
</Steps>

<Note>
  An MCP key can only call `/api/mcp` — it cannot make LLM calls. An `orb_` key cannot call `/api/mcp`. Revoking is immediate with no un-revoke; mint a new key to restore access.
</Note>

## Client setup

<Tabs>
  <Tab title="Claude Desktop">
    SSE transport via `mcp-remote`. Add to `claude_desktop_config.json`:

    ```json theme={null}
    {
      "mcpServers": {
        "orbitrage": {
          "command": "npx",
          "args": [
            "-y", "mcp-remote",
            "https://api.orbitrage.ai/api/mcp/sse",
            "--transport", "sse-only",
            "--header", "Authorization: Bearer mcp_..."
          ]
        }
      }
    }
    ```

    Claude Desktop can also auto-mint a key via the built-in OAuth flow (the server implements OAuth 2.0 authorization-server metadata, dynamic client registration, token, and revoke), so `mcp-remote` can authenticate without a pasted key.
  </Tab>

  <Tab title="VS Code">
    Native HTTP transport. Add to `.vscode/mcp.json`:

    ```json theme={null}
    {
      "servers": {
        "orbitrage": {
          "type": "http",
          "url": "https://api.orbitrage.ai/api/mcp",
          "headers": { "Authorization": "Bearer mcp_..." }
        }
      }
    }
    ```
  </Tab>

  <Tab title="Cursor">
    Settings → MCP → Add new server, pointing at the Streamable HTTP endpoint `https://api.orbitrage.ai/api/mcp` with an `Authorization: Bearer mcp_…` header.
  </Tab>
</Tabs>

## JSON-RPC methods

| Method       | Behavior                                                          |
| ------------ | ----------------------------------------------------------------- |
| `initialize` | Handshake — server name, version, protocol version, capabilities. |
| `tools/list` | The analytics tool catalog as MCP Tools.                          |
| `tools/call` | Run one tool (logged to your session audit).                      |
| `ping`       | Returns `{}`.                                                     |

## Quick check with curl

```bash theme={null}
# Health
curl -sS https://api.orbitrage.ai/api/mcp \
  -H "Authorization: Bearer mcp_..."

# List tools
curl -sS -X POST https://api.orbitrage.ai/api/mcp \
  -H "Authorization: Bearer mcp_..." \
  -H "content-type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

# Run one
curl -sS -X POST https://api.orbitrage.ai/api/mcp \
  -H "Authorization: Bearer mcp_..." \
  -H "content-type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"count_calls","arguments":{"range":"24h"}}}'
```
