Skip to content

feat(core): MCP server instrumentation #16807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 22 commits into from

Conversation

betegon
Copy link
Member

@betegon betegon commented Jul 3, 2025

An improvement on MCP server tracing. It follows:

This is WIP, and will later add:

  • error handling
  • PII

Project with this new spans:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).

betegon added 22 commits June 27, 2025 20:46
…ibute names to match OTEL draft semantic convention
@betegon betegon self-assigned this Jul 3, 2025
@betegon betegon changed the title Bete/mcp server semantic convention feat(core): MCP server instrumentation Jul 3, 2025
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

Generally this is looks to be the right direction! The only comment I would make is to do mv core/src/mcp-server.ts core/src/integrations/mcp-server/index.ts and move all of the utils/mcp-server files into that integrations folder. This matches our existing structure.

I do have some low prio items, but that I can get to once this PR gets out of draft.

attributes['mcp.resource.uri'] = String(params.uri);
// Extract protocol from URI
try {
const url = new URL(String(params.uri));
Copy link
Member

Choose a reason for hiding this comment

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

we have a url parsing helper in the core package that we should use here. It also handles relative URLs.

@betegon
Copy link
Member Author

betegon commented Jul 7, 2025

Thanks @AbhiPrasad! I'm closing this in favor of #16817, that avoids Proxy by using our Fill function so we make don't have any problem with Cloudflare (#16182).

I'll apply your suggestions on #16817

@betegon betegon closed this Jul 7, 2025
@betegon betegon deleted the bete/mcp-server-semantic-convention branch July 7, 2025 16:25
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