Repository navigation
Pass the access token to a handler the legacy input_required shim re-runs - #696
Open
koic wants to merge 1 commit into
Conversation
…e-runs ## Motivation and Context When a handler on the handshake lifecycle returns `input_required`, the legacy shim sends the embedded requests to the client and runs the handler again with the answers. The re-run was dispatched without the access token of the request, so `server_context.auth_info` was `nil` on every round after the first: a tool that calls `server_context.require_scopes!` was answered `insufficient_scope` after the user had replied, and a handler that reads the caller's identity lost it. `tools/call`, `prompts/get` and `resources/read` were all affected. Every round belongs to the one authenticated request, so the shim now threads `auth_info` through to the re-run. ## How Has This Been Tested? `test/mcp/server_input_required_legacy_shim_test.rb`; both new tests fail on the previous library, where the second run sees no token. ## Breaking Changes None.
7 of 9 tasks
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.
Motivation and Context
When a handler on the handshake lifecycle returns
input_required, the legacy shim sends the embedded requests to the client and runs the handler again with the answers. The re-run was dispatched without the access token of the request, soserver_context.auth_infowasnilon every round after the first: a tool that callsserver_context.require_scopes!was answeredinsufficient_scopeafter the user had replied, and a handler that reads the caller's identity lost it.tools/call,prompts/getandresources/readwere all affected.Every round belongs to the one authenticated request, so the shim now threads
auth_infothrough to the re-run.How Has This Been Tested?
test/mcp/server_input_required_legacy_shim_test.rb; both new tests fail on the previous library, where the second run sees no token.Breaking Changes
None.
Types of changes
Checklist