Skip to content

feat: Add mcp-handler tracing - #2696

Merged
Luca Forstner (lforst) merged 2 commits into
mainfrom
lforst/dum-e/barcelona-5090687d3e
Oct 29, 2026
Merged

Luca Forstner (lforst) merged 2 commits into
mainfrom
lforst/dum-e/barcelona-5090687d3e

Conversation

@lforst

Copy link
Copy Markdown
Member
  • Add automatic Braintrust tracing for MCP servers created with mcp-handler v1 and v2.

  • Add wrapMCPHandler() for manual tracing and integrations.mcpHandler to configure the integration.

    import { createMcpHandler } from "mcp-handler";
    import { wrapMCPHandler } from "braintrust";
    
    const createHandler = wrapMCPHandler(createMcpHandler); // New tracing wrapper
  • Wait for response sending to finish before recording an MCP request as complete.
    Previously, HTTP connection cleanup could mark successful requests as failed.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T15:36:31.022096Z b890521 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b890521076

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

);
// Per-request HTTP transports close as part of sending the terminal result,
// before the send promise settles. Let that promise determine the outcome.
if (!request.responseInFlight) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict close suppression to per-request transports

When a normal stateful transport such as WebSocket or stdio closes while its response send() is pending, responseInFlight now suppresses the connection-closed failure for every transport. If that send later resolves, the request is incorrectly recorded as successful; if it never settles after disconnection, the span remains open indefinitely. The comment describes behavior specific to per-request HTTP transports, so the suppression should be limited to those transports rather than all in-flight sends.

Useful? React with 👍 / 👎.

@lforst
Luca Forstner (lforst) merged commit d2ccf19 into main Oct 29, 2026
61 checks passed
@lforst
Luca Forstner (lforst) deleted the lforst/dum-e/barcelona-5090687d3e branch October 29, 2026 16:04
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.

2 participants