Repository navigation
Conversation
SkillCatalog previously normalized resources/read and resources/directory/read lookup URIs with canonicalUri(uri) (raw new URL(uri).href), while skill resource entries are indexed by skillFileKey(uri). As a result, equivalent spellings such as Q%26A.md vs Q&A.md, lowercase hex escapes like Rembours%c3%a9.md, and raw ^ preserved by new URL() on Node 20/22 (vs %5E on Node 24) missed the catalog lookup and returned -32602. Add catalogUriKey() in catalogSource.ts to parse and reject query/fragment components before delegating path normalization to skillFileKey(), keeping get(uri) on canonicalUri(uri), and add regression coverage in catalog.test.ts plus a patch changeset for @modelcontextprotocol/server.
🦋 Changeset detectedLatest commit: 58e67c4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@modelcontextprotocol/client
@modelcontextprotocol/codemod
@modelcontextprotocol/core
@modelcontextprotocol/server
@modelcontextprotocol/server-legacy
@modelcontextprotocol/express
@modelcontextprotocol/fastify
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
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.
Summary
SkillCatalog(packages/server/src/ext/skills/catalogSource.ts) when handlingresources/readandresources/directory/read.readCheckedandreadDirectorylooked up incoming request URIs viacanonicalUri(uri)(which wrapsnew URL(uri).href), while skill resource entries are normalized withskillFileKey(uri)(packages/core-internal/src/ext/skills/uri.ts).canonicalUridoes not normalize path percent-encoding againstskillFileKey, equivalent valid URIs failed lookup with-32602:references/Q%26A.mdvsreferences/Q&A.mdtemplates/Rembours%c3%a9.md^paths returned bynew URL()on Node 20/22 (references/x^y.md) vs%5Eon Node 24Changes
packages/server/src/ext/skills/catalogSource.ts:catalogUriKey(uri)helper that parses the URI vianew URL(uri), rejects#fragmentor?querycomponents, and delegates path normalization below${url.protocol}//${url.host}toskillFileKey().readCheckedandreadDirectoryto resolve entries usingcatalogUriKey(uri)while keepingget(uri)oncanonicalUri(uri).packages/server/test/ext/skills/catalog.test.ts:resolves equivalent percent-encodings, lowercase hex, and raw carets in resources/read and resources/directory/read..changeset/skills-catalog-uri-key.md:@modelcontextprotocol/server.Verification
Tested on Node
v22.21.0:pnpm --filter @modelcontextprotocol/server run typecheck— passedpnpm --filter @modelcontextprotocol/server exec eslint src/— passedprettier --end-of-line crlf --check .changeset/skills-catalog-uri-key.md packages/server/src/ext/skills/catalogSource.ts packages/server/test/ext/skills/catalog.test.ts— passedpnpm --filter @modelcontextprotocol/server run build— passedpnpm --filter @modelcontextprotocol/server test—57files passed,723 passed | 3 skipped(3 POSIX symlink tests intest/ext/skills/node.test.tsskipped on Windows)pnpm --filter @modelcontextprotocol/test-integration exec vitest run test/skills/—2files passed,51 passed