Documentation

mcpTunnel Docs

Expose your local MCP servers to any AI client over the internet. One command, one URL, all your tools.

Getting Started

mcpTunnel discovers your locally configured MCP servers, aggregates their tools into a single endpoint, and tunnels it to the internet via Cloudflare. Any MCP-compatible AI client — ChatGPT, Claude, Cursor, and more — can then access your local tools remotely.

mcpTunnel is open source and free to use. It requires no account to get started with quick tunnels.

Installation

Pre-built Binaries

Download the latest release for your platform from GitHub Releases:

bash
# Linux & macOS — auto-detect platform
curl -L https://github.com/appsecsanta/mcp-tunnel/releases/latest/download/mcptunnel-$(uname -s | tr A-Z a-z)-$(uname -m) -o mcptunnel
chmod +x mcptunnel
sudo mv mcptunnel /usr/local/bin/

From Source (Go)

Requires Go 1.21 or later:

bash
go install github.com/appsecsanta/mcptunnel@latest

Verify Installation

bash
mcptunnel --version

Quick Start

The fastest way to expose your MCP servers to an AI client:

1

Start the tunnel

This auto-discovers your MCP servers and creates a public tunnel:

bash
mcptunnel start
2

Copy the tunnel URL

mcpTunnel outputs a public URL like:

text
https://api.mcptunnel.sh/mcp
3

Connect your AI client

Paste the URL into your AI client's MCP server configuration. See the Platform Setup section for specific instructions.

Quick tunnels generate a random URL each time. Use --named-tunnel for a persistent URL.

Auto-Discovery

mcpTunnel automatically discovers MCP servers from your existing AI tool configurations. No manual setup required.

Supported Sources

SourceConfig PathFlag
Claude Desktop~/Library/Application Support/Claude/claude_desktop_config.json--source claude
Cursor~/.cursor/mcp.json--source cursor
Continue~/.continue/config.json--source continue
Custom~/.mcptunnel/servers.json--source mcptunnel

By default, mcpTunnel scans all sources. Use --source to limit discovery to a specific one:

bash
# Only discover from Claude Desktop config
mcptunnel start --source claude

Configuration

For servers not defined in any supported config file, create a custom definition at ~/.mcptunnel/servers.json:

json
{
  "mcpServers": {
    "my-custom-server": {
      "command": "node",
      "args": ["/path/to/server.js"],
      "env": {
        "API_KEY": "your-key"
      }
    },
    "python-tools": {
      "command": "python",
      "args": ["-m", "my_mcp_server"],
      "env": {}
    }
  }
}

Server Definition Fields

FieldTypeDescription
commandstringThe executable to run (e.g., node, python, npx)
argsstring[]Command-line arguments passed to the executable
envobjectEnvironment variables set when spawning the server process

CLI Reference

mcptunnel start

Discovers MCP servers, starts the aggregating HTTP server, and opens a tunnel.

FlagDefaultDescription
--sourceallConfig source to discover from: claude, cursor, continue, mcptunnel
--port3000Local HTTP server port
--quick-tunneltrueUse a temporary Cloudflare tunnel with random URL
--named-tunnel-Use a persistent named Cloudflare tunnel
--safe-onlyfalseSkip servers whose env vars contain detected credentials
--no-tunnelfalseRun the local HTTP server only, without opening a tunnel
--verbosefalseEnable detailed logging output

mcptunnel login

Authenticate with the mcpTunnel service for named tunnels and dashboard access.

bash
mcptunnel login

mcptunnel --version

Print the installed version of mcpTunnel.

Tunneling

mcpTunnel uses Cloudflare tunnels to expose your local server to the internet without port forwarding, firewall rules, or a public IP address.

Quick Tunnel (default)

Generates a temporary random URL. No account required.

bash
mcptunnel start --quick-tunnel

Named Tunnel

Persistent URL that stays the same across restarts. Requires authentication.

bash
mcptunnel login
mcptunnel start --named-tunnel my-dev-machine

Local Only (No Tunnel)

Run the HTTP server on localhost without creating a tunnel. Useful for LAN access or when using your own reverse proxy.

bash
mcptunnel start --no-tunnel --port 8080

Tool Aggregation

mcpTunnel merges tools, resources, and prompts from all discovered MCP servers into a single endpoint. Tool names are prefixed with the server name to prevent collisions.

Naming Convention

Tools are namespaced with a double-underscore prefix: servername__toolname

text
# Example: 3 servers aggregated
filesystem__read_file
filesystem__write_file
filesystem__list_directory
git__log
git__diff
git__status
postgres__query
postgres__list_tables

MCP Endpoint

The aggregated server is available at /mcp using Streamable HTTP transport (MCP 2025-03-26 spec). JSON-RPC over HTTP with session management headers.

Security

Exposing MCP servers to the internet means remote AI clients can invoke your local tools. Review what you expose carefully.

Credential Guard

mcpTunnel scans each server's environment variables for patterns that look like secrets (API keys, tokens, passwords). Servers with detected credentials trigger a warning.

bash
# Skip any server with detected credentials
mcptunnel start --safe-only

OAuth Authentication

Named tunnels support OAuth 2.0 authentication, requiring clients to authenticate before accessing your MCP servers. Quick tunnels are publicly accessible by URL — treat the URL as a secret.

Best Practices

  • Use --safe-only in production to skip servers with credentials
  • Prefer named tunnels with OAuth for persistent access
  • Never share quick tunnel URLs publicly — they grant full tool access
  • Review discovered servers before starting the tunnel
  • Use --verbose to inspect what tools and resources are being exposed

Platform Setup

Instructions for connecting mcpTunnel to each supported AI client.

ChatGPT

Web and Desktop app
  1. 1.Start mcpTunnel: mcptunnel start
  2. 2.Copy the tunnel URL (e.g., https://api.mcptunnel.sh/mcp)
  3. 3.In ChatGPT, go to Settings → Connected Apps → Add MCP Server
  4. 4.Paste the tunnel URL and save

Claude Desktop

macOS and Windows app
  1. 1.Start mcpTunnel: mcptunnel start
  2. 2.Copy the tunnel URL
  3. 3.In Claude Desktop, open Settings → MCP Servers → Add Server
  4. 4.Select "Streamable HTTP" as the transport type
  5. 5.Paste the tunnel URL and save

Claude Code

CLI and IDE extension
  1. 1.Start mcpTunnel: mcptunnel start
  2. 2.Copy the tunnel URL
  3. 3.Run: claude mcp add mcptunnel --transport http <tunnel-url>

Cursor

AI Code Editor
  1. 1.Start mcpTunnel: mcptunnel start
  2. 2.Copy the tunnel URL
  3. 3.In Cursor, open Settings → MCP → Add new MCP Server
  4. 4.Set type to "streamablehttp" and paste the URL

Troubleshooting

mcpTunnel doesn't find any servers

Check that your AI tool configs exist at the expected paths. Use --verbose to see which paths are being scanned. You can also define custom servers in ~/.mcptunnel/servers.json.

Tunnel URL not working

Quick tunnel URLs are temporary and expire when mcpTunnel stops. Restart mcpTunnel to get a new URL, or use --named-tunnel for a persistent one.

Connection refused errors

Make sure the MCP server process starts successfully. Use --verbose to see server spawn logs. Check that the command and args in your config are correct.

Credential warning appears

mcpTunnel detected environment variables that look like secrets (API keys, tokens, etc.). Use --safe-only to skip those servers, or review the warning and proceed if intended.

Port already in use

Another process is using port 3000. Use --port to specify a different port: mcptunnel start --port 8080

Need help?

Open an issue on GitHub or check the README for the latest updates.