feat!: migrate to MCP SDK v2 - #579
Conversation
doistbot
left a comment
There was a problem hiding this comment.
This PR migrates the MCP server and transports to the split MCP TypeScript SDK v2 packages, registering tools and prompts with Standard Schema objects, preserving MCP Apps metadata, and adding a regression test requiring JSON Schema 2020-12 on every advertised tool schema.
Few things worth tightening:
- The new
normalizeAppToolMetainmcp-helpers.tsduplicates the_metaresource-URI normalization already present intoken-footprint.test.ts; exporting the production function and reusing it in the test would prevent the two copies from drifting apart.
I also left one optional follow-up note in the details below.
Optional follow-up note (1)
src/mcp-helpers.ts:185:
normalizeAppToolMetare-implements the sameui.resourceUri/ui/resourceUrifill-in logic thatnormalizeAppUiMetainsrc/token-footprint.test.tsalready hand-rolls (that test's comment now points atregisterTool). Two copies of one normalization can drift, which would make the token-footprint measurement over- or under-count. ExportnormalizeAppToolMeta(or move it to a shared util) and have the test reuse it instead of mirroring it.
|
Just so we're aware, switching to the v2 SDK means we are now using the new MCP specification https://blog.modelcontextprotocol.io/posts/2026-07-28/. This is probably fine, but could be worth double checking. It was on my list of things to do to look at the new spec and see what changes (if any) there could be for us with this. |
I checked this more closely. SDK v2 supports the 2026 spec, but this PR does not enable it: we still use I'm now running a few more checks, including a locally-built version of |
|
🎉 This PR is included in version 13.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Warning
This is a breaking change.
Summary
Why
SDK v1 emits explicit draft-07 tool schemas. Some MCP clients reject those schemas because they validate tools as JSON Schema 2020-12. SDK v2 emits 2020-12 schemas natively, so this fixes the compatibility issue without a schema-rewriting workaround.
This is a breaking library change because getMcpServer now returns the v2 McpServer type and the peer dependencies move from @modelcontextprotocol/sdk to @modelcontextprotocol/server and @modelcontextprotocol/node.
Verification