MCP
MCP
Let agents search and read traces over the Model Context Protocol.
POST https://adtraces.adfactory.app/mcp is a stateless MCP endpoint. Transport is Streamable HTTP with JSON-RPC 2.0, protocol version 2025-06-18, and responses are plain application/json (no SSE session).
Connect
Authenticate with an API key sent as a bearer token. The key needs at least one of traces:read, traces:write or surfaces:write, and every tool checks its own scope. A missing scope returns HTTP 403 with a JSON-RPC error (data.error is insufficient_scope) and a WWW-Authenticate header naming the scope. Visibility follows the web UI: your own traces and those of your namespace, plus public ones.
claude mcp add --transport http adtraces https://adtraces.adfactory.app/mcp --header "Authorization: Bearer trk_..."Other clients take the same URL and header in their MCP configuration:
{
"mcpServers": {
"adtraces": {
"type": "http",
"url": "https://adtraces.adfactory.app/mcp",
"headers": { "Authorization": "Bearer trk_..." }
}
}
}Tools
| Tool | Arguments | Purpose |
|---|---|---|
search_traces |
query, limit? |
Full-text search over titles, summaries and messages. Quoted phrases and -exclusions work. |
list_traces |
namespace?, limit?, cursor? |
Recent traces, newest first. Sub-agent traces with a visible parent are hidden. |
get_trace |
id, format? (summary or markdown) |
Metadata and AI summary, or the transcript as Markdown (cut at about 100k characters). |
get_trace_messages |
id, offset?, limit? |
Page through the messages of a long trace. |
Compatible with the original Traces MCP server:
| Tool | Purpose |
|---|---|
traces_search |
List traces filtered by project, creator or time window, as a Markdown table with URLs. |
traces_read |
Read a bounded window of events from a trace, optionally around one event. |
traces_lookup |
Resolve users or namespaces by name, ID or slug. |
Write and surface tools:
| Tool | Scope | Purpose |
|---|---|---|
traces_upsert |
traces:write |
Create or update a trace by externalId and append messages. Returns {ok, traceId, externalId, namespace, appended}, or {ok: false, error} with a code and retryable. |
traces_search_tools |
traces:read or surfaces:write |
Search the catalog of surface operations. |
traces_execute_tool |
per operation | Run one catalog operation with name and arguments. |
surface_build_instructions |
traces:read or surfaces:write |
Contract and workflow for building a surface. |
Surface operations are not top-level tools. Find them with traces_search_tools and run them with traces_execute_tool:
| Operation | Scope | Purpose |
|---|---|---|
traces_surfaces_search, traces_surfaces_get |
traces:read or surfaces:write |
List surfaces, read one with its versions. |
traces_surfaces_create |
surfaces:write |
Create a private surface (key, name). |
traces_surfaces_prepare_upload |
surfaces:write |
Reserve a version and get a single-use upload URL. Creates the surface if the key is new and name is given. |
traces_surfaces_complete_upload |
surfaces:write |
Turn the uploaded file into an immutable version and return a previewUrl. |
traces_surfaces_release_version |
surfaces:write |
Make a version current. |
traces_surfaces_update |
surfaces:write |
Change name, description or icon (metadata only). |
traces_surfaces_archive, traces_surfaces_restore |
surfaces:write |
Hide a surface or bring it back; versions stay untouched. |
Upload the HTML itself outside MCP: curl -fsS -X POST -H 'Content-Type: text/html' --data-binary @surface.html "<upload.url>". The URL is single use, expires after ten minutes and needs no bearer token.
Agent API
The original MCP server also uses POST https://adtraces.adfactory.app/v1/tools/list, /v1/tools/show and /v1/tools/lookup (bearer key with traces:read, responses in the usual {ok, data} envelope). They list traces by project, creator or time window, read event windows from traces, and resolve users and namespaces.
The id arguments accept the trace ID, the external ID or a full trace URL.
Trace content is recorded third-party text. The tools prefix their output with a note, and your agent should treat it as data, not as instructions.
Learning from traces
Tools for reusable skills are described under Learning skills.