Skip to content

feat: make MCP SDK a peer dependency#168

Merged
ochafik merged 3 commits into
mainfrom
ochafik/sdk-peer-dep
Dec 16, 2025
Merged

feat: make MCP SDK a peer dependency#168
ochafik merged 3 commits into
mainfrom
ochafik/sdk-peer-dep

Conversation

@ochafik

@ochafik ochafik commented Dec 16, 2025

Copy link
Copy Markdown
Contributor

Summary

Makes @modelcontextprotocol/sdk a peer dependency instead of a regular dependency.

Changes:

  • Move SDK from dependencies to peerDependencies (^1.20.0)
  • Add SDK to devDependencies for local development (^1.24.3)
  • Externalize SDK from all build entry points (app, app-bridge, react, server)

Benefits:

  • Consumers control their SDK version
  • Deduplication when consumer already has SDK installed
  • Follows same pattern as react/zod peer dependencies
  • Examples already have explicit SDK deps, so they work independently

Testing different SDK versions:

npm install @modelcontextprotocol/sdk@1.20.0  # minimum supported
npm install @modelcontextprotocol/sdk@1.24.3  # latest

🤖 Generated with Claude Code

- Move @modelcontextprotocol/sdk from dependencies to peerDependencies (^1.20.0)
- Add to devDependencies for local development (^1.24.3)
- Externalize SDK from all build entry points (app, app-bridge, react, server)

Benefits:
- Consumers control their SDK version
- Deduplication when consumer already has SDK
- Follows pattern of react/zod peer deps
@pkg-pr-new

pkg-pr-new Bot commented Dec 16, 2025

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/ext-apps@168

commit: 5634b9c

jonathanhefner
jonathanhefner previously approved these changes Dec 16, 2025

@jonathanhefner jonathanhefner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good. How did you determine the minimum (^1.20.0)?

Earlier SDK versions have Zod type incompatibilities that cause build errors.
@ochafik

ochafik commented Dec 16, 2025

Copy link
Copy Markdown
Contributor Author

Good question! I tested earlier versions and found:

  • SDK <1.24.0: Fails with Zod 4 type incompatibilities (the SDK bundles its own Zod, and the types don't align with our Zod 4 peer dep)
  • SDK 1.24.0+: Works correctly

Updated the peer dep to ^1.24.0 to ensure compatibility. The examples already use ^1.22.0 in their own deps, so they'll get upgraded automatically.

jonathanhefner
jonathanhefner previously approved these changes Dec 16, 2025
@ochafik ochafik merged commit d9006bd into main Dec 16, 2025
10 of 17 checks passed
@ochafik ochafik mentioned this pull request Dec 16, 2025
@ochafik ochafik deleted the ochafik/sdk-peer-dep branch January 13, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants