magpie-server serves an MCP server at POST /mcp on its HTTP port. An AI agent connects to it and searches and reads your traces with six read-only tools. It is on by default and uses the same API keys and tenants as the query API.
Connect your agent
- Claude Code
- Cursor
- Codex
read right:https://. With tenants and --auth trusted-header, the client also sends the header x-magpie-tenant.
Then ask the agent a question, for example: “Find the runs of the last hour with a failed tool call, and tell me why the tool failed.”
The tools
The arguments are the bodies of the query routes. An unknown field is refused. Tokens and cost per model:
aggregate with {"groupBy": {"field": "model"}, "metrics": ["inputTokens", "outputTokens", "costNanos"]}.
Limits
The limits keep each answer small enough for an agent’s context.
When an answer would be longer, long texts are cut and end with
…[cut: N more characters]. The field cut says what to ask for to get less. Ids and cursors are never cut, and every row comes.
A bad argument, a value over a limit, or a trace that is not there gives a tool error that says why. The agent can then ask again.
Keys, tenants and safety
Keys, tenants and safety
- With
--auth keys,/mcpneeds a key with thereadright:401with no key or an unknown key,403for a key with onlywrite. - With tenants, the tools read the key’s tenant.
- Nothing the tools do writes.
/mcpgives a key only what the query API on the same port gives it. - A request from a web page of another site is refused (
403). Clients in a browser page are not supported. Use a client that is a program. - To turn MCP off, start the server with
--no-mcp.
Protocol
Protocol
- Streamable HTTP with no session. Each POST is one JSON-RPC message and gets one JSON answer.
- Both protocol eras on one endpoint: 2025 clients (
initialize; 2025-03-26, 2025-06-18, 2025-11-25) and 2026-07-28 clients. - A request body is at most 1 MiB. A batch (a JSON array) is refused with
400. - OAuth is not built: the clients above send a fixed key in a header.
Check the server
magpie-server doctor checks that the server answers, takes your key and finds a test span.Query API
The routes behind the tools, with every field.