RouterMCP
RouterMCP CLI

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 tunnel

This starts an interactive wizard to select a tunnel provider.

Available Providers

ProviderCommandRequirements
Cloudflare--tunnel=cloudflarecloudflared installed
ngrok--tunnel=ngrokngrok installed and authenticated

Cloudflare Tunnel

Install cloudflared

macOS:

brew install cloudflared

Linux: Download from Cloudflare Downloads

Start the tunnel

routermcp tunnel --tunnel=cloudflare

Or with a custom port:

routermcp tunnel --tunnel=cloudflare --port 8080

ngrok Tunnel

Authenticate

One-time setup:

ngrok config add-authtoken YOUR_TOKEN

Start the tunnel

routermcp tunnel --tunnel=ngrok

Configuration

Custom Port

Specify the port via command line:

routermcp tunnel --port 8080

Or 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 configuration

The tunnel URL can be used by any MCP client that supports HTTP transport.

CLI Options

OptionDefaultDescription
-c, --config <path>./routermcp.jsoncConfig file path
-p, --port <port>5151HTTP server port
--tunnel=<provider>(interactive)Tunnel provider

Use Cases

Remote Development

Access your local MCP tools from a remote machine:

  1. Start the tunnel on your local machine
  2. Configure the tunnel URL in your remote MCP client
  3. Tools run locally but are accessible remotely

Team Sharing

Share your MCP setup with teammates:

  1. Start a tunnel to your configured gateway
  2. Share the tunnel URL with your team
  3. Multiple people can connect to your running tools

Testing Cloud Integrations

Test MCP integrations that require a public URL:

  1. Start a tunnel
  2. Configure the tunnel URL as a webhook endpoint
  3. Receive events from external services

Tunnels expose your local gateway to the internet. Use appropriate authentication and filtering to protect sensitive operations.

On this page