Tunnels - Cloudflare and ngrok Integration
Expose your local MCP gateway to the internet using Cloudflare or ngrok.
Tunnels
The tunnel command exposes your local MCP gateway via a public URL, useful for remote access or sharing with teammates.
Basic Usage
routermcp tunnelThis starts an interactive wizard to select a tunnel provider.
Available Providers
| Provider | Command | Requirements |
|---|---|---|
| Cloudflare | --tunnel=cloudflare | cloudflared installed |
| ngrok | --tunnel=ngrok | ngrok installed and authenticated |
Cloudflare Tunnel
Start the tunnel
routermcp tunnel --tunnel=cloudflareOr with a custom port:
routermcp tunnel --tunnel=cloudflare --port 8080ngrok Tunnel
Install ngrok
Download from ngrok.com/download
Start the tunnel
routermcp tunnel --tunnel=ngrokConfiguration
Custom Port
Specify the port via command line:
routermcp tunnel --port 8080Or configure in routermcp.jsonc:
{
"httpServer": {
"port": 8080
},
"mcpServers": {
// ... servers
}
}Tunnel Output
When a tunnel is established, you'll see:
Tunnel established!
MCP Gateway URL: https://your-tunnel-url.com/mcp
Use this URL in your MCP client configurationThe tunnel URL can be used by any MCP client that supports HTTP transport.
CLI Options
| Option | Default | Description |
|---|---|---|
-c, --config <path> | ./routermcp.jsonc | Config file path |
-p, --port <port> | 5151 | HTTP server port |
--tunnel=<provider> | (interactive) | Tunnel provider |
Use Cases
Remote Development
Access your local MCP tools from a remote machine:
- Start the tunnel on your local machine
- Configure the tunnel URL in your remote MCP client
- Tools run locally but are accessible remotely
Team Sharing
Share your MCP setup with teammates:
- Start a tunnel to your configured gateway
- Share the tunnel URL with your team
- Multiple people can connect to your running tools
Testing Cloud Integrations
Test MCP integrations that require a public URL:
- Start a tunnel
- Configure the tunnel URL as a webhook endpoint
- Receive events from external services
Tunnels expose your local gateway to the internet. Use appropriate authentication and filtering to protect sensitive operations.