-
Notifications
You must be signed in to change notification settings - Fork 331
fix: move MCP SDK to peer dependencies #724
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
base: main
Are you sure you want to change the base?
Conversation
Move `@modelcontextprotocol/sdk` from direct dependencies to peer dependencies, allowing consumers to control their own MCP SDK version. This prevents duplicate package installations when consumers use different MCP SDK versions and ensures type compatibility for consumers who reference MCP types (Tool, Prompt, Resource, ServerCapabilities) from their own code. - `@modelcontextprotocol/sdk`: required peer dep (>=1.0.0) Related to discussion cloudflare#42 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
commit: |
|
@agcty don't merge it just yet, please |
| "x402": "^0.7.3" | ||
| }, | ||
| "peerDependencies": { | ||
| "@modelcontextprotocol/sdk": ">=1.0.0", |
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.
because the mcp sdk does breaking changes in minors right now, I don't think we can actually guarantee this. not a great situation for us to be in unfortunately. we need to think through this.
tagging @mattzcarey for visibility
threepointone
left a comment
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.
blocking this while we figure out what to do here
|
When MCP v2 lands we should be able to do this but for now this is gonna be super tough to support as their are breaking changes in every minor version atm |
Summary
Move
@modelcontextprotocol/sdkfrom direct dependencies to peer dependencies, allowing consumers to control their own MCP SDK version.Problem
Currently,
@modelcontextprotocol/sdkis pinned as a direct dependency ("^1.23.0"). This causes issues for consumers using different MCP SDK versions:Tool,Prompt,Resource,ServerCapabilities) from their own codeMCPServersState,McpAgent.server)Solution
@modelcontextprotocol/sdk: required peer dep (>=1.0.0)Unlike the AI SDK packages where some are optional, MCP is a required peer dependency because:
Agenthasthis.mcpbuilt-in)MCPServersStateandMcpAgentare fundamental exportsMcpAgentabstract class directly exposesMcpServer | ServertypesBreaking Changes
Consumers who don't already have
@modelcontextprotocol/sdkinstalled will need to add it explicitly. However, anyone using MCP features is likely already interacting with MCP types.Related to #42
🤖 Generated with Claude Code