Open History to see the last commit
1---
2title: MCP SDK packages
3id: mcp-sdk
4order: 7
5description: "Move a createMCPClient app from @modelcontextprotocol/sdk to @modelcontextprotocol/client or @modelcontextprotocol/server."
6keywords:
7 - tanstack ai
8 - mcp
9 - migration
10 - createMCPClient
11 - model context protocol
12---
13
14`@tanstack/ai-mcp` imports the MCP v2 packages. An import from `@modelcontextprotocol/sdk` does not resolve.
15
16- A client app imports `@modelcontextprotocol/client`.
17- A server app imports `@modelcontextprotocol/server`.
18
19## Upgrade
20
211. If your app imports `@modelcontextprotocol/sdk`, run the MCP codemod from the app root:
22
23 ```bash
24 npx @modelcontextprotocol/codemod@latest v1-to-v2 .
25 ```
26
27 The codemod rewrites the imports from `@modelcontextprotocol/sdk`. It also rewrites the dependencies in `package.json`.
28
292. If your app does not import `@modelcontextprotocol/sdk`, remove that dependency.
30
31The codemod comes from the MCP project. TanStack AI does not ship its own codemod for this change.
32
33This is what the codemod does to your imports:
34
35```diff
36- import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'
37- import type { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js'
38+ import {
39+ StreamableHTTPClientTransport,
40+ type OAuthClientProvider,
41+ } from '@modelcontextprotocol/client'
42
43- import { Server } from '@modelcontextprotocol/sdk/server/index.js'
44+ import { Server } from '@modelcontextprotocol/server'
45```
46
47## Protocol version
48
49You do not change your `createMCPClient` call. Keep the same transport configuration.
50
51`createMCPClient` tries protocol `2026-07-28` first. If the server does not support that protocol, the client uses the 2025 initialize handshake.
52
53## Done
54
55Your app has no `@modelcontextprotocol/sdk` import, and `createMCPClient` connects to your server with the same transport configuration. For the full MCP setup, see [MCP Server Tools](../tools/mcp).