Repository navigation
Federation: log every MCP call at both ends - #39
Merged
Merged
Conversation
To see that a study really is answered over MCP, every federated call now writes one line where this app asks a peer and one where its /api/mcp answers (lib/federation-log.ts): [federation →] federated_aggregates study=… peer=… (this app, as its simulated peer) 214ms ok 0.9 kB [federation ←] federated_aggregates study=… caller=this app (answered as its simulated peer) 89ms HTTP 200 answered 1.1 kB [federation ←] federated_patient_timeline study=… (patient-level) caller=outside 461ms HTTP 200 REFUSED The tool, the study and (patient-level tools) the table — never the arguments, so never a patient. The answering side logs once the response has been written (a streamed one is not when returned) and says whether the call was refused; a failed outbound call logs why. README: how to read them. Verified: scripts/gate.sh green (1258 unit, 253 e2e). The federation stage's production build logged 44 outgoing and 46 incoming calls (the extra two the e2e's outside callers, both refused), each once, with no patient id anywhere in the log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QLBVrkqBG7J7pqX6Qygx3z
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Every federated MCP call now writes one log line on each side. That makes it visible in the server's output (on Vercel, the runtime logs) that a study really was answered over MCP:
→(lib/federation-remote.ts): this app asking a peer. Logs the tool, study, peer, duration and size, or why the call failed.←(app/api/[transport]/route.ts): the/api/mcpendpoint answering. Logs who called (this app or outside), the duration once the response has been written, and whether the call was refused.Verified:
scripts/gate.shgreen, with 1258 unit tests and 253 e2e checks. The federation stage's production build logged 44 outgoing and 46 incoming calls, each once; the extra two incoming are the e2e suite's outside callers, both refused. No patient id appears in the log.🤖 Generated with Claude Code
https://claude.ai/code/session_01QLBVrkqBG7J7pqX6Qygx3z