rustunnel-mcp binary is the MCP tunnel server for rustunnel. It implements the Model Context Protocol over stdio, letting AI agents — Claude Code, Cursor, GPT-4o, Gemini, Claude Desktop, OpenClaw, and any other MCP-compatible client — manage tunnels with six dedicated tools and no manual setup. For Claude Code specifically, the Claude Code plugin wraps this same server in a one-command install.
Just want to wire rustunnel into your harness? See the agent integration guide for copy-paste config for Claude Code, Claude Desktop, Codex, Cursor, Windsurf, Cline, and generic MCP clients, plus a one-command installer (
integrations/install.sh). This page is the deeper reference for the server and its tools.How it works
MCP is a standard for connecting AI agents to external tools. The agent sends JSON-RPC calls to the MCP server; the server translates them into REST API calls and CLI commands.Tunnels are established via a persistent WebSocket connection (the control plane on port 4040), not via a REST call. The MCP server handles this by spawning the
rustunnel CLI as a subprocess when create_tunnel is called.Installation
Build from source (included in the workspace):Configuration
rustunnel-mcp takes two flags:
| Flag | Default | Description |
|---|---|---|
--server | localhost:4040 | Control-plane address forwarded to the rustunnel CLI |
--api | http://localhost:4041 | Dashboard REST API base URL for tunnel queries |
--insecure | false | Skip TLS certificate verification (local dev / self-signed certs) |
Connecting an AI agent
Using the hosted server (eu.edge.rustunnel.com)
The fastest way to get started. You need an auth token — create a free account at rustunnel.com and generate one from Dashboard → API Keys → Create token. Claude Desktop — add to~/Library/Application Support/Claude/claude_desktop_config.json:
/plugin configure rustunnel again, then /reload-plugins.
See the Claude Code Plugin guide for full details.
Claude Code (manual .mcp.json) — add to your project’s .mcp.json:
“Expose my local server on port 3000 using my rustunnel tokenThe agent will call<token>.” “Open an HTTP tunnel to port 8080 with subdomainmyapp.” “List all my active tunnels.”
create_tunnel and return a public URL like https://abc123.eu.edge.rustunnel.com.
Self-hosted server
Replace the server address with your own instance:Local development (self-signed cert)
Cursor / VS Code / any MCP client
Most MCP clients use the same JSON format. Consult your client’s documentation for the exact location of the config file.Custom / programmatic agents
Spawnrustunnel-mcp as a subprocess and communicate via stdin/stdout using newline-delimited JSON-RPC 2.0:
Available tools
create_tunnel
Open a tunnel to a locally running service and get a public URL. Handles plain HTTP/TCP/UDP tunnels, peer-to-peer tunnels, and load-balanced pools.
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | no¹ | API token. ¹Optional when RUSTUNNEL_TOKEN is set in the MCP config. |
local_port | integer | yes | Local port the service is listening on |
protocol | "http" | "tcp" | "udp" | "p2p" | yes | Tunnel type |
subdomain | string | no | Custom subdomain for HTTP tunnels |
region | string | no | Region ID (e.g. "eu", "us", "ap"). Omit to auto-select by latency. Use list_regions to see options. |
local_host | string | no | Local hostname to forward to (default localhost) |
secret | string | p2p | Shared P2P secret — publisher and subscriber must match |
peer_name | string | p2p publish | Publish the local service under this name |
peer_target | string | p2p connect | Connect to a published P2P tunnel by this name |
group | string | LB | Load-balancing pool name (http/tcp only) |
group_key | string | LB | Shared secret for the pool; members must agree |
health_check | object | no | { type: "tcp"|"http", path, interval_secs, timeout_secs, max_failed, expect_2xx, alert_webhook } |
rustunnel as a background subprocess and polls the API until the tunnel appears (up to 15 seconds). Load-balanced tunnels are launched via a temporary rustunnel start config that is cleaned up automatically. The tunnel stays open until close_tunnel is called or the MCP server exits.
Example agent prompts:
“Expose my local server on port 3000.” “Open a P2P tunnel to port 3000 namedmy-svcwith secrethunter2.” “Load-balance ports 3000 and 3001 under subdomainpoolwith an HTTP health check on/health.”
list_tunnels
List all currently active tunnels.
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | no | API token (optional if RUSTUNNEL_TOKEN is set) |
GET /api/tunnels.
close_tunnel
Force-close a tunnel. The public URL stops working immediately.
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | no | API token (optional if RUSTUNNEL_TOKEN is set) |
tunnel_id | string | yes | UUID returned by create_tunnel or list_tunnels |
get_connection_info
Returns the CLI command (and, for load-balanced tunnels, a config file) without spawning anything. Use this when the MCP server cannot launch subprocesses (cloud sandboxes, containers) or when you want to run the CLI yourself. Accepts the same arguments as create_tunnel (local_host, secret/peer_name/peer_target for P2P, group/group_key/health_check for load balancing).
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | no¹ | API token (¹optional if RUSTUNNEL_TOKEN is set) |
local_port | integer | yes | Local port to expose |
protocol | "http" | "tcp" | "udp" | "p2p" | yes | Tunnel type |
region | string | no | Region ID (e.g. "eu", "us"). Omit to auto-select. |
| … | plus the optional create_tunnel args above |
list_regions
List available tunnel server regions with their IDs, names, and locations. No authentication required.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | — |
get_tunnel_history
Retrieve the history of past tunnels.
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | no | API token (optional if RUSTUNNEL_TOKEN is set) |
protocol | "http" | "tcp" | "udp" | "p2p" | no | Filter by protocol |
limit | integer | no | Max entries to return (default: 25) |
Agent workflow examples
Local agent exposing a dev server
Cloud agent (no subprocess access)
Token management
Hosted service
Sign up at rustunnel.com, then create an API key from the dashboard under Settings → API Keys.Self-hosted server
Create tokens via the dashboard UI, the CLI, or the REST API:OpenAPI spec
The server exposes a machine-readable API description at:Security notes
- The
rustunnelbinary must be installed and inPATHon the machine runningrustunnel-mcpforcreate_tunnelto work. - Tokens passed to tools are sent to the rustunnel server over HTTPS (or HTTP in local dev). Use HTTPS in production.
- Child processes spawned by
create_tunnelare killed when the MCP server exits (stdin closes). They are not persisted across MCP server restarts. - Use
--insecureonly in local development with self-signed certificates.
Related pages
Agent integration
Copy-paste MCP config for Claude Code, Claude Desktop, Codex, Cursor, Windsurf, and Cline.
Claude Code plugin
One-command install that wraps this MCP server for Claude Code.
Self-hosting
Run your own rustunnel server for the MCP server to connect to.
Load balancing
Pools, group keys, and health checks used by load-balanced tunnels.
AI tools hub
Quick-start version of this page with install one-liners and an agent-ready prompt.
Agent manual
Copy-paste recipes and an FAQ for AI agents, served as plain markdown.

