-
Notifications
You must be signed in to change notification settings - Fork 2k
refactor: move the schema source modules into @modelcontextprotocol/core #2477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
felixweinberger
wants to merge
7
commits into
main
Choose a base branch
from
fweinberger/core-schemas-home
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bf993ef
Move the neutral schema modules into @modelcontextprotocol/core
felixweinberger 25ba63b
Update drift guards and the workers test for the schema modules' new …
felixweinberger f906078
Guard the schema-module boundary against skew, drift, and re-inlining
felixweinberger e55dc27
Add changeset for the schema source move
felixweinberger edb1ab0
Serialize on-demand dist builds across parallel test workers
felixweinberger 64c83df
Scale the dist-build timeout ladder to observed build times
felixweinberger 68688c9
Address review: node10 types resolution, docs topology, boundary test…
felixweinberger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| '@modelcontextprotocol/core': minor | ||
| '@modelcontextprotocol/client': minor | ||
| '@modelcontextprotocol/server': minor | ||
| '@modelcontextprotocol/server-legacy': minor | ||
| --- | ||
|
|
||
| Move the schema source modules (spec schemas, OAuth schemas, protocol constants) into `@modelcontextprotocol/core` and resolve them from there as a regular runtime dependency instead of bundling a private copy into each package. An application importing more than one of the packages now evaluates a single shared schema graph with shared object identity. `@modelcontextprotocol/core` gains a `./internal` subpath (SDK-internal contract; may change in any release) and the four packages now version together. |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 A third instance of the stale core-topology claim survives in
docs/migration/upgrade-to-v2.md:1328: it still says@modelcontextprotocol/core"is not required byclient/server— install it only if you import the raw schemas directly", which is false after this PR makes core an exact-pinned runtime dependency. Commit 68688c9 fixed the same sentence inpackages.mdandwire-schemas.mdbut missed this one — reword it to match the corrected "arrives transitively as the shared runtime schema graph" language.Extended reasoning...
What's stale. This PR makes
@modelcontextprotocol/corean exact-pinned runtime dependency ofclient,server, andserver-legacy(eachpackage.jsonnow declares"@modelcontextprotocol/core": "workspace:*"), and the built bundles resolve@modelcontextprotocol/core/internalas a live external import — pinned by the newcoreBoundary.test.ts. The earlier review round flagged two docs asserting the old topology, and commit 68688c9 fixed both (docs/get-started/packages.md:69anddocs/advanced/wire-schemas.md:60now say core "arrives transitively" as the shared runtime schema graph). But a third instance survived:docs/migration/upgrade-to-v2.md:1326-1329still reads "It is runtime-neutral (its only dependency iszod) and is not required byclient/server— install it only if you import the raw schemas directly."\n\nStep-by-step proof that the sentence is false post-merge. (1) A v1 user upgrading per this guide runsnpm install @modelcontextprotocol/client(orserver). (2) npm reads the client'sdependencies, resolves@modelcontextprotocol/coretransitively, and it lands innode_moduleson every install — directly contradicting "not required byclient/server". (3) At runtime the installed client's dist chunks contain liveimport { … } from '@modelcontextprotocol/core/internal'statements, so the dependency is real at module-resolution level, not just in the manifest. A grep overdocs/and package READMEs confirms this is the only surviving occurrence of the old "not required / never depend / never install" framing after 68688c9.\n\nWhy it matters beyond mere staleness. The "install it only if…" framing in the v1→v2 migration guide — the doc most upgrading users actually read — invites users to pin their owncoreversion alongsideclient/server. Becausecore/client/server/server-legacynow release as a changesets fixed group with exact pins, a version-skewed self-pinnedcoreresolved in place of the paired one fails at import time withERR_PACKAGE_PATH_NOT_EXPORTED(the PR description names this failure mode). So the sentence steers readers toward exactly the configuration the fixed group and exact pins were added to prevent.\n\nWhy nothing in the PR catches it. The drift guards added here (coreBoundary.test.ts,schemaShims.test.ts,packageTopologyPins.test.ts) pin build artifacts and manifests, not prose. The doc-topology fix in 68688c9 was scoped to the two files the earlier comment named, and the migration guide was not in the diff.\n\nFix. A one-sentence reword atupgrade-to-v2.md:1328matching the corrected language inpackages.md/wire-schemas.md— e.g.: "It is runtime-neutral (its only dependency iszod).client/serverresolve their shared schema graph from it at runtime, so it already arrives transitively in your tree; add it to your owndependenciesonly when you import the raw schemas directly." The runtime-neutral / zod-only half of the claim remains true and should stay.\n\nSeverity. Nit: doc-only — nothing breaks at runtime if merged as-is, and the "only import it directly if you need raw schemas" advice half remains sound. But it is the same class of stale prose the author already accepted and fixed twice in this PR, so finishing the sweep is cheap and worthwhile.