Why mcp-use Has Its Own MCP Client
The official MCP SDK provides an excellentClient class for connecting to MCP servers. So why does mcp-use include its own MCPClient and BrowserMCPClient?
The answer: multi-server orchestration. Our client is designed for AI agents that need to coordinate across multiple MCP servers simultaneously—GitHub for code, Linear for tasks, and custom APIs for business logic—all in one conversation.
The Official SDK: Single-Server Design
The official SDK’sClient is designed for one server at a time:
mcp-use Client: Multi-Server by Design
Our client provides a unified interface for multiple servers:What mcp-use Adds: The Value Proposition
1. Session Management
Official SDK:- ✅ Transport creation and lifecycle
- ✅ Connection state management
- ✅ Tool/resource/prompt caching
- ✅ Automatic reconnection
- ✅ Cleanup on errors
2. Config File Support
Official SDK:3. Automatic OAuth Integration
The official SDK supports OAuth but requires manual wiring: Official SDK:BrowserOAuthClientProvider implements:
- ✅ Automatic popup-based auth flow
- ✅ Token storage in
localStorage - ✅ Token refresh before expiration
- ✅ Dynamic Client Registration (DCR)
- ✅ Callback handling via
window.postMessage
4. Transport Abstraction and Fallback
Official SDK:5. Capability-Aware Methods
Official SDK:initialize(), our connector caches capabilities and checks them before each method call. This prevents “Method not found” errors when a server doesn’t implement resources/prompts.
6. Tool Caching
Official SDK:7. Unified Error Handling
Official SDK:8. Python API Parity
For teams using both Python and TypeScript, our client provides API consistency: Python:When to Use Each Client
Use Official SDK When:
- ✅ Connecting to one server only
- ✅ Building a simple MCP client app
- ✅ Need minimal bundle size (no abstractions)
- ✅ Direct transport control required
- ✅ Following official examples/tutorials
Use mcp-use Client When:
- ✅ Building AI agents that use multiple MCP servers
- ✅ Need config file driven setup
- ✅ Want automatic OAuth with DCR
- ✅ Prefer session management over manual transport lifecycle
- ✅ Building apps that match the Python mcp-use API
- ✅ Need automatic capability checking
Real-World Example: MCPAgent
Here’s why the multi-server client matters for AI agents:The Architecture: Sessions and Connectors
Official SDK
mcp-use Client
Why Sessions?
A session represents a connection lifecycle to one server:- Isolation: Each server’s state is separate
- Caching: Tools/resources cached per server
- Lifecycle: Clear connect/disconnect
- Error handling: Errors scoped to one server
Inspector: Why We Switched to mcp-use Client
The inspector started with the official SDK but hit limitations:Before (Official SDK)
- ❌ Can’t add second server without major refactoring
- ❌ Manual tool caching
- ❌ Manual capability checking
- ❌ No graceful fallback for unsupported features
After (mcp-use Client)
- ✅ Can add second server by calling
addServer()again - ✅ Automatic tool caching
- ✅ Automatic capability checking
- ✅ Graceful handling of unsupported features
- ✅ Future-proof for multi-server debugging
OAuth: Delegating to the SDK
Both clients support OAuth, but the approach differs:Official SDK: You Implement OAuthClientProvider
mcp-use: BrowserOAuthClientProvider Built-In
- ✅ Dynamic Client Registration (DCR)
- ✅ Popup-based authorization flow
- ✅ Callback via
window.postMessage - ✅ Token storage in
localStorage - ✅ Token refresh before expiration
- ✅ Multiple servers (different tokens per server)
Connector Layer: Transport Independence
Official SDK exposes specific transport classes:- Automatic fallback: User doesn’t care if server uses HTTP or SSE
- Consistent API: All connectors have
.callTool(),.readResource() - Easy switching: Change transport by changing one line
- Future transports: Add WebRTC, WebSocket, etc. without breaking API
Bundle Size Comparison
Official SDK (minimal):mcp-use/browser (no Node.js deps) at ~50KB total.
Migration Path
Already using the official SDK? Migration is straightforward:Single Server (Keep Official SDK)
Multiple Servers (Migrate to mcp-use)
AI Agents (Use mcp-use)
Compatibility: We Don’t Fork the SDK
Important: mcp-use wraps the official SDK, it doesn’t replace it.- ✅ We benefit from SDK updates automatically
- ✅ No compatibility issues
- ✅ Can use official SDK features directly
- ✅ Reduces maintenance burden
Conclusion
The official MCP SDK provides excellent low-level primitives. mcp-use builds on top to provide:- Multi-server management - Essential for AI agents
- Config file support - Python API parity
- Browser OAuth - Ready-to-use authentication
- Transport abstraction - Automatic fallback
- Capability checking - Graceful degradation
- Session lifecycle - Simplified connection management
Learn more: