feat: Add comprehensive multi-server support to MCP Inspector
Multi-Server Support for MCP Inspector
Overview
This pull request introduces comprehensive multi-server support to the MCP Inspector, transforming it from a single-server debugging tool into a powerful multi-server management platform. This enhancement addresses the growing need for developers to work with multiple MCP servers simultaneously while maintaining full backward compatibility with existing workflows.
Problem Statement
The original MCP Inspector was designed to work with a single MCP server at a time, which created several limitations for developers:
- Context Switching Overhead: Developers working with multiple MCP servers had to manually reconfigure and restart the inspector for each server, breaking their workflow
- No Comparative Analysis: Unable to compare capabilities, resources, or tools across different servers in a unified interface
- Limited Scalability: As MCP ecosystems grow, developers need to manage increasingly complex server configurations
- Isolated Debugging: Each server had to be debugged in isolation, making it difficult to understand interactions between servers
- Configuration Management: No centralized way to manage multiple server configurations and their connection states
Solution Overview
We implemented a comprehensive multi-server architecture that extends the MCP Inspector with:
🏗️ Server-Side Architecture
- Multi-Server API: RESTful endpoints for server management, connection control, and MCP request proxying
- Real-Time Event Streaming: Server-Sent Events for live status updates and notifications across all servers
- Connection Management: Independent connection lifecycle management for each server
- Centralized Logging: Synchronized logging level management across all connected servers
- Transport Flexibility: Support for both STDIO and HTTP transport types in multi-server configurations
🎨 Client-Side Interface
- Unified Dashboard: Tabbed interface for managing multiple servers with real-time status monitoring
- Server Management: Complete CRUD operations for server configurations with validation
- Error Aggregation: Sophisticated error handling with console error interception and deduplication
- State Persistence: LocalStorage-based configuration management with cache invalidation
- Mode Switching: Seamless toggle between single-server and multi-server modes
Technical Implementation
Backend Implementation (server/src/multiserver/)
The server-side implementation follows a modular architecture:
server/src/multiserver/
├── models/ # Type definitions and data models
├── services/ # Business logic services
├── utils/ # Utility functions and helpers
├── middleware/ # Express middleware
├── routes/ # REST API endpoints
└── __tests__/ # Comprehensive test suite
Key Components:
- ServerManager: Handles CRUD operations for server configurations with Zod validation
- ConnectionManager: Manages connection lifecycle, status tracking, and transport creation
- EventStreamService: Provides real-time updates via Server-Sent Events
- MCP Proxy: Unified API for communicating with individual servers without direct client connections
For detailed technical documentation, see server/src/multiserver/README.md.
Frontend Implementation (client/src/components/multiserver/)
The client-side implementation provides a rich, interactive interface:
client/src/components/multiserver/
├── hooks/ # Custom React hooks for state management
├── services/ # API communication layer
├── stores/ # Centralized data stores
├── types/ # TypeScript definitions
├── utils/ # Utility functions and helpers
└── [React Components] # UI components
Key Features:
- useMultiServer Hook: 600+ lines of comprehensive state management with real-time updates
- Error Management: Sophisticated error aggregation with console interception
- Request Optimization: Deduplication and batching for improved performance
- History Management: Centralized notification and interaction tracking
For detailed technical documentation, see client/src/components/multiserver/README.md.
Visual Demonstration
Dashboard Overview
The multi-server dashboard provides a comprehensive view of all configured servers:
Server Management
Users can easily add new servers with support for both STDIO and HTTP transports:
Multi-Server Operations
The interface supports managing multiple servers simultaneously:
Server Interaction
Each server provides dedicated tabs for resources, tools, and prompts:
Monitoring and Error Handling
Comprehensive monitoring and error tracking across all servers:
Configuration Management
Easy server configuration editing with validation:
Key Features
🔄 Real-Time Updates
- Server-Sent Events provide instant feedback on connection changes
- Live error tracking and notification streaming
- Automatic status synchronization across all servers
🛠️ Server Management
- Create, read, update, and delete server configurations
- Support for STDIO and HTTP transport types
- Configuration validation with detailed error messages
🔌 Connection Control
- Independent connection management for each server
- Bulk operations (connect all, disconnect all)
- Connection status tracking with health indicators
📊 Monitoring & Debugging
- Error aggregation with console error interception
- Centralized logging level management
- Request/response history tracking
- Performance metrics and statistics
💾 State Persistence
- LocalStorage-based configuration management
- Cache invalidation for data consistency
- State merging for API synchronization
🔒 Security & Reliability
- Authentication middleware with timing-safe token comparison
- Input validation using Zod schemas
- Comprehensive error handling and recovery
- Resource cleanup on shutdown
Backward Compatibility
Full backward compatibility maintained:
- Existing single-server endpoints remain unchanged
- No breaking changes to API contracts
- Existing client code continues working without modification
- Seamless mode switching between single and multi-server modes
API Reference
Core Endpoints
Server Management (/api/servers)
GET /api/servers- List all serversPOST /api/servers- Create serverGET /api/servers/:id- Get server by IDPUT /api/servers/:id- Update serverDELETE /api/servers/:id- Delete server
Connection Management (/api/connections)
GET /api/connections- Get all connection statusesPOST /api/connections/:id/connect- Connect to serverPOST /api/connections/:id/disconnect- Disconnect from server
MCP Proxy (/api/mcp)
POST /api/mcp/:id/request- Generic MCP requestGET /api/mcp/:id/resources- List resourcesGET /api/mcp/:id/tools- List toolsGET /api/mcp/:id/prompts- List prompts
Event Streaming (/api/events)
GET /api/events- Subscribe to real-time event stream
Testing
Comprehensive Test Coverage
- Server-Side: 40+ unit tests covering all services and utilities
- Client-Side: Component tests and integration tests
- HTTP API Testing: Complete endpoint testing with
.httpfiles - Error Handling: Edge case and failure scenario testing
Test Categories
- ServerManager: CRUD operations, validation, error handling
- ConnectionManager: Lifecycle management, status tracking, errors
- LoggingLevelManager: Synchronization and cleanup
- UI Components: User interactions and state management
Usage
Getting Started
- Start the MCP Inspector:
npx @modelcontextprotocol/inspector - Open the web interface at
http://localhost:6274 - Use the mode toggle in the sidebar to switch to "Multi Server" mode
- Add your first server using the "Add Server" button
Example Server Configuration
STDIO Server:
{
"name": "File System Server",
"description": "Local file system access",
"transportType": "stdio",
"config": {
"command": "npx",
"args": ["@modelcontextprotocol/server-filesystem", "/path/to/directory"],
"env": {"DEBUG": "true"}
}
}
HTTP Server:
{
"name": "Remote API Server",
"description": "Remote MCP server via HTTP",
"transportType": "streamable-http",
"config": {
"url": "https://api.example.com/mcp"
}
}
Impact
This multi-server implementation transforms the MCP Inspector from a single-server debugging tool into a comprehensive multi-server management platform, enabling:
- Enhanced Developer Productivity: Manage multiple servers from a single interface
- Improved Debugging Capabilities: Compare and analyze multiple servers simultaneously
- Scalable Architecture: Support for growing MCP ecosystems
- Better Error Tracking: Centralized error aggregation and monitoring
- Streamlined Workflows: Reduced context switching and configuration overhead
Future Enhancements
The multi-server architecture provides a foundation for future enhancements:
- Server-to-server communication patterns
- Advanced monitoring and analytics
- Configuration templates and presets
- Export/import functionality for server configurations
- Integration with CI/CD pipelines
This implementation represents a significant evolution of the MCP Inspector, maintaining its core debugging capabilities while adding powerful multi-server management features that scale with the growing MCP ecosystem.
This PR is submitted by Elad Ariel on behalf of the SAP AI Guild (IL).
@EladAriel This is awesome work on the inspector. I agree that multi-server connections is absolutely needed and I wished they had that in the inspector very early on. To be honest, it's going to be hard / nearly impossible to get a 95 file PR approved for an open source project of this scale.
I maintain the MCPJam inspector, it's an alternative to the mcp inspector and has support for multiple server connections. This might suit your needs.
Hi @EladAriel, thanks for your work on this! Although multi server support is something that we've talked about before, right now we're more motivated towards stabilizing existing core features like Oauth testing, CLI mode, etc. for the existing flows rather than adding additional complex features. I'll keep this open for now in case other maintainers want to weigh in on prioritizing this though.
Hi @EladAriel, thanks for your work on this! Although multi server support is something that we've talked about before, right now we're more motivated towards stabilizing existing core features like Oauth testing, CLI mode, etc. for the existing flows rather than adding additional complex features. I'll keep this open for now in case other maintainers want to weigh in on prioritizing this though.
I know it's a huge PR and there's a lot of conflicts to resolve, but it would be amazing to have this support. Not just multiple servers but showing the features supported by the connected server. I don't know about the API but the multiple server connections looks good. We have since implemented an mcp.json configuration file that seems compatible. Any interest in revisiting this?
@EladAriel Is there a world where we have a slimmed down version of this?
Hi @EladAriel, thanks for your work on this! Although multi server support is something that we've talked about before, right now we're more motivated towards stabilizing existing core features like Oauth testing, CLI mode, etc. for the existing flows rather than adding additional complex features. I'll keep this open for now in case other maintainers want to weigh in on prioritizing this though.
I know it's a huge PR and there's a lot of conflicts to resolve, but it would be amazing to have this support. Not just multiple servers but showing the features supported by the connected server. I don't know about the API but the multiple server connections looks good. We have since implemented an mcp.json configuration file that seems compatible. Any interest in revisiting this?
@EladAriel Is there a world where we have a slimmed down version of this?
@cliffhall Hi, yes, but I need to know exactly what features are required.
Hi, yes, but I need to know exactly what features are required.
Of course, and it is a lot. I'm not certain we'd want a separate server with API endpoints for each server, etc. I was thinking more about containing it entirely in the client, managing a map of clients connected to servers and having a screen that shows the info about each connected server.
Hi, yes, but I need to know exactly what features are required.
Of course, and it is a lot. I'm not certain we'd want a separate server with API endpoints for each server, etc. I was thinking more about containing it entirely in the client, managing a map of clients connected to servers and having a screen that shows the info about each connected server.
Please see: https://github.com/modelcontextprotocol/inspector/pull/890