Opt Modern backends into log notifications via logLevel _meta - #6140
Open
JAORMX wants to merge 1 commit into
Open
Opt Modern backends into log notifications via logLevel _meta#6140JAORMX wants to merge 1 commit into
JAORMX wants to merge 1 commit into
Conversation
The 2026-07-28 (Modern) MCP revision removed the logging/setLevel RPC; the per-request io.modelcontextprotocol/logLevel _meta key replaces it. modelcontextprotocol/go-sdk#1116 confirmed go-sdk's SetLoggingLevel is wont-fix-by-design on Modern sessions, so a Modern backend never emits notifications/message through vMCP. When server->client forwarding is bound, modernCallTool now overlays logLevel: debug onto the request _meta (the Modern analogue of the Legacy enableBackendLogging) and relays interleaved notifications/message and notifications/progress from the backend's SSE stream to the downstream client. The logLevel key and listener are omitted when forwarding is unbound, and every other Modern call site is unchanged. Also export mcp.MetaKeyLogLevel for the overlay, and reframe the two pin comments that attributed the -32020 rejection to a transient upstream bug — it is the standing contract for a removed RPC. Closes #6130
JAORMX
requested review from
ChrisJBurns,
amirejaz,
blkt,
jerm-dro,
jhrozek,
rdimitrov and
tgrunnagle
as code owners
July 29, 2026 11:55
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6140 +/- ##
==========================================
- Coverage 72.56% 72.46% -0.10%
==========================================
Files 734 734
Lines 75912 75952 +40
==========================================
- Hits 55084 55042 -42
- Misses 16920 17015 +95
+ Partials 3908 3895 -13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
The 2026-07-28 (Modern) MCP revision removed the
logging/setLevelRPC — the per-requestio.modelcontextprotocol/logLevel_metakey replaces it. modelcontextprotocol/go-sdk#1116 confirmed go-sdk'sSetLoggingLevelis wont-fix-by-design on Modern sessions, so a Modern-classified backend never emittednotifications/messagethrough vMCP: the Legacy-onlyenableBackendLoggingRPC doesn't run on the Modern path, and the Moderntools/callnever set thelogLevelopt-in (a conformant backend MUST NOT emit logs without it).This adds Modern logging parity with the Legacy path, in two halves (opt-in alone would elicit notifications that were then silently dropped):
modernCallTooloverlayslogLevel: debugonto the request_metait mints — the Modern analogue ofenableBackendLogging. Unbound, the key is omitted so the backend does not emit. All othermodernCallsites (discover, list, resources/read, prompts/get, completion) are unchanged.modernCall/readModernSSEaccept anonNotificationcallback; interleaved SSE notifications are handed to it instead of dropped.modernCallToolwires it to a newnewModernNotificationForwarder, relayingnotifications/message→NotifyLogandnotifications/progress→NotifyProgressdownstream. A nil listener preserves the prior drop behavior, so non-tool callers are unaffected.Also exports
mcp.MetaKeyLogLevelfor the overlay, and reframes two pin comments that attributed the-32020rejection to a transient upstream bug — it is the standing contract for a removed RPC.Closes #6130
Type of change
Test plan
task test)task lint-fix)New unit coverage:
TestModernCall_LogLevelMeta(key injected / omitted),TestModernCall_SSENotificationRelay(notification delivered AND response still matched),TestModernCallTool_LogLevelGating(bound vs unbound forwarders). Fullpkg/vmcp/...andpkg/mcpsuites pass.Changes
pkg/vmcp/client/modern.gomodernCall/readModernEnvelope/readModernSSE/mergeModernMetatakelogLevel+onNotification; relay interleaved SSE notificationspkg/vmcp/client/client.gomodernCallToolinjectslogLevel: debug+ wires the notification forwarder when forwarding is bound; other callers pass""/nilpkg/vmcp/client/forwarding.gonewModernNotificationForwarder(raw method+params →NotifyLog/NotifyProgress)pkg/mcp/revision.goMetaKeyLogLevelpkg/vmcp/server/*_integration_test.gologging/setLevelpin comments to go-sdk#1116's wont-fix resolutiondocs/arch/10-virtual-mcp-architecture.mdDoes this introduce a user-facing change?
Yes. vMCP now relays backend log (
notifications/message) and progress (notifications/progress) notifications from Modern (2026-07-28) backends to the downstream client when server→client forwarding is bound — previously these were never emitted (nologLevelopt-in) and dropped (no relay). Behavior for Legacy backends and for unbound deployments is unchanged.Special notes for reviewers
logLevelonly asks the backend to emit; without the relay,readModernSSEdropped every interleaved notification (env.Method != ""). The opt-in without the relay is a silent no-op, so both land together.text/event-streampath; a single JSON 200 body carries no notifications. This is the same inherent limitation as the Legacy standalone-stream design and is documented in themodernCalldoc comment.debugwhen bound: mirrors the documented limitation (docs/arch/10) that downstream level preferences are not yet applied to the relayed stream — vMCP strips the downstream per-hoplogLeveland overlays its own.