Skip to content

feat!: move to MCP TypeScript SDK v2 - #46

Merged
mattpodwysocki merged 5 commits into
mainfrom
feat/mcp-sdk-v2
Oct 26, 2026
Merged

mattpodwysocki merged 5 commits into
mainfrom
feat/mcp-sdk-v2

Conversation

@mattpodwysocki

Copy link
Copy Markdown
Contributor

Part of mapbox/mcp-server#245, same move as mapbox/mcp-server#296.

Moves us from @modelcontextprotocol/sdk 1.x to the v2 SDK package (@modelcontextprotocol/server 2.3.1).

What changed

Mostly the official codemod (npx @modelcontextprotocol/codemod v1-to-v2 .). This repo had no SDK patch and no tool output schemas, so v2's stricter output validation doesn't apply here. Beyond that:

  • @modelcontextprotocol/client is a dev dependency (tests and scripts/test-resources.ts).
  • The existing tool tests call run() directly and never touch the SDK, so there's a new test/sdkRegistration.test.ts that installs every tool and resource on a real v2 McpServer and checks tools/list, a tools/call, resources/list and resources/read.
  • Fixed the test type errors in SearchDocsTool.test.ts; tsconfig.test.json is now clean.

Clients

Nothing changes. It still negotiates 2025-11-25.

Heads up

  • Hosted has to move in the same release (mapbox/hosted-mcp-server, draft PR coming). installTo(server) needs a v2 McpServer, so hosted pins v2 releases of all three server packages together.
  • If a tool ever adds an output schema, port mcp-server's lenientOutputSchema, or v2 will fail calls on any mismatch.
  • Unrelated, already on main: the CommonJS build throws on require (import.meta in src/utils/versionUtils.ts). Hosted uses ESM so it isn't affected. Left for a separate fix.

Testing

  • npm test: 9 files, 88 tests passing (3 new)
  • Lint and spellcheck clean; tsconfig.src.json and tsconfig.test.json both 0 errors; build passes
  • stdio smoke test: handshake (2025-11-25), 3 tools with 2020-12 schemas, 10 resources, live search_mapbox_docs_tool and get_document_tool calls, clean stderr
  • Checked inside hosted-mcp-server against local v2 builds of all three servers: 153 tests passing

🤖 Generated with Claude Code

Swaps @modelcontextprotocol/sdk 1.x for @modelcontextprotocol/server 2.3.1
(and @modelcontextprotocol/client as a dev dependency for the scripts and
tests), same as mapbox/mcp-server#296. The v1-to-v2 codemod did the
imports and context types. No tool has an output schema, so v2's strict
output validation doesn't apply.

Adds a test that installs every tool and resource on a real v2 McpServer,
since the tool tests call run() directly and never touch the SDK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattpodwysocki
mattpodwysocki requested a review from a team as a code owner October 21, 2026 19:33
@mattpodwysocki mattpodwysocki added the enhancement New feature or request label Oct 21, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mattpodwysocki and others added 3 commits October 23, 2026 10:18
Adds npm run typecheck (tsc over src and test) as a CI step, fixes the
one error it found, and sets noEmit in tsconfig.test.json so tsc can't
write .js files next to the sources.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattpodwysocki
mattpodwysocki merged commit 27fb899 into main Oct 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants