Skip to content

feat(mcp): Add MCP server tracing - #2679

Open
Luca Forstner (lforst) wants to merge 5 commits into
mainfrom
lforst/dum-e/chicago-9b18514881
Open

Luca Forstner (lforst) wants to merge 5 commits into
mainfrom
lforst/dum-e/chicago-9b18514881

Conversation

@lforst

Copy link
Copy Markdown
Member
  • Add automatic tracing for Model Context Protocol (MCP) v1 and v2 servers, capturing tool calls, prompt retrievals, and resource reads.
  • Add wrapMCPServer() for manually enabling tracing on an existing server:
    import { wrapMCPServer } from "braintrust";
    
    wrapMCPServer(server); // Trace existing and future request handlers.
  • Record inputs, outputs, and session/request IDs so related requests can be correlated. Mark tool results with isError: true as failures even when the handler doesn't throw.
  • Omit response _meta and inline media bytes from traces. Capture images and resource blobs as attachments when enabled; always omit audio and video bytes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant