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

# MCP server

> Query your project's traces, evals, and drift from any MCP client — over OAuth or an API key.

RunAgain exposes a remote [Model Context Protocol](https://modelcontextprotocol.io) server so
agents and IDEs (Claude, Cursor, …) can read your observability data and trigger eval runs. The
endpoint is `POST https://runagain-mcp.tamas-14b.workers.dev/mcp` (Streamable HTTP, JSON-RPC 2.0).

## Connect with OAuth (recommended)

OAuth is the preferred flow for IDE/agent clients that can open a browser. There's no secret to
copy — the client opens this workspace in your browser, you approve and pick a project, and the
token is captured by the client's local callback.

<Steps>
  <Step title="Add the server in your client">
    Point your MCP client at the endpoint above. Clients that support OAuth discover the flow
    automatically via `/.well-known/oauth-protected-resource`.
  </Step>

  <Step title="Approve in the browser">
    Your client opens RunAgain, you sign in (if needed), choose which **workspace** to grant, and
    approve. The client's loopback callback captures the token.
  </Step>
</Steps>

<Note>
  Tokens issued via OAuth don't show up in the API-keys list in **Settings** — revoke access from
  your client's settings. Access is scoped to the single project you approved.
</Note>

## Connect with an API key

Any MCP client can also authenticate with a project API key (from **Settings → API keys**):

```json theme={null}
{
  "mcpServers": {
    "runagain": {
      "url": "https://runagain-mcp.tamas-14b.workers.dev/mcp",
      "headers": { "Authorization": "Bearer sk_your_key" }
    }
  }
}
```

The key (`Authorization: Bearer sk_…` or `x-runagain-key`) resolves to exactly one project; every
tool is scoped to it.

## Tools

Read tools (safe, read-only):

* **Traces** — `list_traces`, `get_trace`, `get_trace_io`, `compare_traces`, `traces_with_tool_errors`
* **Agents** — `previous_agent_run`, `agent_run_series`, `agent_run_count`
* **Scores & health** — `get_trace_scores`, `list_run_issues`, `get_baseline_config`
* **Datasets / experiments / annotations** — `list_datasets`, `list_dataset_items`,
  `list_experiments`, `get_experiment_results`, `list_annotation_queues`, `list_queue_items`
* **Drift & overview** — `list_drift_monitors`, `get_drift_series`, `overview_stats`

Trigger tools (start an eval-plane pass; not read-only):

* `run_experiment`, `run_online_scoring`, `run_drift`, `run_baselines`, `run_health`
