@tanstack/ai-mcp imports the MCP v2 packages. An import from @modelcontextprotocol/sdk does not resolve.
If your app imports @modelcontextprotocol/sdk, run the MCP codemod from the app root:
npx @modelcontextprotocol/codemod@latest v1-to-v2 .The codemod rewrites the imports from @modelcontextprotocol/sdk. It also rewrites the dependencies in package.json.
If your app does not import @modelcontextprotocol/sdk, remove that dependency.
The codemod comes from the MCP project. TanStack AI does not ship its own codemod for this change.
This is what the codemod does to your imports:
- 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'You do not change your createMCPClient call. Keep the same transport configuration.
createMCPClient tries protocol 2026-07-28 first. If the server does not support that protocol, the client uses the 2025 initialize handshake.
Your 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.