Skip to content

feat: Add fastmcp tracing - #2695

Merged
Luca Forstner (lforst) merged 3 commits into
mainfrom
lforst/dum-e/istanbul-34f92c6f8f
Oct 30, 2026
Merged

Luca Forstner (lforst) merged 3 commits into
mainfrom
lforst/dum-e/istanbul-34f92c6f8f

Conversation

@lforst

Copy link
Copy Markdown
Member
  • Add automatic tracing for FastMCP 3.35+ and 4.x servers, including stateless HTTP sessions.

  • Record tool calls, resource reads, prompts, notifications, and errors in Braintrust.
    Use integrations.fastmcp to control tracing and content capture separately from the MCP integration.

  • Add wrapFastMCP() for manual setup:

    import { wrapFastMCP } from "braintrust";
    import * as fastmcp from "fastmcp";
    
    const { FastMCP } = wrapFastMCP(fastmcp); // Add tracing to FastMCP sessions.

@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:37:12.272749Z db46e91 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: db46e91499

ℹ️ 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".

Comment on lines +243 to +247
if (integrations.fastmcp !== false) {
this.fastMCPPlugin = new FastMCPPlugin(
typeof integrations.fastmcp === "object" ? integrations.fastmcp : {},
);
this.fastMCPPlugin.enable();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Make fastmcp:false suppress fallback MCP tracing

When a user sets integrations.fastmcp: false while leaving the default mcp integration enabled, this condition disables only FastMCPPlugin; FastMCP 3/4 still uses @modelcontextprotocol/sdk, whose separately enabled MCPPlugin instruments the same server protocol. Consequently FastMCP requests can still produce MCP spans—and use MCP's default content capture—despite the explicit FastMCP opt-out. The new tests cover mcp: false and both integrations enabled, but not this configuration, so the advertised independent FastMCP tracing/content control is ineffective for users who otherwise need MCP instrumentation.

Useful? React with 👍 / 👎.

…-34f92c6f8f

# Conflicts:
#	js/src/auto-instrumentations/configs/all.ts
#	js/src/exports.ts
#	js/src/instrumentation/braintrust-plugin.ts
#	js/src/instrumentation/config.ts
#	js/src/instrumentation/plugins/mcp-interceptors.ts
@lforst
Luca Forstner (lforst) merged commit 5286934 into main Oct 30, 2026
61 checks passed
@lforst
Luca Forstner (lforst) deleted the lforst/dum-e/istanbul-34f92c6f8f branch October 30, 2026 08:45
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