feat(sdk): @modelcontextprotocol/sdk meta-package with v1 deep-import subpaths#1913
Draft
felixweinberger wants to merge 7 commits intofweinberger/v2-bc-d1-basefrom
Draft
feat(sdk): @modelcontextprotocol/sdk meta-package with v1 deep-import subpaths#1913felixweinberger wants to merge 7 commits intofweinberger/v2-bc-d1-basefrom
felixweinberger wants to merge 7 commits intofweinberger/v2-bc-d1-basefrom
Conversation
🦋 Changeset detectedLatest commit: 677968c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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/server
@modelcontextprotocol/server-auth-legacy
@modelcontextprotocol/express
@modelcontextprotocol/fastify
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
4eeafa1 to
5018344
Compare
33a3b30 to
522e770
Compare
Contributor
Author
|
@claude review |
47a96d5 to
dfc33cc
Compare
9cdd4b2 to
30b3ecd
Compare
9145c02 to
5798b1a
Compare
30b3ecd to
1f1f722
Compare
Contributor
Author
|
@claude review |
1f1f722 to
aa25cbc
Compare
Contributor
Author
|
@claude review |
a84e5bf to
361201e
Compare
361201e to
87d4f17
Compare
Contributor
Author
|
@claude review |
5 tasks
d0bc434 to
a856a3b
Compare
08e958d to
44a1d41
Compare
Contributor
Author
|
@claude review |
44a1d41 to
bf3af27
Compare
bf3af27 to
c673ae7
Compare
Contributor
Author
|
@claude review |
34d1e26 to
2e18a44
Compare
…-import subpaths Adds packages/sdk as the primary v2 entry point. Re-exports the full server + client + node surface from a single root barrel (TS2308-safe named re-exports for client/node) and preserves v1 deep-import subpaths (/types.js, /server/mcp.js, /client/index.js, /shared/transport.js, /shared/protocol.js, /server/auth/errors.js with the 17 OAuth error subclasses, etc.). Folds in the C3/C6 schema-arg shims: the sdk-exported Server and Client are thin subclasses that additionally accept the deprecated v1 calling conventions setRequestHandler(ZodSchema, h), setNotificationHandler( ZodSchema, h) and request(req, ResultSchema, opts), extracting the method literal and forwarding to the v2 string-based API with a one-time deprecation warning.
…root; optional express/hono peers - All five server/auth/* subpaths now re-export from @modelcontextprotocol/server-auth-legacy so OAuth error subclasses share the same OAuthError identity that the legacy router and requireBearerAuth check with instanceof. Previously errors.ts defined local subclasses extending core's OAuthError and bearerAuth.ts re-exported /express, causing instanceof to fail (HTTP 500 instead of 400/401). - Drop @modelcontextprotocol/express dependency (no longer imported). - Forward express and hono as optional peerDependencies so consumers who do not use the auth or hono-adapter subpaths get no unmet-peer warnings. - Add top-level types field for legacy moduleResolution: node. - Revert 87d4f17's stdio re-exports from the root barrel; stdio remains subpath-only to match the underlying client/server packages.
…server/zod-compat subpath
…StartSSEOptions to subpaths
2e18a44 to
55f4068
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.
Part of the v2 backwards-compatibility series — see reviewer guide.
The Layer-2 lever: a meta-package depending on client+server+node+server-auth-legacy that re-exports at v1's ~28 deep-import subpaths (
sdk/types.js,sdk/server/mcp.js, etc.) with extensionless aliases. Permanent primary entry — split packages opt-in for bundle-conscious users.Motivation and Context
The Layer-2 lever: a meta-package depending on client+server+node+server-auth-legacy that re-exports at v1's ~28 deep-import subpaths (
sdk/types.js,sdk/server/mcp.js, etc.) with extensionless aliases. Permanent primary entry — split packages opt-in for bundle-conscious users.v1 vs v2 pattern & evidence
v1 pattern:
v2-native:
Evidence: This is what makes 'bump only' work. Validated: 5 OSS repos at 0 SDK errors with bump-only install.
How Has This Been Tested?
McpServer.tool()+InMemoryTransport+callTool(params, ResultSchema))v2-bc-integrationvalidation branchpnpm typecheck:all && pnpm lint:all && pnpm test:allgreen (sdk 5/5, integration 428/428)Breaking Changes
None — additive
@deprecatedshim. Removed in v3.Types of changes
Checklist
Additional context
Stacks on
fweinberger/v2-bc-d1-base= main + #1891 (A1), #1898 (B4), #1900 (C2), #1901 (C4), #1902 (C5), #1903 (C7), #1904 (C8), #1906 (C10), #1908 (E2), #1909 (E3), #1834 (A4). Re-exports their surface; tests exercise the combined v1 API. As those land onmain, this PR will be retargeted and the diff stays at ~1000 LOC (44 files).typedoc.config.mjs: excludes@modelcontextprotocol/sdkfrom API-doc generation — it's a pure re-export package, and inherited{@link}JSDoc on re-exported symbols can't resolve cross-package module paths (spurious warnings, no doc value added).