hidorakai002/ai-workspace-archive/docs
- community
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install hidorakai002/ai-workspace-archive/docsSKILL.md
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 toimport/exportor use dynamicimport().
2. Dependencies
Remove the old package and install only what you need:
| 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 | |
|---|---|---|
@modelcontextprotocol/sdk/client/index.js | @modelcontextprotocol/client | |
@modelcontextprotocol/sdk/client/auth.js | @modelcontextprotocol/client | |
@modelcontextprotocol/sdk/client/streamableHttp.js | @modelcontextprotocol/client | |
@modelcontextprotocol/sdk/client/sse.js | @modelcontextprotocol/client | |
@modelcontextprotocol/sdk/client/stdio.js | @modelcontextprotocol/client | |
@modelcontextprotocol/sdk/client/websocket.js | @modelcontextprotocol/client |
Server imports
| v1 import path | v2 package | |
|---|---|---|
@modelcontextprotocol/sdk/server/mcp.js | @modelcontextprotocol/server | |
@modelcontextprotocol/sdk/server/index.js | @modelcontextprotocol/server | |
@modelcontextprotocol/sdk/server/stdio.js | @modelcontextprotocol/server | |
@modelcontextprotocol/sdk/server/streamableHttp.js | @modelcontextprotocol/node (class renamed to NodeStreamableHTTPServerTransport) OR @modelcontextprotocol/server (web-standard WebStandardStreamableHTTPServerTransport for Cloudflare Workers, Deno, etc.) | |
@modelcontextprotocol/sdk/server/sse.js | REMOVED (migrate to Streamable HTTP) | |
@modelcontextprotocol/sdk/server/auth/* | REMOVED (use external auth library) | |
@modelcontextprotocol/sdk/server/middleware.js | @modelcontextprotocol/express (signature changed, see section 8) |
Types / shared imports
| v1 import path | v2 package | |
|---|---|---|
@modelcontextprotocol/sdk/types.js | @modelcontextprotocol/client or @modelcontextprotocol/server | |
@modelcontextprotocol/sdk/shared/protocol.js | @modelcontextprotocol/client or @modelcontextprotocol/server | |
@modelcontextprotocol/sdk/shared/transport.js | @modelcontextprotocol/client or @modelcontextprotocol/server | |
@modelcontextprotocol/sdk/shared/uriTemplate.js | @modelcontextprotocol/client or @modelcontextprotocol/server | |
@modelcontextprotocol/sdk/shared/auth.js | @modelcontextprotocol/client or @modelcontextprotocol/server | |
@modelcontextprotocol/sdk/shared/stdio.js | @modelcontextprotocol/client or @modelcontextprotocol/server |
Notes:
@modelcontextprotocol/clientand@modelcontextprotocol/serverboth re-export shared types from@modelcontextprotocol/core, so import from whichever package you already depend on. Do not import from@modelcontextprotocol/coredirectly — it is an internal package.- When multiple v1 imports map to the same v2 package, consolidate them into a single import statement.
4. Renamed Symbols
| v1 symbol | v2 symbol | v2 package | |
|---|---|---|---|
StreamableHTTPServerTransport | NodeStreamableHTTPServerTransport | @modelcontextprotocol/node |
5. Removed / Renamed Type Aliases and Symbols
| v1 (removed) | v2 (replacement) | |
|---|---|---|
JSONRPCError | JSONRPCErrorResponse | |
JSONRPCErrorSchema | JSONRPCErrorResponseSchema | |
isJSONRPCError | isJSONRPCErrorResponse | |
isJSONRPCResponse | isJSONRPCResultResponse | |
ResourceReference | ResourceTemplateReference | |
ResourceReferenceSchema | ResourceTemplateReferenceSchema | |
IsomorphicHeaders | REMOVED (use Web Standard Headers) | |
AuthInfo (from server/auth/types.js) | AuthInfo (now re-exported by @modelcontextprotocol/client and @modelcontextprotocol/server) | |
McpError | ProtocolError | |
ErrorCode | ProtocolErrorCode | |
ErrorCode.RequestTimeout | SdkErrorCode.RequestTimeout | |
ErrorCode.ConnectionClosed | SdkErrorCode.ConnectionClosed | |
StreamableHTTPError | REMOVED (use SdkError with SdkErrorCode.ClientHttp*) |
All other symbols from @modelcontextprotocol/sdk/types.js retain their original names (e.g., CallToolResultSchema, ListToolsResultSchema, etc.).
Error class changes
Two error classes now exist:
- `ProtocolError` (renamed from
McpError): Protocol errors that cross the wire as JSON-RPC responses - `SdkError` (new): Local SDK errors that never cross the wire
| Error scenario | v1 type | v2 type | |
|---|---|---|---|
| Request timeout | McpError with ErrorCode.RequestTimeout | SdkError with SdkErrorCode.RequestTimeout | |
| Connection closed | McpError with ErrorCode.ConnectionClosed | SdkError with SdkErrorCode.ConnectionClosed | |
| Capability not supported | new Error(...) | SdkError with SdkErrorCode.CapabilityNotSupported | |
| Not connected | new Error('Not connected') | SdkError with SdkErrorCode.NotConnected | |
| Invalid params (server response) | McpError with ErrorCode.InvalidParams | ProtocolError with ProtocolErrorCode.InvalidParams | |
| HTTP transport error | StreamableHTTPError | SdkError with SdkErrorCode.ClientHttp* | |
| Failed to open SSE stream | StreamableHTTPError | SdkError with SdkErrorCode.ClientHttpFailedToOpenStream | |
| 401 after re-auth (circuit break) | StreamableHTTPError | SdkError with SdkErrorCode.ClientHttpAuthentication | |
| 403 after upscoping | StreamableHTTPError | SdkError with SdkErrorCode.ClientHttpForbidden | |
| Unexpected content type | StreamableHTTPError | SdkError with SdkErrorCode.ClientHttpUnexpectedContent | |
| Session termination failed | StreamableHTTPError | SdkError with SdkErrorCode.ClientHttpFailedToTerminateSession |
New SdkErrorCode enum values:
SdkErrorCode.NotConnected='NOT_CONNECTED'SdkErrorCode.AlreadyConnected='ALREADY_CONNECTED'SdkErrorCode.NotInitialized='NOT_INITIALIZED'SdkErrorCode.CapabilityNotSupported='CAPABILITY_NOT_SUPPORTED'SdkErrorCode.RequestTimeout='REQUEST_TIMEOUT'SdkErrorCode.ConnectionClosed='CONNECTION_CLOSED'SdkErrorCode.SendFailed='SEND_FAILED'SdkErrorCode.ClientHttpNotImplemented='CLIENT_HTTP_NOT_IMPLEMENTED'SdkErrorCode.ClientHttpAuthentication='CLIENT_HTTP_AUTHENTICATION'SdkErrorCode.ClientHttpForbidden='CLIENT_HTTP_FORBIDDEN'SdkErrorCode.ClientHttpUnexpectedContent='CLIENT_HTTP_UNEXPECTED_CONTENT'SdkErrorCode.ClientHttpFailedToOpenStream='CLIENT_HTTP_FAILED_TO_OPEN_STREAM'SdkErrorCode.ClientHttpFailedToTerminateSession='CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION'
Update error handling:
Update HTTP transport error handling:
OAuth error consolidation
Individual OAuth error classes replaced with single OAuthError class and OAuthErrorCode enum:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingmcps/frameworks_and_sdks/typescript-sdk/docs/migration-SKILL.md
Popularity
- Repository stars
- 31
- Repository forks
- 11
- 7-day trend score
- 17
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 20 Aug 2026, 2 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/hidorakai002/ai-workspace-archive/docs)