# MCP (Claude Code / Cursor / Claude Desktop)

Drive Ingero from an AI assistant. The agent ships an MCP server
(`ingero mcp`) that exposes a recorded trace as Model Context Protocol
tools, so Claude Code, Cursor, or any MCP client can query thousands of
captured kernel events in natural language.

This is **on-box, stdio** integration: the assistant runs on the same
machine as the recorded trace DB and launches `ingero mcp` as a
subprocess over stdio. No network, no TLS, no bearer.

## Record a trace first

```
sudo ingero trace --record --db /var/lib/ingero/run.db
# ... reproduce the workload ...
```

## Claude Code

Add to `.mcp.json` in your project (or `~/.mcp.json`):

```json
{
  "mcpServers": {
    "ingero": {
      "command": "ingero",
      "args": ["mcp", "--db", "/var/lib/ingero/run.db"]
    }
  }
}
```

Then ask, e.g. *"Which CUDA op has the worst p99 in this trace, and
why?"* Claude calls the Ingero MCP tools to answer from the events.

## Cursor

`~/.cursor/mcp.json` (or the project `.cursor/mcp.json`) uses the same
shape:

```json
{
  "mcpServers": {
    "ingero": { "command": "ingero", "args": ["mcp", "--db", "/var/lib/ingero/run.db"] }
  }
}
```

## Claude Desktop

`claude_desktop_config.json` (Settings -> Developer -> Edit Config):

```json
{
  "mcpServers": {
    "ingero": { "command": "ingero", "args": ["mcp", "--db", "/var/lib/ingero/run.db"] }
  }
}
```

## Notes

- `--db` defaults to `~/.ingero/ingero.db` if omitted; point it at the
  DB you recorded with `ingero trace --record`.
- For a remote assistant (not on the GPU box), `ingero mcp --http :8080`
  serves the same tools over HTTPS/TLS 1.3 instead of stdio; see
  `ingero mcp --help`. The stdio recipe above is the simplest path.
- The MCP tool surface and full flag list are in
  [`docs/commands.md`](../../../docs/commands.md).
