Purpose
rustunnel is an open-source tunnel server and client tool used to expose locally running HTTP, HTTPS, TCP, and UDP services to the internet through a public server. A TLS-encrypted WebSocket connection is used between the local service and the public server, and the server side performs TLS termination and HTTP/TCP proxy forwarding. It can be used to show services externally during local development and debugging, and can also be used for port exposure in production environments.
Main capabilities
- Supports public exposure of HTTP, HTTPS, TCP, and UDP services.
- Supports custom subdomains, region selection (eu, us, ap), and load balancing pools.
- Provides a real-time dashboard, Prometheus metrics, and audit logs.
- Supports self-hosting, and also provides a hosted service with global edge servers.
- Includes an MCP server (rustunnel-mcp), allowing AI agents to open and manage tunnels through the Model Context Protocol without manual intervention.
- Provides a Claude Code plugin and OpenClaw skill files for easy integration with AI tools.
- The client supports --json output as NDJSON, making it convenient for scripts and AI agents to drive.
Usage
- Hosted service: register a free account at rustunnel.com, create a token in Dashboard → API Keys, run the setup wizard, and then use commands such as rustunnel http <port> or rustunnel tcp <port> to establish a tunnel. By default, the client automatically selects the nearest region, and --region <id> can be used to specify one.
- Self-hosting: can be built from source, deployed with a Docker image, or deployed on Ubuntu/systemd. The server requires PostgreSQL to store shared state, the management token is set in the configuration file, and TLS certificates can be obtained through Let's Encrypt + Cloudflare and the service restarted after renewal.
- Client installation: supports Homebrew (macOS and Linux), precompiled binaries, or building from source (requires Rust 1.76+).
- Configuration file: by default located at ~/.rustunnel/config.yml, can be generated through the interactive setup wizard, or edited manually.
- MCP integration: rustunnel-mcp implements the Model Context Protocol over stdio and can be used with Claude Code, Claude Desktop, Codex, Cursor, Windsurf, Cline, and others.
Applicable scenarios
- Temporarily exposing a web service or API externally during local development.
- Needing to expose internal TCP/UDP services to the public internet.
- Teams that want to automatically manage tunnels through AI agents.
- Scenarios where you want to self-host a tunnel server and monitor traffic and requests.
Limitations
- The specific pricing of the hosted service, free plan quota, and paid plan details are not yet provided.
- When using self-signed certificates for local environment testing, --insecure must be added; this flag cannot be used in production environments.
- Self-hosting requires a PostgreSQL instance.
- The repository uses the GNU AGPLv3 license.