Skip to content

chore: migrate to the v2 MCP SDK packages #103

Description

@lukecotter

Why

The MCP TypeScript SDK v2 is published, and this server is on v1. Everything that follows the 2026-07-28 revision — MRTR in #93, the caching fields in #94 — needs this swap first, and neither of those issues should own it.

The v2 SDK ships under new package names, which is why the old one looks stale:

@modelcontextprotocol/sdk 1.30.0, still declares LATEST_PROTOCOL_VERSION = '2025-11-25'
@modelcontextprotocol/server 2.0.0, carries 2026-07-28

@modelcontextprotocol/client and @modelcontextprotocol/core are published at 2.0.0 alongside it.

Do

Swap the dependency and move the imports. Nothing else — no behaviour change, no new protocol feature. Those land on top, in #93 and #94.

Five import sites, all of @modelcontextprotocol/sdk:

  • src/server.tssdk/server/mcp.js, sdk/server/stdio.js
  • src/tools/executeAnonymous.tssdk/server/mcp.js
  • src/policy/orgExecutionPolicy.tssdk/server/mcp.js, sdk/client/index.js

McpServer and StdioServerTransport both survive, exported from @modelcontextprotocol/server/stdio, so the stdio entry point keeps its shape.

Try @modelcontextprotocol/codemod first — it ships v1-to-v2 transforms. Read the diff rather than trusting it.

Two things that are already in our favour

  • zod is not a problem. @modelcontextprotocol/server@2.0.0 needs zod ^4.2.0 and we are on 4.4.3.
  • createRequestStateCodec is exported from the package root. feat: carry the execute_anonymous confirmation over multi round-trip requests #93 requires an integrity-protected requestState binding the confirmed Apex source and the org id. The SDK provides the codec, so that requirement does not need hand-rolled crypto.

Acceptance

  • pnpm run build, pnpm test and pnpm run eval all pass with no golden re-recorded. A changed golden means the swap changed a response, which is out of scope for this issue and must be explained before it is accepted.
  • The tools/list definition budget is unmoved, for the same reason.
  • @modelcontextprotocol/sdk is gone from package.json.

Effort

S–M. Its own commit, before #93, so a regression in the migration is not tangled with a change in the authorization flow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    choreNot a feature and not a bug

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions