← ClaudeAtlas

migrate-v1-to-v2listed

Migrate MCP TypeScript SDK code from v1 (@modelcontextprotocol/sdk) to v2 (@modelcontextprotocol/core, /client, /server). Use when a user asks to migrate, upgrade, or port their MCP TypeScript code from v1 to v2.
NickCollect/ai-coding-runbook · ★ 6 · AI & Automation · score 78
Install: claude install-skill NickCollect/ai-coding-runbook
# MCP TypeScript SDK: v1 → v2 Migration Apply these changes in order: dependencies → imports → API calls → type aliases. ## 1. Environment - Node.js 20+ required (v18 dropped) - ESM only (CJS dropped). If the project uses `require()`, convert to `import`/`export` or use dynamic `import()`. ## 2. Dependencies Remove the old package and install only what you need: ```bash npm uninstall @modelcontextprotocol/sdk ``` | You need | Install | | --------------------- | ------------------------------------------------------------------------ | | Client only | `npm install @modelcontextprotocol/client` | | Server only | `npm install @modelcontextprotocol/server` | | Server + Node.js HTTP | `npm install @modelcontextprotocol/server @modelcontextprotocol/node` | | Server + Express | `npm install @modelcontextprotocol/server @modelcontextprotocol/express` | | Server + Hono | `npm install @modelcontextprotocol/server @modelcontextprotocol/hono` | `@modelcontextprotocol/core` is installed automatically as a dependency. ## 3. Import Mapping Replace all `@modelcontextprotocol/sdk/...` imports using this table. ### Client imports | v1 import path | v2 package | | -----------------------------------------