Expose local services via secure tunnels using rustunnel MCP server. Create public URLs for local HTTP/TCP services for testing, webhooks, and deployment.
Expose local services (HTTP/TCP) through public URLs using rustunnel. Perfect for testing webhooks, sharing local development, and deployment workflows.
Always use MCP tools for tunnel management. They handle lifecycle automatically.
| Method | Lifecycle | Recommended |
|---|---|---|
| MCP tools (create_tunnel, close_tunnel) |
| Automatic cleanup |
| Yes |
| CLI (rustunnel http 3000) | Manual process management | Only for cloud sandboxes |
Why MCP tools?
The API token is configured when the plugin is enabled and is available via the
RUSTUNNEL_TOKEN environment variable. Read it from there when making tool calls —
do not ask the user for their token.
token = env("RUSTUNNEL_TOKEN")
Expose a local port and get a public URL.
Parameters:
| Param | Type | Required | Description |
|---|---|---|---|
token | string | yes | API token (read from RUSTUNNEL_TOKEN env var) |
local_port | integer | yes | Local port to expose |
protocol | "http" | "tcp" | yes | Tunnel type |
subdomain | string | no | Custom subdomain (HTTP only) |
region | string | no | Region ID (e.g. "eu", "us", "ap"). Omit to auto-select. Use list_regions to see options. |
Returns:
{
"public_url": "https://abc123.edge.rustunnel.com",
"tunnel_id": "a1b2c3d4-...",
"protocol": "http"
}
Lifecycle: Tunnel stays open until close_tunnel is called or MCP server exits.
Close a tunnel by ID. Public URL stops working immediately.
Parameters:
| Param | Type | Required | Description |
|---|---|---|---|
token | string | yes | API token |
tunnel_id | string | yes | UUID from create_tunnel |
This is the proper way to close tunnels. No orphaned processes.
List all currently active tunnels.
Parameters:
| Param | Type | Required | Description |
|---|---|---|---|
token | string | yes | API token |
Returns: JSON array of tunnel objects.
Retrieve history of past tunnels.
Parameters:
| Param | Type | Required | Description |
|---|---|---|---|
token | string | yes | API token |
protocol | "http" | "tcp" | no | Filter by protocol |
limit | integer | no | Max entries (default: 25) |
List available tunnel server regions. No authentication required.
Parameters: None
Returns: JSON array of region objects:
[
{ "id": "eu", "name": "Europe", "location": "Helsinki, FI", "host": "eu.edge.rustunnel.com", "control_port": 4040, "active": true }
]
Returns the CLI command string without spawning anything. Use when MCP can't spawn subprocesses (cloud sandboxes, containers) or you prefer running the CLI yourself.
Parameters:
| Param | Type | Required | Description |
|---|---|---|---|
token | string | yes | API token |
local_port | integer | yes | Local port to expose |
protocol | "http" | "tcp" | yes | Tunnel type |
region | string | no | Region ID (e.g. "eu"). Omit to auto-select. |
Returns:
{
"cli_command": "rustunnel http 3000 --server edge.rustunnel.com:4040 --token abc123",
"server": "edge.rustunnel.com:4040",
"install_url": "https://github.com/joaoh82/rustunnel/releases/latest"
}
1. Read token from RUSTUNNEL_TOKEN env var
2. Create tunnel: create_tunnel(token, local_port=3000, protocol="http")
3. Store tunnel_id for later cleanup
4. Return public_url to user
5. When done: close_tunnel(token, tunnel_id)
1. Read token from RUSTUNNEL_TOKEN env var
2. create_tunnel(token, local_port=5173, protocol="http", subdomain="myapp-preview")
3. Return URL: https://myapp-preview.edge.rustunnel.com
4. close_tunnel(token, tunnel_id) when done
1. Read token from RUSTUNNEL_TOKEN env var
2. create_tunnel(token, local_port=5432, protocol="tcp")
3. Return tcp://host:port for connection
4. close_tunnel(token, tunnel_id) when done
1. Read token from RUSTUNNEL_TOKEN env var
2. get_connection_info(token, local_port=3000, protocol="http")
3. Output CLI command for user to run locally
4. User runs command
5. list_tunnels(token) to verify and get public_url
6. When done, user Ctrl+C the CLI process
Internet ──── :443 ────▶ rustunnel-server ────▶ WebSocket ────▶ rustunnel-client ────▶ localhost:PORT
│
Dashboard (:8443)
REST API
--insecure only in local dev)