AI Docs
Chat & Streaming
Transports
Structured Outputs
Tools
Chat UI Recipes
Interrupts
MCP
Resumable Streams
Persistence
Persistence (Advanced)
Media
Embeddings
Reranking
Evaluate
Code Mode
Sandboxes
- Overview
- Quick Start
- Providers
- Harnesses
- Harness Auth
- Workspace
- Tools
- Policy
- Lifecycle & Snapshots
- Portable Snapshots
- Keep Files After Reload
- Save a Named Version
- Branch From a Version
- Send a Frozen File
- Let the Agent Save and Fork
- Pick Which Files to Keep
- What a Snapshot Stores
- Instance Durability
- Durable Runs
- Events
Sandboxes (Advanced)
Advanced
AI/LLM: This documentation page is available in plain markdown format at/ai/latest/docs/migration/mcp-sdk.md
Migration
MCP SDK packages
Your app calls createMCPClient. The app still imports @modelcontextprotocol/sdk. That import does not resolve. @tanstack/ai-mcp does not use that package.
- A client app imports @modelcontextprotocol/client.
- A server app imports @modelcontextprotocol/server.
diff
- import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'
- import type { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js'
+ import {
+ StreamableHTTPClientTransport,
+ type OAuthClientProvider,
+ } from '@modelcontextprotocol/client'
- import { Server } from '@modelcontextprotocol/sdk/server/index.js'
+ import { Server } from '@modelcontextprotocol/server'Codemod#
- If the app imports @modelcontextprotocol/sdk, run npx @modelcontextprotocol/codemod@latest v1-to-v2 . from the app root.
- If the app does not import @modelcontextprotocol/sdk, remove that dependency.
shell
npx @modelcontextprotocol/codemod@latest v1-to-v2 .The codemod rewrites imports from @modelcontextprotocol/sdk. The codemod rewrites the package.json dependencies.
This repo does not ship its own codemod.
Protocol#
createMCPClient tries protocol 2026-07-28 first. If the server does not support that protocol, the client uses the 2025 initialize handshake.
Call createMCPClient with the same transport config. The client connects.