Skip to content

Migrate to MCP TypeScript SDK v2 packages - #339

Open
Kayaba-Attribution wants to merge 1 commit into
makenotion:mainfrom
Kayaba-Attribution:v2-trial
Open

Migrate to MCP TypeScript SDK v2 packages#339
Kayaba-Attribution wants to merge 1 commit into
makenotion:mainfrom
Kayaba-Attribution:v2-trial

Conversation

@Kayaba-Attribution

Copy link
Copy Markdown

Description

The MCP TypeScript SDK split the monolithic @modelcontextprotocol/sdk into scoped packages at 2.0.0 (@modelcontextprotocol/server, client, core, node, hono, fastify). The 1.x line is frozen at 1.30.0 on npm. This PR moves the server onto the v2 packages.

I generated it with the SDK's own codemod (npx @modelcontextprotocol/codemod@latest v1-to-v2 .), which reported no unresolvable sites for this repo, then hand-adjusted the touched import lines to match the repo's style (single quotes, no semicolons). Deliberately did not run a formatter across the files, since there is no prettier/eslint config here and doing so rewrote ~2,000 lines of unrelated formatting; the source diff is 27 lines across 4 files instead.

Changes:

  • @modelcontextprotocol/sdk -> @modelcontextprotocol/server + @modelcontextprotocol/node
  • StreamableHTTPServerTransport -> NodeStreamableHTTPServerTransport
  • JSONRPCResponse -> JSONRPCResultResponse
  • setRequestHandler(ListToolsRequestSchema, …) / (CallToolRequestSchema, …) now take the method string ('tools/list', 'tools/call'), so those schema imports are dropped
  • zod -> ^4.2.0, which the v2 packages require (>= 4.2.0). This repo references zod in a single commented-out line in openapi/parser.ts, so nothing else is affected by the major bump.

The package-lock.json shrinks substantially because v1's monolithic SDK pulled in express/cors and the OAuth-server pieces that the split packages no longer include.

Scope: this does not adopt protocol revision 2026-07-28

Worth being explicit, since the SDK version bump and the new protocol revision landed together but are separate migrations. Per the SDK's migration guide, "nothing in v2 puts a 2026-07-28 byte on the wire by default" — serving the new revision is an explicit opt-in via createMcpHandler. So the existing sessionful Streamable HTTP setup in scripts/start-server.ts (the mcp-session-id map and sessionIdGenerator) keeps working exactly as it does today, and no client behaviour changes. Adopting the new revision would be a separate, larger change and I have not attempted it here.

How was this change tested?

  • Automated test (unit, integration, etc.)

Ran the full CI sequence from .github/workflows/ci.yml locally:

  • npm ci — exit 0 (lockfile in sync)
  • npm run build — exit 0
  • npm test109 passed across 12 test files, no failures

Not manually exercised against a live Notion workspace, so a smoke test of the stdio and Streamable HTTP entry points against real credentials is worth doing before merge.

Screenshots

n/a

The monolithic `@modelcontextprotocol/sdk` was split into scoped packages at
2.0.0 (`@modelcontextprotocol/server`, `client`, `core`, `node`, ...), and the
1.x line is frozen at 1.30.0. This moves the server onto the v2 packages.

Generated with the SDK's official codemod (`npx
@modelcontextprotocol/codemod@latest v1-to-v2 .`), which reported no
unresolvable sites, then hand-adjusted to match the repo's import style
(single quotes, no semicolons) rather than reformatting whole files.

- `@modelcontextprotocol/sdk` -> `@modelcontextprotocol/server` +
  `@modelcontextprotocol/node`
- `StreamableHTTPServerTransport` -> `NodeStreamableHTTPServerTransport`
- `JSONRPCResponse` -> `JSONRPCResultResponse`
- `setRequestHandler(ListToolsRequestSchema, ...)` and
  `setRequestHandler(CallToolRequestSchema, ...)` now take the method string
  (`'tools/list'`, `'tools/call'`), so the schema imports are no longer needed
- zod moved to `^4.2.0`, which the v2 packages require (>= 4.2.0). This repo
  references zod in one commented-out line, so nothing else changes

This is an SDK-package migration only; it does not adopt protocol revision
2026-07-28. Per the SDK's migration guide, v2 keeps speaking the 2025-era
protocol unless a server explicitly opts in via `createMcpHandler`, so the
existing sessionful Streamable HTTP setup in `scripts/start-server.ts`
continues to work unchanged.
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.

1 participant