Repository navigation
fix(resources): forward request context to ui:// resource reads - #141
Merged
Merged
Conversation
The ui:// registration wrapper in src/index.ts called readCallback with
{} instead of the request's extra, so MapPreviewUIResource never saw the
caller's authInfo and always minted from MAPBOX_ACCESS_TOKEN. Register
all resources through BaseResource.installTo() instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jussi-sa
marked this pull request as draft
October 13, 2026 17:24
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ctufts
approved these changes
Oct 16, 2026
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.
What
Register all MCP resources through
BaseResource.installTo()using a newinstallResources()inresourceRegistry.ts. This removes theregisterAppResourcewrapper insrc/index.ts, which calledreadCallback(new URL(uri), {})and dropped the request'sextra.Why
With
{}asextra,MapPreviewUIResourcenever receivedauthInfo.token. It always fell back toMAPBOX_ACCESS_TOKENto mint its preview token, even when a caller token was present.installTo()passesextrathrough unchanged. UI resources already declareRESOURCE_MIME_TYPE, which was the only thing the wrapper added.How to test
npx vitest run test/resources/resourceRegistry.test.ts. The tests read every resource through a client that sendsauthInfo. Two of them fail onmain's wrapper behaviour: theauthInfoforwarding test and the preview-token account test.🤖 Generated with Claude Code