---
title: MCP
subtitle: Connect your AI tool to Respan logs, traces, prompts, and monitors.
---

Add `https://mcp.respan.ai/mcp` to your AI tool and sign in with your Respan account.

<Tabs>
<Tab title="Claude app">
In Claude on the web or Claude Desktop:

1. Go to **Customize** › **Connectors** and click **Add**.
2. Hover over **Custom** and select **Web**.
3. Name it `Respan`, enter `https://mcp.respan.ai/mcp`, and click **Continue**.
4. Keep the detected sign-in settings, click **Add**, and sign in to Respan.
5. In a chat, click **+**, hover over **Connectors**, and turn on **Respan**.

</Tab>
<Tab title="ChatGPT">
1. Go to [chatgpt.com/plugins](https://chatgpt.com/plugins), click **+**, and choose **Add custom MCP server**.
2. Name it `Respan` and enter `https://mcp.respan.ai/mcp` as the server URL.
3. Choose OAuth for authentication, review the warning, and select **I understand and want to continue**.
4. Select **Create as a plugin**, then sign in to Respan.

Whether you can add custom MCP servers depends on your ChatGPT plan. In Business and Enterprise workspaces, an admin may need to allow them.
</Tab>
<Tab title="Claude Code">
```bash
claude mcp add --transport http --scope user respan https://mcp.respan.ai/mcp
```

Then run `/mcp` in Claude Code, choose **respan**, and sign in.

</Tab>
<Tab title="Cursor">
Add this to `~/.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "respan": {
      "url": "https://mcp.respan.ai/mcp",
      "auth": {
        "CLIENT_ID": "enc_mQcqjLKvweUikLjRuWfTCem2CVwhJl39wSNfEOmSpuW7Pd02UtUaoL4vR5JdIwXelPmuap6S6Bmow7L3MY4Z_vbKz375X6T71R7sRdTBxPoDrYsCepi-7kqNGwPLwx9a9ucFaqAff1hPF4lNfXj6oeHSKspd8ci7TgU-Y813M_ZZ2P7qcKpjcsWuv2vZJsiZUyNL5rTIDdwbKGQXCCM7f8P_EPuhE5HC6yJ_O0rDy4Y1572C0eECAQusDgBoV5p7HG3LNhGkqsph2-APkgnU9IMgUNrFxofF"
      }
    }
  }
}
```

Then sign in to **respan** from Cursor's MCP settings. The `CLIENT_ID` is a public identifier registered for Cursor, not a secret.
</Tab>
<Tab title="Codex">
```bash
codex mcp add respan --url https://mcp.respan.ai/mcp
codex mcp login respan
```
</Tab>
<Tab title="Other clients">
Any client that supports remote MCP servers with OAuth works: add `https://mcp.respan.ai/mcp` and sign in when it asks. Without OAuth, [use an API key](#use-an-api-key).
</Tab>
</Tabs>

## Use an API key

For scripts, CI, or clients without sign-in, send a Respan API key as a bearer token. Create one in the [platform](https://platform.respan.ai) under **API keys**.

<Tabs>
<Tab title="Claude Code">
```bash
claude mcp add --transport http --scope user respan https://mcp.respan.ai/mcp \
  --header "Authorization: Bearer $RESPAN_API_KEY"
```
</Tab>
<Tab title="Codex">
```bash
codex mcp add respan --url https://mcp.respan.ai/mcp --bearer-token-env-var RESPAN_API_KEY
```
</Tab>
<Tab title="Other clients">
```json
{
  "mcpServers": {
    "respan": {
      "url": "https://mcp.respan.ai/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_RESPAN_API_KEY"
      }
    }
  }
}
```
</Tab>
</Tabs>

On Respan Enterprise, use `https://mcp.respan.ai/mcp/enterprise` instead.

## Tool categories

The server lists a few everyday tools when it connects. Your agent finds the rest with `tool_search` and runs them with `tool_run`.

| Category | Use it to |
| --- | --- |
| Logs and traces | Find requests and inspect complete runs. |
| Behaviors and errors | Investigate flagged answers, error groups, and incidents. |
| Metrics | Compare cost, latency, tokens, and usage. |
| Prompts | Edit, version, and deploy prompts. |
| Monitors | Configure alerts and inspect delivered notifications. |
| Workspace | List and switch organizations with OAuth. |

Behavior queries default to whole traces. Ask for individual spans when investigating gateway requests.

## Tools by area

Each block below lists the main tools for one area of Respan, the ID each tool takes, and a prompt to try. Your agent finds the rest with `tool_search`.

### Getting started

Check that your project receives data.

- `project_list`: confirm which project your key belongs to (`id`).
- `log_create`: send one labeled sample log and read it back (`span_id`).
- `span_list`: see your app's own logs from the last few minutes.

Try: "Check that Respan is set up: send a test log, then tell me whether my app sent any logs in the last 10 minutes."

### Logs and traces

Find requests and inspect complete runs.

- `session_list`, `session_get`: sessions (`session_identifier`).
- `trace_list`, `trace_get`: traces (`trace_id`, with or without dashes).
- `span_list`, `span_get`: spans (`span_id`).
- `query_schema_get`, `query_run`: a read-only SQL query, as in the SQL editor.

Try: "Open session `conv_5d21` and show me the LLM call that promised a refund."

### Datasets and evals

Save real traces as a dataset, replay them on another model, and compare the scores.

- `dataset_create`: save traces as a dataset (`dataset_id`).
- `dataset_version_create`: replay them, scored by your custom behaviors' IDs in `behavior_settings`.
- `dataset_version_comparison_get`: compare two versions row by row.

Try: "Save last hour's support-bot traces as a dataset, replay them on `gpt-4.1-mini` scored by my *Refund promise* behavior, and show me the rows that got worse."

### Gateway

Choose models and control routing.

- `model_list`, `provider_list`: what you can call (`model_name`).
- `route_list`, `route_create`, `route_update`: fallback and split routes (`name`).
- `ab_test_create`, `ab_test_summary`: A/B tests on live traffic (`ab_test_id`).
- `cache_list`, `cache_get`: cached responses (`cache_key`).

Try: "Shadow-test `gpt-4.1-mini` on 10% of my support-bot sessions and compare cost and scores side by side."

### Prompts

Edit, test, deploy, and roll back prompts.

- `prompt_list`: find a prompt (`prompt_id`).
- `prompt_version_update`: edit it as a draft.
- `prompt_run`: try a version once. It is billed like any request.
- `prompt_deploy`: put a version live, or roll back to an earlier one.

Try: "Make my *Support reply* prompt answer in two sentences, try it on a refund question, and deploy it."

### Behaviors and guardrails

Define behaviors, score live traffic, and correct verdicts.

- `custom_behavior_create` with `is_scoring_live_traffic`: score production spans (`id`).
- `behavior_summary`, `behavior_timeseries`: how often a behavior fires over time.
- `behavior_span_list`: the spans where it fired.
- `behavior_verdict_update`: correct a verdict.
- `guardrail_settings_update`, `pii_settings_update`: turn on guardrails and PII redaction.

Behavior queries count spans by default. Pass `scope` `traces` or `sessions` to count whole traces or sessions.

Try: "Flag every chat where a customer asks for a refund, and show me how often it happens this week."

### Errors and incidents

Find what is failing, when it started, and the logs behind it.

- `error_group_list`, `error_group_get`: error groups (`fingerprint`).
- `incident_list`, `incident_get`: incidents and the error groups that caused them (`incident_id`).
- `error_group_timeseries`: errors over time.
- `span_list` with `filters.error_fingerprint`: example logs for an error group.

Try: "What broke in the last 24 hours, where, and since when? Show me two example logs."

### Monitors and Inbox

Set up alerts and read what they sent.

- `monitor_create`, `monitor_test`: create a monitor and send a test alert (`monitor_id`).
- `monitor_commit`, `monitor_deploy`: put it live.
- `monitor_run_history`: the alerts it sent.
- `notification_method_create`: Slack and other destinations.
- `inbox_item_list`, `inbox_rule_create`: the Inbox and its rules.

Try: "Alert #checkout-alerts in Slack when a checkout request fails, and send a test alert."

### Project settings

Set up a project's keys, webhooks, limits, exports, and retention.

- `api_key_create`: a new key. Pass `permissions_override: ["*:read"]` for a read-only one. The secret is shown once.
- `api_key_list`, `api_key_customer_revoke`: list and revoke keys (`key_id`). Revoking asks for the key's name.
- `webhook_config_create`, `webhook_config_list`, `webhook_config_delete`: webhooks (`webhook_id`).
- `limit_policy_create`, `limit_policy_list`, `limit_policy_update`: spend and rate limits (`policy_id`).
- `export_job_create`, `export_job_get`: log exports (`export_job_id`).
- `integration_list`, `tag_list`, `retention_get`: integrations, tags, and log retention.

Try: "Create a read-only API key for our CI, cap the project at $100 a month, and export last week's logs as CSV."

### Simulations

Generate test scenarios for a prompt, run them, and compare runs.

- `simulation_scenario_set_create`: generate a scenario set for a saved prompt (`prompt_id`).
- `simulation_scenario_set_list`, `simulation_scenario_set_get`: read sets and their scenarios (`dataset_id`).
- `simulation_scenario_create`, `simulation_scenario_update`, `simulation_scenario_delete`: add, edit, or delete a scenario (`scenario_id`).
- `simulation_run`: run the set, optionally on another prompt version (`prompt_version_id`).
- `dataset_log_list`, `dataset_version_comparison_get`: each scenario's conversation and verdict, and two runs compared.

Try: "Add a scenario where a customer asks to return shoes bought 45 days ago, run the set on prompt v1 and v2, and tell me which scenarios got worse."
