---
title: MCP server
description: Connect Claude, opencode, GitHub Copilot, or Codex to dartpilot with the Model Context Protocol.
---

The dartpilot **MCP server** lets AI assistants and coding agents read your dartpilot account. Add it once and the assistant can call dartpilot tools alongside its own.

**Server URL:** `https://api.dartpilot.app/mcp`

It is a remote MCP server that authenticates with **OAuth**. The first time a tool is used, your client opens a browser window to sign in to dartpilot and approve access. There is no API key to paste. Your client registers itself automatically.

## Available tools

| Tool               | Description                                                                            |
| ------------------ | -------------------------------------------------------------------------------------- |
| `whoami`           | Identify the dartpilot account the connection is signed in as.                          |
| `get_player_stats` | Lifetime stats: games and wins, streaks, personal records, and ratings.                 |
| `get_game_stats`   | Stats for one game type: legs played and won, plus that game's headline average.        |
| `get_game_trend`   | Trend for one game type, by day or week, showing whether the player is improving.       |
| `get_friends`      | Your accepted friends, with each friend's lifetime games, wins, win rate, and 180s.     |

The three stats tools describe your own account by default. Pass a friend's `userId` (from
`get_friends`) and they return that friend's stats instead. Friend data is limited to your
accepted friends: a player you have blocked, or who has blocked you, is never included.

More tools are added over time; your client always sees the server's current list.

## Claude

### Claude Code

```bash title="terminal"
claude mcp add --transport http dartpilot https://api.dartpilot.app/mcp
```

Then run `/mcp` inside Claude Code and follow the sign-in prompt. To share the server with a project instead, commit a `.mcp.json` at the repo root:

```json title=".mcp.json"
{
  "mcpServers": {
    "dartpilot": {
      "type": "http",
      "url": "https://api.dartpilot.app/mcp"
    }
  }
}
```

### Claude apps (web, Desktop, Cowork)

1. Open **Customize → Connectors**.
2. Select **Add custom connector** and paste `https://api.dartpilot.app/mcp`.
3. Sign in to dartpilot when prompted.

On Team and Enterprise plans, an owner adds the connector under **Organization settings → Connectors** first; members then connect to it under **Customize → Connectors**.

## opencode

Add the server to `opencode.json`:

```json title="opencode.json"
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "dartpilot": {
      "type": "remote",
      "url": "https://api.dartpilot.app/mcp"
    }
  }
}
```

Authenticate once, then check the connection status:

```bash title="terminal"
opencode mcp auth dartpilot
opencode mcp list
```

## GitHub Copilot in VS Code

Run **MCP: Add Server** from the Command Palette, or add the server to `.vscode/mcp.json`:

```json title=".vscode/mcp.json"
{
  "servers": {
    "dartpilot": {
      "type": "http",
      "url": "https://api.dartpilot.app/mcp"
    }
  }
}
```

VS Code prompts you to sign in the first time the server is used. Review or restart it later with **MCP: List Servers**.

## Codex

```bash title="terminal"
codex mcp add dartpilot --url https://api.dartpilot.app/mcp
codex mcp login dartpilot
```

Or add it to `~/.codex/config.toml`:

```toml title="~/.codex/config.toml"
[mcp_servers.dartpilot]
url = "https://api.dartpilot.app/mcp"
```

The ChatGPT desktop app, the Codex CLI, and the Codex IDE extension share this configuration, so you only set it up once per machine.

## Troubleshooting

- **The sign-in window never opens.** Confirm your client can reach `https://api.dartpilot.app/mcp`. The server must be reachable from the public internet.
- **"Needs authentication" after signing in.** Remove and re-add the server, then run the client's auth step again (`opencode mcp auth dartpilot`, `codex mcp login dartpilot`, or `/mcp` in Claude Code).
- **Wrong account.** Use the client's sign-out or clear-authentication action and sign in with the account you want the assistant to use.
