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

# MCP

> Run Traversal from Claude, Cursor, and other AI clients, and let your local agent and Traversal investigate together.

The Traversal MCP server lets compatible AI clients, such as Claude Code, Cursor, and Claude Desktop, run investigations, ask follow-ups, and retrieve results using the [Model Context Protocol](https://modelcontextprotocol.io/). It uses the streamable-http transport with API key authentication.

Your local agent handles what's local (your code, your terminal, your tools). Traversal investigates across your production stack. The two hand work back and forth until the incident is understood.

**Endpoint:** `https://api.prod.traversal.com/mcp/`

For [single-tenant SaaS](https://docs.traversal.com/architecture/single-tenant-saas.md) or [BYOC](https://docs.traversal.com/architecture/byoc.md) deployments, use your organization's API URL + `/mcp/`.

## Agent-to-agent mode

When another agent calls Traversal, it runs in `lightning` [investigation depth](https://docs.traversal.com/using-traversal/investigations.md#investigation-depth), built for quick back-and-forth between agents. A first pass typically returns in 30 seconds to 2 minutes. Your agent can follow up to go deeper.

You don't call Traversal directly. Describe the problem to your AI agent as you normally would, and it decides when to bring Traversal in. The work then runs in both directions:

> [card] Your agent → Traversal
>
> Your agent sends Traversal the problem and what it can do locally (your repo, `kubectl`, your other tools). Traversal investigates across your metrics, logs, traces, deployments, and topology, which your local agent can't see on its own.

> [card] Traversal → your agent
>
> Traversal hands back specific next steps your agent can run, such as *check `src/checkout/handler.go:142`* or *run `kubectl logs -n prod checkout-service-xyz`*. Your agent runs them locally and feeds the results back.

### The collaboration loop

Each cycle works like this:

**1. Your agent calls `investigate`**

It sends Traversal the problem, what it can access locally, and how focused to stay.

**2. Traversal investigates**

A `lightning` investigation runs across your observability stack and returns findings plus next steps your agent can execute.

**3. Your agent acts locally**

It reads the file, runs the command, or queries a tool only it has access to.

**4. Your agent calls `follow_up`**

It passes the new evidence back, using the `session_id` from the first call. Traversal folds it in and refines the diagnosis.

**5. Repeat until resolved**

Follow up as many times as you need. Each call builds on the same investigation context.

Your agent passes along context that sharpens the investigation:

* What it can access locally (your codebase, `kubectl`, your other tools), so Traversal can hand back steps your agent can run.
* How focused to be: a tight look at one service, or a broad sweep across many.
* The affected services and time window, so Traversal targets the right place first.

## Authentication

Generate an API key in the Traversal web app under **[Settings → API keys](https://app.traversal.com/settings/api-keys)**. The key is shown once, so copy it before you leave the page.

For a shared MCP client or unattended workflow, use a [service-account key](https://docs.traversal.com/setup/service-accounts.md) instead. An organization Admin creates it under **Settings → Account management → Service accounts**. The client acts as the service account, and the account owns its investigations.

Pass it in the `Authorization` header:

```text theme={null}
Authorization: Bearer YOUR_API_KEY
```

When rotating a service-account key, create the replacement on the same account so it can continue existing investigations. Follow-ups require the identity that owns the session; a different account cannot take over those follow-ups.

## Setup

Every client needs the same two things: the endpoint URL and an `Authorization` header. Find your client below.

> [accordion] Claude Desktop
>
> Open **Settings → Developer → Edit Config** and add:
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "Traversal": {
>       "type": "http",
>       "url": "https://api.prod.traversal.com/mcp/",
>       "headers": {
>         "Authorization": "Bearer YOUR_API_KEY"
>       }
>     }
>   }
> }
> ```
>
> Restart Claude Desktop after saving.

> [accordion] Claude Code
>
> ```bash theme={null}
> claude mcp add traversal \
>   --transport http \
>   --header "Authorization: Bearer YOUR_API_KEY" \
>   -- https://api.prod.traversal.com/mcp/
> ```

> [accordion] Cursor
>
> Add to `.cursor/mcp.json` in your project root or global settings:
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "Traversal": {
>       "url": "https://api.prod.traversal.com/mcp/",
>       "headers": {
>         "Authorization": "Bearer YOUR_API_KEY"
>       }
>     }
>   }
> }
> ```

> [accordion] OpenCode
>
> Add to your `opencode.json` config:
>
> ```json theme={null}
> {
>   "$schema": "https://opencode.ai/config.json",
>   "mcp": {
>     "traversal": {
>       "type": "remote",
>       "url": "https://api.prod.traversal.com/mcp/",
>       "oauth": false,
>       "timeout": 300000,
>       "headers": {
>         "Authorization": "Bearer {env:TRAVERSAL_API_KEY}"
>       }
>     }
>   }
> }
> ```
>
> Set the `TRAVERSAL_API_KEY` environment variable with your API key before launching OpenCode.

> [accordion] Other clients
>
> Any client supporting the **streamable-http** transport can connect (ChatGPT, Windsurf, VS Code, etc.). Configure it with the endpoint URL and an `Authorization: Bearer` header containing your API key.

## Available tools

| Tool | Description |
| - | - |
| `investigate` | Run a fast first-pass investigation (typically 30s–2min). The agent passes the incident, what it can access, and how focused to be. |
| `follow_up` | Continue an investigation using its `session_id`: drill into findings, verify a hypothesis, or feed back evidence your agent gathered locally. |
| `get_investigation` | Get the status and report for an investigation, with a `ui_url` link to the web app. |
| `list_investigations` | List recent investigations for your organization. |
| `product_feedback` | Send feedback about the MCP experience to the Traversal team. |

> [!TIP]
>
> A single `investigate` call is a first pass. Follow up at least once to drill into findings, verify hypotheses, or return what your agent found locally.

## FAQ

> [accordion] Why is an MCP investigation faster than the web app?
>
> MCP calls use `lightning` depth, which returns a first pass quickly so your agent can keep moving. The web app can run longer, deeper investigations. Over MCP, that depth comes from follow-ups.

> [accordion] Does Traversal run commands on my systems?
>
> No. Traversal doesn't run commands on your machine. In agent-to-agent mode it suggests next steps, such as a command to run or a file to check. Your local agent decides whether to run them, using its own permissions and access.

> [accordion] Authentication failed (401)
>
> Verify your API key is correct and hasn't been revoked. If you recently regenerated it, update your client configuration.

> [accordion] Investigation is slow or times out
>
> A first pass usually returns within two minutes. If it takes longer, try a narrower, surgical investigation first and use `follow_up` to expand scope.

> [accordion] Viewing results in the web app
>
> Call `get_investigation`. The response includes a `ui_url` link to the full investigation in the Traversal web app.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.