{{ message }}
Repository navigation
Preserve per-request client capability extensions when the session declares its own - #1921
Open
nathangobinet wants to merge 2 commits into
Open
nathangobinet wants to merge 2 commits into
nathangobinet wants to merge 2 commits into
Conversation
…clares its own InjectRequestMeta overlaid the session capabilities onto the request's _meta.clientCapabilities one top-level key at a time, so a session that declares any extension replaced the request's whole "extensions" object and dropped the io.modelcontextprotocol/tasks opt-in added by CallToolAsTaskAsync. Merge JSON objects recursively instead. Fixes modelcontextprotocol#1920 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been 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.

Fixes #1920
Problem
On the 2026-07-28 revision,
McpSessionHandler.InjectRequestMetaoverlays the session capabilities onto the request's_meta.clientCapabilitiesone top-level key at a time. When the session declares any extension, itsextensionsobject replaces the request's. That drops the per-requestio.modelcontextprotocol/tasksopt-in added byCallToolAsTaskAsync, and the server answers synchronously.Change
MergeJsonObject). A key present only on the request survives, and the session's values still win where both sides set the same key.McpClientTaskMethodsTests.CallToolAsTaskAsync_WithSessionLevelExtensions_StillReturnsCreatedTask. It fails without the fix.Testing
dotnet buildsucceeds with 0 warnings.ModelContextProtocol.Tests(net10.0): 2391 passed, 6 skipped.ModelContextProtocol.AspNetCore.Tests(net10.0): 623 passed, 42 skipped.Note
This pull request was AI-generated (Claude Code).