Persistence (Advanced)
- Build your first harness
- Host options
- Send and show media
- Connect clients
- Write a client in any language
- Access and tenants
- Run in the terminal
- Deploy a harness
- Send inputs safely
- Run a tool without a model
- Durable sessions
- Run background work on workers
- List, rename, and fork sessions
- Lifecycle and retention
- Run side effects once
- Wait for a person
- Build on the session log
- Control how a turn ends
- Store settings per thread
- Compact a long session
- Fork and reset a thread
- One log for a session tree
- Write a plugin
- Track usage and cost
- Ask before risky tool calls
- Give your agent coding tools
- Sandbox and extend the coding tools
- Run the coding tools for many threads
- Undo a turn
- Build a coding agent
- Delegate to coding agents
- Switch between agent profiles
- Auth and connectors
- Share a thread between people
- Connect model providers
- Build your own UI
- Code mode in a harness
- Work until a goal is met
- Run agents from a harness
- Hand off a conversation
- Add skills
- Use MCP servers
- Give your agent a computer
- Use from any MCP client
- Use a harness from an editor (ACP)
- 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)
- Runtime Context
- Bring Your Own Key
- Keep Keys on the Server
- Debug Logging
- Multimodal Content
- Files API
- Per-Model Type Safety
- Runtime Adapter Switching
- Tree-Shaking
- Extend Adapter
- Extend Adapter: Advanced
- Typed Pre-Configured Options
- Test with a Fake Model
- Prompt Caching
- Mid-Conversation Changes
- Approval Flow Processing
MCP SDK packages
@tanstack/ai-mcp imports the MCP v2 packages. An import from @modelcontextprotocol/sdk does not resolve.
- A client app imports @modelcontextprotocol/client.
- A server app imports @modelcontextprotocol/server.
Upgrade#
If your app imports @modelcontextprotocol/sdk, run the MCP codemod from the app root:
shellnpx @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'Protocol version#
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.
Done#
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.