RouterMCP CLI
RouterMCP CLI
Self-hosted MCP gateway that aggregates multiple upstream servers into a single unified interface.
RouterMCP CLI
The RouterMCP CLI is a powerful self-hosted MCP gateway that aggregates multiple upstream MCP servers into a single unified interface with comprehensive filtering capabilities.
Installation
Global Installation
npm install -g routermcpAfter installation, use the routermcp command directly:
routermcp --helpLocal Installation
npm install routermcpUse with npx:
npx routermcp --helpOr add to your package.json scripts:
{
"scripts": {
"mcp": "routermcp"
}
}Quick Start
- Create a configuration file:
routermcp configOr manually create routermcp.jsonc:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/directory"]
}
}
}- Start the gateway:
routermcpKey Features
| Feature | Description |
|---|---|
| Server Aggregation | Combine multiple MCP servers into one gateway |
| Tool Filtering | Control exposed tools with include/exclude patterns |
| Code Mode | Execute JavaScript in a secure WebAssembly sandbox |
| Multiple Transports | Support for stdio, HTTP/SSE, and Streamable HTTP |
| Tunnel Support | Expose local servers via Cloudflare or ngrok |
| Daemon Mode | Share a single gateway across multiple clients |
| Environment Variables | Use ${VAR} syntax in configuration |
CLI Commands
| Command | Description |
|---|---|
routermcp | Start the gateway (default: stdio mode) |
routermcp serve | Explicit serve command |
routermcp connect | Connect to a shared daemon |
routermcp proxy | Proxy a stdio server over HTTP |
routermcp config | Interactive configuration wizard |
routermcp tunnel | Expose gateway via public tunnel |
Common Options
routermcp # Start with stdio transport
routermcp --http 5151 # Start with HTTP on port 5151
routermcp -c /path/to/config # Use custom config file
routermcp -v # Verbose logging