-
Notifications
You must be signed in to change notification settings - Fork 4
feat(FDN-547): Add API request headers for MCP server tracking #464
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
| // Set the referrer to identify this as an MCP request | ||
| // Command will be set dynamically for each tool call | ||
| // Caller is 'mcp' to distinguish from 'cli' and other callers | ||
| setDVCReferrer('mcp', version, 'mcp') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mcp local?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not going to worry about that distinction until we figure out how we are going to deploy this.
| */ | ||
| export function setMCPToolCommand(toolName: string): void { | ||
| // Update the command to be the tool name, keeping version and caller the same | ||
| setDVCReferrer(toolName, mcpVersion, 'mcp') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mcp local instead?
* feat: add MCP API headers to requests * feat: add headers.ts file
* feat: add MCP API headers to requests * feat: add headers.ts file
* feat: add MCP API headers to requests * feat: add headers.ts file
feat: Add API request headers for MCP server tracking
Solution
commandfield to the specific MCP tool name (e.g., "list_features", "create_project")setDVCReferrerwherecallerparameter was ignoredChanges
src/mcp/utils/headers.ts- Utilities for setting MCP headerssrc/mcp/index.ts- Initialize headers on server startupsrc/mcp/utils/api.ts- Set tool-specific command before each API callsrc/api/apiClient.ts- Usecallerparameter instead of hardcoded 'cli'Result
API requests now include proper identification:
{"command":"<cli_command>","caller":"cli","version":"<version>"}{"command":"<mcp_tool>","caller":"mcp","version":"<version>"}This enables better analytics, debugging, and tracking of MCP tool usage patterns.