The MCP client architecture has been updated to use a backend relay pattern, eliminating CORS issues permanently.
Browser → [MCP SDK Client] → MCP Server (CORS errors!)
Problems:
- ❌ CORS errors with most MCP servers
- ❌ Credentials exposed in browser
- ❌ No persistent connections
Browser → Backend API → [MCP SDK Client] → MCP Server ✅
Benefits:
- ✅ No CORS issues (server-to-server)
- ✅ Better security (credentials on backend)
- ✅ Persistent connections possible
- ✅ Same MCP SDK usage on backend
- Acts as the MCP client
- Runs on port 3002
- Uses MCP SDK directly
- Manages connections to external MCP servers
- HTTP client for browser
- Communicates with backend on localhost:3002
- Clean REST API
- Now acts as relay to backend
- No longer creates SDK clients directly
- Maintains same interface for components
New recommended way:
npm run dev:fullThis starts:
- Backend server on http://localhost:3002
- Frontend on http://localhost:5173
Manual start (if you prefer):
# Terminal 1
npm run backend
# Terminal 2
npm run devFrom the React component perspective, everything works exactly the same:
// Still works the same way
const { connect, disconnect } = useMCPConnection();
const { execute } = useMCPExecution();
// Same usage
await connect(serverConfig);
await execute(serverId, toolName, args);curl http://localhost:3002/healthExpected response:
{
"status": "ok",
"message": "MCP Backend Server is running",
"port": 3002,
"activeConnections": 0
}node test-backend.jsError in UI:
Backend server is not running. Please start it with: npm run backend
Solution:
npm run backendError:
Port 3002 is already in use!
Solution:
lsof -ti:3002 | xargs kill -9
npm run backendCheck:
- Is backend running?
curl http://localhost:3002/health - Is the MCP server URL correct?
- Check backend console for error messages
- Verify authentication configuration
OAuth flow remains unchanged:
- Try to connect → 401 Unauthorized
- Browser redirects to OAuth provider
- User authorizes
- Redirect back with code
- Reconnect with authorization code
- Backend completes OAuth flow
- Connected ✅
The backend handles token storage and refresh transparently.
- Persistent connections to MCP servers
- Reduced latency (no CORS preflight)
- Connection pooling possible
- Better error handling
- Backend uses ~20-30MB memory per server
- Negligible CPU when idle
- Network: same as before (just routed differently)
npm run dev:with-proxy
# Wait for proxy + UI
# Toggle proxy ON in UI
# Connect to serversnpm run dev:full
# Wait for backend + UI
# Connect to serversSimpler and more reliable!
| File | Status | Changes |
|---|---|---|
mcp-backend-server.js |
✅ New | Backend MCP relay server |
src/lib/backendClient.ts |
✅ New | HTTP API client |
src/lib/mcpClient.ts |
🔄 Updated | Now relays to backend |
package.json |
🔄 Updated | Added dev:full script |
| React components | ✅ No changes | Same interface |
| OAuth provider | ✅ No changes | Still used for URLs |
| UI/UX | ✅ No changes | Same experience |
If you need to go back to the old architecture, contact the maintainers for assistance.
- Try connecting to an MCP server
- Test tool execution
- Test OAuth flow (if applicable)
- Enjoy no more CORS errors! 🎉
See:
- BACKEND_ARCHITECTURE.md - Detailed architecture
- README.md - Quick start guide
- AUTHENTICATION.md - OAuth details
✅ Same features
✅ Same UI/UX
✅ Same API
✅ Better reliability
✅ No CORS issues
✅ More secure
The migration is seamless - just start using npm run dev:full and enjoy a better experience!