Skip to main content
The 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):
Or build without the dashboard UI step:

Configuration

rustunnel-mcp takes two flags:

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:
Claude Code (plugin — recommended) — install the plugin for zero-config setup:
Then configure your server details:
You’ll be prompted for your server address, API URL, and token. These are stored securely and persist across sessions. To reconfigure later, run /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:
Once connected, you can ask the agent:
“Expose my local server on port 3000 using my rustunnel token <token>.” “Open an HTTP tunnel to port 8080 with subdomain myapp.” “List all my active tunnels.”
The agent will call 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

Spawn rustunnel-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. Returns:
The MCP server spawns 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 named my-svc with secret hunter2.” “Load-balance ports 3000 and 3001 under subdomain pool with an HTTP health check on /health.”
Set RUSTUNNEL_TOKEN once in the MCP config (see the examples above) so you never have to pass token on a tool call. Get a key free at rustunnel.comDashboard → API Keys (or rustunnel token create on a self-hosted server).

list_tunnels

List all currently active tunnels. Returns: JSON array of tunnel objects from GET /api/tunnels.

close_tunnel

Force-close a tunnel. The public URL stops working immediately.

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). Returns:

list_regions

List available tunnel server regions with their IDs, names, and locations. No authentication required. Returns: JSON array of region objects:

get_tunnel_history

Retrieve the history of past tunnels.

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:
Store the raw token value securely — it is shown only once at creation time.

OpenAPI spec

The server exposes a machine-readable API description at:
No authentication required. Useful for agent discovery and client generation.

Security notes

  • The rustunnel binary must be installed and in PATH on the machine running rustunnel-mcp for create_tunnel to 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_tunnel are killed when the MCP server exits (stdin closes). They are not persisted across MCP server restarts.
  • Use --insecure only in local development with self-signed certificates.

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.