MCP Server
Use Retrace as an MCP server for AI coding agents like Claude Code, Cursor, and Windsurf.
Overview
Retrace provides a hosted Model Context Protocol (MCP) server that lets AI coding agents search traces, recall memories, and inspect past executions directly from their IDE. This bridges your observability data with your development workflow — agents can learn from previous runs without leaving the editor.
Setup
Connect your AI coding agent to Retrace's hosted MCP endpoint:
Cursor / Windsurf (MCP config):
{
"mcpServers": {
"retrace": {
"url": "https://api.retraceai.tech/mcp",
"headers": {
"Authorization": "Bearer rt_live_..."
}
}
}
}Claude Code:
claude mcp add --transport http retrace https://api.retraceai.tech/mcp --header "Authorization: Bearer rt_live_..."Codex:
[mcp_servers.retrace]
url = "https://api.retraceai.tech/mcp"
http_headers = { Authorization = "Bearer rt_live_..." }Replace rt_live_... with your Retrace API key from Settings.
Available Tools
Read Tools
| Tool | Description | Parameters |
|---|---|---|
list_traces | List recent agent traces | limit (1-50), offset, status |
get_trace | Get a trace with all child spans | trace_id |
search_spans | Semantic search across span content | query, limit (1-20), offset |
store_memory | Store a fact or preference | key, value, scope, category |
recall_memories | Search memories semantically | query, limit (1-20), offset |
get_tape | Retrieve a shareable tape by slug | slug |
Mutation Tools
| Tool | Description | Parameters |
|---|---|---|
create_trace | Create a new trace | name, input, session_id |
run_fork | Fork a trace and replay with modified input | trace_id, span_id, modified_input, name |
update_evaluation | Update evaluation criteria/description | evaluation_id, description, criteria |
publish_tape | Publish a trace as a shareable tape | trace_id, title, description |
Pagination
All list tools support offset for pagination. Responses include:
{
"results": [...],
"offset": 0,
"limit": 10,
"hasMore": true
}To page through results: increment offset by limit until hasMore is false.
Example Prompts
Once configured, ask your AI coding agent natural-language questions:
- "What traces failed recently?" → calls
list_traceswithstatus: "failed" - "Search for spans where the agent called web_search" → calls
search_spans - "Remember that the user prefers TypeScript" → calls
store_memory - "What do we know about the API rate limits?" → calls
recall_memories - "Show me the demo tape" → calls
get_tape - "Fork that trace from the second LLM call with a different prompt" → calls
run_fork - "Publish this trace as a shareable tape" → calls
publish_tape - "Create a new trace for my test run" → calls
create_trace
Use Cases
Debugging — When an agent run fails, ask your coding agent to pull the trace and inspect which span errored. It can read inputs, outputs, and error messages without you opening the dashboard.
Knowledge persistence — Store architectural decisions, user preferences, or project conventions as memories. Your coding agent recalls them in future sessions automatically.
Learning from history — Search past successful traces to understand how a workflow executed, then replicate or improve the pattern.
Troubleshooting
| Issue | Solution |
|---|---|
| Tools not appearing | Restart your IDE after editing the MCP config |
| 401 Unauthorized | Verify your API key is valid and prefixed with rt_live_ |
| Search returns empty | Ensure you have recorded traces with the same API key |