feat(mcp): send the client's identity on lookups and grade requests#91
Merged
Conversation
The lookup tools called polygraph.so anonymously; only request_grade carried the caller's name/version. Now all three (check_server, list_servers, request_grade) attribute the connected client, so polygraph.so's aggregate per-agent usage counters see MCP clients as themselves rather than as a generic runtime User-Agent. - client-id.ts: clientAgent(server) — name/version plus whatever the initialize handshake declared (title, websiteUrl, description, capability keys such as sampling/roots). Software metadata only; nothing about the user is read or sent. - api.ts: postCheck/postGradeRequest carry source/agent_id/agent_meta in the body; getList via query params. - both servers bind the tool handlers with the connected client's identity, as request_grade already did. All fields are optional server-side — older deployments ignore them. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FW3vDMau8UYnNWCanfT4k
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The lookup tools called polygraph.so anonymously — only
request_gradeattributed its caller. Nowcheck_server,list_servers, andrequest_gradeall carry the connected client's identity from the MCP initialize handshake, feeding polygraph.so's aggregate per-agent usage counters (software metadata only — name/version, declared title/website/description, and capability keys likesampling/roots; nothing about the user).clientAgent(server)inclient-id.tscollects the handshake identity.postCheck/postGradeRequestsendsource/agent_id/agent_metain the body;getListvia query params.request_gradealready did.Verified: 23 tests (updated for the new fields), typecheck clean, build green, and a live end-to-end run — a client announcing
{title, sampling, roots}shows up in the grade index's agent counters with exactly that profile.Release: 0.26.0 in a follow-up version PR per the release flow.