Skip to content

Add MCP metrics #69

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

Merged
merged 7 commits into from
Apr 24, 2025
Merged

Add MCP metrics #69

merged 7 commits into from
Apr 24, 2025

Conversation

cmsparks
Copy link
Collaborator

This adds 3 event types, which tracks:

  • Tool calls by name (with error/no error)
  • Session start with userId, clientInfo (i.e. claude/cursor), and clientCapabilities (roots/sampling support)
  • Auth user (with error/no error)

To track these events, all you need to use is use the CloudflareMCPServer superclass, which basically adds in all the metrics necessary to track this data as long as you have a metrics binding. All of these metrics are intended to be included in the same server namespace.

We don't track sessionId here, because it's too hard to extract consistently from the McpServer class.

@cmsparks cmsparks force-pushed the csparks/mcp-metrics branch from 6233099 to 6e186e0 Compare April 24, 2025 19:11
@cmsparks cmsparks requested review from Maximo-Guk, deloreyj and courtney-sims and removed request for deloreyj April 24, 2025 19:12
@irvinebroque irvinebroque requested a review from nevikashah April 24, 2025 19:16
Copy link
Collaborator

@irvinebroque irvinebroque left a comment

Choose a reason for hiding this comment

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

🙌

@cmsparks cmsparks force-pushed the csparks/mcp-metrics branch from 3dfcea6 to a421a44 Compare April 24, 2025 19:48
@cmsparks cmsparks force-pushed the csparks/mcp-metrics branch 2 times, most recently from 5913013 to b200fb5 Compare April 24, 2025 20:14
@cmsparks cmsparks force-pushed the csparks/mcp-metrics branch from b200fb5 to 5846a35 Compare April 24, 2025 20:15
@cmsparks cmsparks merged commit 48ca0f2 into main Apr 24, 2025
6 checks passed
@cmsparks cmsparks mentioned this pull request Apr 25, 2025
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.

3 participants