Repository navigation
Conversation
## Motivation and Context Two checks identify the target of a request by `params.name`, falling back to `params.uri`, whatever the method. A `resources/read` is named by its `uri` and has no `name` member, so a client that added one replaced the URI in both: - The `Mcp-Name` header of a modern request was compared with the added `name`. A request could carry a header naming one resource and read another, although the header exists so that an intermediary can route or filter on it without reading the body. - A sealed `requestState` was bound to the added `name` in place of the URI. With the same `name` on both requests, a state issued for one resource was accepted on a retry for another, although `RequestStateSecurity` documents the state as bound to the resource URI. The member is now fixed per method: `uri` for `resources/read`, `name` for `tools/call` and `prompts/get`. `MCP::Client::HTTP` builds the `Mcp-Name` header of a `resources/read` from the `uri` in the same way, so the client and the server agree. ## How Has This Been Tested? `test/mcp/server_test.rb`, `test/mcp/server/transports/streamable_http_transport_test.rb` and `test/mcp/client/http_test.rb`. Against the previous library the state follows the added `name` across resources, and the header that names the read URI is refused as a mismatch. ## Breaking Changes None for a client that sends `resources/read` as specified. One that added a `name` to it has `Mcp-Name` checked against the `uri`, and a state sealed for such a request before this change keeps the binding it was sealed with until its TTL runs out.
koic
force-pushed
the
name_a_resources_read_request_by_its_uri_alone
branch
from
November 27, 2026 02:25
e627204 to
8c5ad4f
Compare
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.
Motivation and Context
Two checks identify the target of a request by
params.name, falling back toparams.uri, whatever the method. Aresources/readis named by itsuriand has nonamemember, so a client that added one replaced the URI in both:Mcp-Nameheader of a modern request was compared with the addedname. A request could carry a header naming one resource and read another, although the header exists so that an intermediary can route or filter on it without reading the body.requestStatewas bound to the addednamein place of the URI. With the samenameon both requests, a state issued for one resource was accepted on a retry for another, althoughRequestStateSecuritydocuments the state as bound to the resource URI.The member is now fixed per method:
uriforresources/read,namefortools/callandprompts/get.MCP::Client::HTTPbuilds theMcp-Nameheader of aresources/readfrom theuriin the same way, so the client and the server agree.How Has This Been Tested?
test/mcp/server_test.rb,test/mcp/server/transports/streamable_http_transport_test.rbandtest/mcp/client/http_test.rb. Against the previous library the state follows the addednameacross resources, and the header that names the read URI is refused as a mismatch.Breaking Changes
None for a client that sends
resources/readas specified. One that added anameto it hasMcp-Namechecked against theuri, and a state sealed for such a request before this change keeps the binding it was sealed with until its TTL runs out.Types of changes
Checklist