A centralized MCP (Model Context Protocol) gateway with robust timeout, retry, and circuit breaker handling.
- Aggregate multiple MCP servers under a single endpoint
- Timeout watchdog with configurable deadlines
- Exponential backoff retry with jitter
- Circuit breaker pattern (Open/Closed/Half-Open states)
- Structured JSON logging with Winston
- Global availability across all projects
- Fully configurable (timeout, retry, circuit breaker settings)
cd Common_MCP
npm install
npm run build
npm install -g .The gateway automatically creates the configuration directory:
- Windows:
C:\Users\[username]\.common-mcp\ - Config file:
C:\Users\[username]\.common-mcp\config.json
The config file is automatically created on first run with default settings. You can also:
mkdir C:\Users\%USERNAME%\.common-mcp
copy config\default.json C:\Users\%USERNAME%\.common-mcp\config.jsonConfiguration Format:
{
"common-mcp": {
"version": "1.0.0",
"globalDefaults": {
"timeout": 30000,
"retryAttempts": 3,
"retryDelay": 1000,
"circuitBreaker": {
"enabled": true,
"failureThreshold": 5,
"resetTimeout": 60000
}
},
"downstreamServers": {
"your-mcp-server": {
"command": "npx",
"args": ["-y", "your-mcp-package"],
"timeout": 30000,
"retries": 3,
"env": {}
}
}
}
}Edit the mcp_config.json file:
- Windows:
C:\Users\[username]\.codeium\windsurf\mcp_config.json - Linux/macOS:
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"common-mcp-gateway": {
"command": "common-mcp",
"args": [],
"disabled": false
}
}
}Edit the Cursor MCP configuration file:
- Windows:
C:\Users\[username]\AppData\Roaming\Cursor\User\mcp.json - Linux:
~/.config/Cursor/User/mcp.json - macOS:
~/Library/Application Support/Cursor/User/mcp.json
{
"mcpServers": {
"common-mcp-gateway": {
"command": "common-mcp",
"args": [],
"env": {
"COMMON_MCP_CONFIG": "~/.common-mcp/config.json"
},
"disabled": false
}
}
}Important: Disable all downstream MCP servers in mcp_config.json (set "disabled": true) as they will be managed by the gateway.
In the config.json file, add your downstream servers:
{
"common-mcp": {
"downstreamServers": {
"my-server": {
"command": "npx",
"args": ["-y", "my-mcp-server"],
"timeout": 30000,
"retryAttempts": 3
}
}
}
}The gateway uses serverId__toolName format (double underscore):
time__get_current_time
fetch__fetch
filesystem__read_file
memory__create_entities
cursor-playwright__playwright_navigate
Why double underscore? Windsurf requires tool names matching ^[a-zA-Z0-9_-]{1,64}$. The slash character (/) is not allowed, so we use __ as a separator.
{
"globalDefaults": {
"timeout": 30000, // milliseconds
"retryAttempts": 3,
"retryDelay": 1000, // base delay in ms
"circuitBreaker": {
"enabled": true,
"failureThreshold": 5,
"resetTimeout": 60000 // milliseconds
}
}
}{
"downstreamServers": {
"server-id": {
"command": "npx",
"args": ["-y", "package-name"],
"timeout": 45000, // Override global
"retryAttempts": 3, // Override global
"env": {
"API_KEY": "your-key-here"
},
"healthCheck": {
"enabled": true,
"method": "tool_name",
"interval": 30000
}
}
}
}{
"logging": {
"level": "INFO", // DEBUG|INFO|WARN|ERROR
"format": "json", // json|simple
"file": "path/to/log.log",
"maxSize": "10MB",
"maxFiles": 5
}
}The Common MCP Gateway includes a web-based admin interface for managing your MCP servers:
Features:
- View all downstream MCP servers
- Add new MCP servers with full configuration
- Edit existing servers (inline, below selected item)
- Enable/Disable servers
- Delete servers
- Live WebSocket updates (no restart required)
- Timeout, retry, circuit breaker, and fallback configuration
Option 1: Manual Start (Development)
# Terminal 1: Start backend
cd marketplace/backend
npm run dev
# Terminal 2: Start frontend
cd marketplace/frontend
npm run devAccess at: http://localhost:5173
Option 2: PM2 Auto-Start (Production)
Use PM2 process manager for automatic startup:
# Install PM2 globally (if not installed)
npm install -g pm2
# Start both backend and frontend
pm2 start ecosystem.config.js
# View status
pm2 status
# View logs
pm2 logs mcp-marketplace-backend
pm2 logs mcp-marketplace-frontend
# Stop all
pm2 stop all
# Enable startup on system boot
pm2 startup
pm2 saveConfiguration Path:
- The Marketplace UI edits:
C:\Users\[username]\.common-mcp\config.json - NOT the Windsurf config:
C:\Users\[username]\.codeium\windsurf\mcp_config.json - Changes are saved immediately and broadcast via WebSocket
- Add New MCP Server: Click "+ Add New MCP" button at top
- Edit Server: Click "Edit" button on any server - form appears below that server
- Enable/Disable: Click "Enable" or "Disable" button
- Delete Server: Click "Delete" button and confirm
- Advanced Settings: Configure timeout, retries, circuit breaker thresholds, fallback servers
npm run buildnpm run devnpm test
npm run test:coverageThe gateway consists of the following components:
- Router: Routes tool names to downstream servers
- Timeout Watchdog: Configurable timeout management
- Retry Engine: Exponential backoff with jitter
- Circuit Breaker: Open/Closed/Half-Open state management
- Connection Pool: Downstream connection lifecycle
- Logger: Structured JSON logging
Detailed architecture documentation: ARCHITECTURE.md
Check the command and args in your configuration:
# Test manually
npx -y package-nameIncrease the timeout value in configuration:
{
"timeout": 60000 // 60 seconds
}If too many errors occur, the circuit breaker enters OPEN state. Wait for the reset timeout (default: 60s) or restart the gateway.
# Windows
type C:\Users\%USERNAME%\.common-mcp\logs\common-mcp-*.log
# Or open the file in a JSON viewer- Add server configuration to
config.json:
{
"downstreamServers": {
"my-new-server": {
"command": "npx",
"args": ["-y", "@scope/my-mcp-server"],
"timeout": 30000,
"retryAttempts": 3,
"env": {
"API_KEY": "optional-key"
}
}
}
}-
Restart the gateway (or restart Windsurf to reload the gateway)
-
Tools will be available as
my-new-server__toolname
You can extend the gateway with custom middleware. See ARCHITECTURE.md for details.
A web-based configuration management interface is available for easy MCP server management.
- Visual Config Management: View, add, edit, and delete MCP servers
- Enable/Disable Toggle: Quick on/off switching for any server
- Live Reload: Real-time updates via WebSocket
- Configuration Validation: Automatic validation before saving
- Dark Mode UI: Modern, clean interface
Start Backend:
cd marketplace/backend
npm install
npm run devStart Frontend:
cd marketplace/frontend
npm install
npm run devAccess at http://localhost:5173
See marketplace/README.md for detailed documentation.
Comprehensive testing results available in MCP_TOOLS_TEST_RESULTS.md.
Tested MCP Servers:
- ✅ Time MCP (2 tools)
- ✅ Fetch MCP (1 tool)
- ✅ Filesystem MCP (10+ tools)
- ✅ Memory MCP (8 tools)
- ✅ Sequential Thinking MCP (1 tool)
- ✅ Cursor Playwright MCP (30+ tools)
Test Results: 13+ tools tested with 100% success rate.
See the marketplace directory for:
- Backend API server example
- React frontend implementation
- WebSocket live reload pattern
- Configuration validation examples
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Test thoroughly (see TESTING.md)
- Submit a pull request
See CHANGELOG.md for detailed version history and release notes.
Apache License 2.0 - See LICENSE file for details.
- Model Context Protocol Specification
- MCP SDK Documentation
- Windsurf IDE
- Cursor AI IDE
- Architecture Documentation
- Testing Documentation
- Test Results
For issues and questions:
- GitHub Issues: Create an issue
- Documentation: docs/EN/ and docs/HU/
Hungarian documentation: See docs/HU/ for Hungarian versions of all documentation.