@mcp-use/client v2 is a major rewrite on top of the official MCP TypeScript SDK v2 (@modelcontextprotocol/client). This page lists every breaking change and the replacement.
Upgrade
- Node.js 20+
- ESM only — no CommonJS build for
@mcp-use/client - Bundlers must respect the package
"node"/"browser"export conditions
mcp-use package, import them from the dedicated packages below.
Package split
v2 splits the old monolithicmcp-use client/agent surface into focused packages:
Removed subpaths
These@mcp-use/client subpaths no longer exist:
The root export picks Node (HTTP + stdio) or browser (HTTP-only) automatically.
Connection API
Prefer connect() over createSession()
createSession() and createAllSessions() still work but are legacy aliases. Same for connectAll() vs createAllSessions().
MCPConnection replaces MCPSession
MCPSession is a deprecated type alias for MCPConnection.
Protocol negotiation is automatic
HTTP connections default toversionNegotiation: "auto". The client probes v2 (server/discover) and falls back to v1 (initialize) when needed. You no longer pick a protocol version manually.
Inspect the result on any connection or useMcp return value:
Renamed config fields
Callbacks can be set globally on
MCPClientOptions or per-server in mcpServers.
OAuth
Auto-provisioned by default
HTTP servers withoutauthToken, Authorization header, or authProvider now get OAuth automatically on connect():
Import paths for browser OAuth
These are not re-exported from the Node root entry (they pull in browser/localStorage code):
Node OAuth helpers stay on
@mcp-use/client: createOAuthProvider, NodeOAuthClientProvider, completeOAuthFlow, isUnauthorized, FileKVStore.
React: explicit auth by default
useMcp and McpClientProvider no longer auto-open OAuth popups. When auth is required, state becomes pending_auth until you call authenticate():
preventAutoAuth: false to restore the old auto-popup behavior.
Proxy identity
MCP and OAuth traffic use separate proxy URLs. The upstream MCP URL stays the SDK resource identity — proxies no longer rewrite metadata or OAuth resource URLs.React changes
useMcp reaches ready only after normalized metadata (tools, capabilities, protocol info) is loaded.
MCP Apps capability: pass clientOptions: { capabilities: { views: true } } instead of hand-writing extension capabilities.
Removed exports
SDK dependency
The client now depends on@modelcontextprotocol/client instead of @modelcontextprotocol/sdk. Error types and low-level types come from the new package:
@mcp-use/agent no longer bundles the v1 SDK.
Agent & CLI
Agent — import from@mcp-use/agent:
dist/index.js). npx mcp-use is unaffected.
Inspector
The Inspector OAuth BFF was hardened (SSRF/private-target blocking, body/time limits, CORS allowlist). If you run a custom OAuth proxy, bind targets to SDK-discovered metadata — arbitrary upstream URLs are rejected. Default OAuth callback in the Inspector:/inspector/oauth/callback (not /oauth/callback).
Migration checklist
1
Update packages
Install
@mcp-use/client@^2 and @mcp-use/agent@^2. Keep mcp-use for server code.2
Fix imports
Replace
mcp-use client/agent imports. Replace removed subpaths. Move widget connection code off mcp-use/react if it used useMcp.3
Rename config fields
Search for deprecated aliases (
samplingCallback, auth_token, clientConfig, …).4
Switch to connect()
Replace
createSession with connect. Use MCPConnection typing instead of MCPSession.5
Update React OAuth UI
Handle
pending_auth explicitly. Import onMcpAuthorization from @mcp-use/client/react.6
Rename display labels
Use
displayName in addServer config; read negotiated name from serverInfo.name.7
Verify ESM
Ensure
"type": "module" or bundler ESM output. No require("@mcp-use/client").What did not break
- Server APIs (
MCPServer, tools, resources, prompts, widgets) - MCP Apps widget runtime (
mcp-use/react) - Config file shape (
mcpServersmap) — field renames only - Code mode (
codeMode: true,executeCode,searchTools) — same concept, Node-only - Elicitation helpers (
acceptWithDefaults,validate, …) on@mcp-use/client