RouterMCP
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 routermcp

After installation, use the routermcp command directly:

routermcp --help

Local Installation

npm install routermcp

Use with npx:

npx routermcp --help

Or add to your package.json scripts:

{
  "scripts": {
    "mcp": "routermcp"
  }
}

Quick Start

  1. Create a configuration file:
routermcp config

Or manually create routermcp.jsonc:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/directory"]
    }
  }
}
  1. Start the gateway:
routermcp

Key Features

FeatureDescription
Server AggregationCombine multiple MCP servers into one gateway
Tool FilteringControl exposed tools with include/exclude patterns
Code ModeExecute JavaScript in a secure WebAssembly sandbox
Multiple TransportsSupport for stdio, HTTP/SSE, and Streamable HTTP
Tunnel SupportExpose local servers via Cloudflare or ngrok
Daemon ModeShare a single gateway across multiple clients
Environment VariablesUse ${VAR} syntax in configuration

CLI Commands

CommandDescription
routermcpStart the gateway (default: stdio mode)
routermcp serveExplicit serve command
routermcp connectConnect to a shared daemon
routermcp proxyProxy a stdio server over HTTP
routermcp configInteractive configuration wizard
routermcp tunnelExpose 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

Documentation

On this page