# MCP server Connect a coding agent to your traces over MCP with a personal access token, using ten read-only tools. The cetra server speaks the Model Context Protocol, so a coding agent such as Claude Code or Cursor can list your projects, run SQL, search traces and read spans while it works on your code. Every tool is read-only. To ask questions in the UI, use the [assistant](https://cetra.sh/docs/platform/assistant/) instead. ## Create a personal access token The MCP endpoint accepts personal access tokens (`pat-cetra-…`) only. A session cookie or an API key (`sk-cetra-…`) is refused with `403`. 1. Sign in to the UI. 2. Open the account menu at the bottom of the sidebar and select **Account**. In the **Personal access tokens** card, select **New token** and choose **Read only**. A read-only token is enough. 3. Copy it. cetra shows it once. The token acts as you: the agent sees the projects you can read, and no others. See [API keys and tokens](https://cetra.sh/docs/platform/api-keys/). ## Endpoint The endpoint is `POST /mcp`, for example `https://cetra.example.com/mcp`. It uses streamable HTTP, is stateless and answers with JSON. There is no stdio mode. Authenticate with `Authorization: Bearer pat-cetra-…`. ## Configure your client Client syntax changes between releases. The Claude Code command matches `claude mcp add --help`; check your client's documentation for the current syntax. ### Claude Code ```bash claude mcp add --transport http cetra https://cetra.example.com/mcp \ --header "Authorization: Bearer pat-cetra-…" ``` ### Cursor Add this to `.cursor/mcp.json`: ```json { "mcpServers": { "cetra": { "url": "https://cetra.example.com/mcp", "headers": { "Authorization": "Bearer pat-cetra-…" } } } } ``` ### Other clients Any client that supports streamable HTTP and custom headers works with the same two values: ```json { "url": "https://cetra.example.com/mcp", "headers": { "Authorization": "Bearer pat-cetra-…" } } ``` Keep the token out of files you commit. ## Tools In every tool, `project` is a project ID or `/`. Times (`from`, `to`) are RFC 3339 timestamps, or epoch milliseconds as a string. | Tool | Arguments | Returns | |---|---|---| | `list_projects` | none | The projects you can read: ID, org slug, slug, name and your role. | | `get_schema` | `project` | The views, columns, types and descriptions you can query. | | `query_sql` | `project`, `query`, `params`, `from`, `to`, `limit` (1 to 1,000, default 100), `max_chars` | Columns, rows, row count, a truncated flag and notes. `from` and `to` are required, at most 30 days apart. The call times out after 30 seconds. | | `list_saved_views` | `project`, `kind` | The saved views and SQL queries you can see. | | `list_prompts` | `project`, `q`, `label`, `limit` (1 to 200, default 50), `max_chars` | The prompts of the project, by name: type, description, tags, latest version and labels. `label` keeps the prompts that carry it. | | `get_prompt` | `project`, `name`, `label` (default `production`), `version` | One prompt version: its template, config, labels and variables. Give `label` or `version`, not both; `latest` is the latest version. | | `search_traces` | `project`, `from`, `to`, `view`, `filter`, `search`, `limit` (1 to 100, default 20), `include_eval`, `include_experiments`, `max_chars` | Compact trace summaries. `view` is a saved view ID or name, and explicit arguments override it. The time window is required. | | `get_trace` | `project`, `trace_id`, `around`, `include_payloads` (default false), `max_chars` | The span tree, with short input and output previews when `include_payloads` is true. | | `get_span` | `project`, `trace_id`, `span_id`, `around`, `max_chars` | One span with its full payloads, cut to fit `max_chars`. | | `list_issues` | `project`, `state` (`open` by default, `resolved`, `ignored` or `all`), `source`, `limit` (1 to 100, default 20), `max_chars` | The issues, newest first by last seen: ID, title, kind, state, whether they regressed, source, first and last seen, the occurrences and users of the last 7 days, and a link to the issue. | For example, ask your agent: "Which issues in support-bot are open? Read a trace of the one that happened most often this week." The agent can list the issues with `list_issues`, then find and read a trace with `search_traces` and `get_trace`. ## Limits - Each token can make 60 requests a minute and 4 at a time. Beyond that the server answers `429 rate_limited`. - Every result is capped at `max_chars` characters (default 20,000, from 1,000 to 100,000). - String values in attributes and metadata are cut to 200 characters. `query_sql` cuts string cells at 2,000 characters. A `notes` list in the result names every cut. - Errors in arguments or queries come back as a tool result with `isError: true` and an error code and message. ## What it cannot do The MCP server cannot write. It cannot send spans, add scores, change settings or delete data. Use the [REST API](https://cetra.sh/docs/reference/api/overview/) or the UI for that. ## Docs for coding agents The documentation is also published as plain text for coding agents: `https://cetra.sh/llms.txt` is an index, and `https://cetra.sh/llms-full.txt` holds the whole site. Each docs page also has a Markdown copy at `https://cetra.sh/docs//index.md`. The page title has two actions: **Copy page** copies the Markdown to the clipboard, and **View as Markdown** opens it. The generated API reference pages, except the overview, have neither. ### Docs MCP server The docs MCP server searches the docs and returns pages. It runs at `https://cetra.sh/mcp`, needs no token and has two read-only tools: | Tool | Arguments | Returns | |---|---|---| | `search_docs` | `query`, `limit` (1 to 20, default 8) | The pages that match, each with its title, URL and a one-line summary. Read one with `get_page`. | | `get_page` | `url` | One page as Markdown. `url` is a `https://cetra.sh/docs/…` URL or a `/docs/…` path. | In Claude Code, run: ```bash claude mcp add --transport http cetra-docs https://cetra.sh/mcp ``` In Cursor, add this to `.cursor/mcp.json`: ```json { "mcpServers": { "cetra-docs": { "url": "https://cetra.sh/mcp" } } } ``` The docs MCP server searches the documentation only and has no access to your data. It is separate from the trace MCP above, which needs a personal access token.