selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

rustunnel logo

Self-host rustunnel

v0.8.5

Open-source tunnel server with MCP for AI agents

BetaOpen SourceAGPL-3.0
Updated11 hours ago
LanguageRust
Setup difficultyModerate
Stars
658
Ports
80 (HTTP edge (redirects to HTTPS)), 443 (HTTPS edge (TLS-terminated tunnel ingress)), 4040 (Control-plane WebSocket (clients connect here)), 8443 (Dashboard UI and REST API), 9090 (Prometheus metrics endpoint), 20000 (TCP tunnel range start (configurable)), 20100 (UDP tunnel range start (configurable))
Requires
PostgreSQL
Docker
ghcr.io/joaoh82/rustunnel-server
Install with Docker
rustunnel screenshot 1

What is rustunnel?

rustunnel is a Rust-based tunnel server for exposing local services to the internet. It uses encrypted WebSocket links with TLS termination, provides automatic Let's Encrypt certificates for HTTPS, and supports raw TCP and UDP forwarding. Direct peer-to-peer tunnels use QUIC with NAT hole-punching. Multiple tunnels can be grouped for distributing traffic using health checks. The software includes a live terminal dashboard, a local request inspector with replay, Prometheus metrics, and audit logging. It also ships an MCP server compatible with any MCP harness, allowing AI assistants to create and manage tunnels using natural language. Users can either use the managed cloud service (free Hobby tier, pay-as-you-go starting at $3/month) or self-host the AGPL-licensed server on their own infrastructure via Docker, Docker Compose, systemd on Ubuntu, or pre-built binaries. Self-hosting requires a server with a public IP, wildcard DNS, and PostgreSQL for shared state.

Should you self-host rustunnel?

rustunnel scores 53/100 on selfhost.directory (how scoring works) and ranks #13 of 31 in Networking. It has 658 GitHub stars.

It shipped 14 stable releases in the past year. The latest, v0.8.5, came out on 4 September 2026. New versions land roughly every 1 days.

Setup is moderate: expect some configuration beyond a single command. An official Docker image is available. It is AGPL-3.0-licensed and written mostly in Rust.

Its closest alternative on selfhost.directory is Webhook.site (66/100, 6 786 stars). It scores higher overall, so compare the two before you pick. See rustunnel vs Webhook.site side by side.

Features

  • Audit Logging
  • Custom Subdomains
  • HTTP/HTTPS tunneling
  • Live terminal dashboard
  • Load balancing with health checks
  • Local request inspector with replay
  • MCP server for AI agents
  • Multi-region support
  • P2P tunnels
  • Prometheus Metrics
  • Rate Limiting
  • REST API
  • TCP Tunneling
  • Token Management
  • UDP tunneling

rustunnel README

How to install rustunnel

Install rustunnel with Docker

docker pull ghcr.io/joaoh82/rustunnel-server:latest

Run with config mounted

docker run --rm
-p 80:80 -p 443:443 -p 4040:4040 -p 8443:8443
-v "$PWD/deploy/server.toml:/etc/rustunnel/server.toml:ro"
ghcr.io/joaoh82/rustunnel-server:latest

Multi-arch images (linux/amd64 + linux/arm64) published to GitHub Container Registry on every stable release

How to configure rustunnel

  • auth.admin_tokenMaster auth token

    Master auth token

  • auth.require_authReject unauthenticated clients

    Reject unauthenticated clients

  • database.captured_path/var/lib/rustunnel/captured.dbPer-region SQLite file for captured HTTP request bodies

    Per-region SQLite file for captured HTTP request bodies

  • database.urlPostgreSQL connection URL (required)

    PostgreSQL connection URL (required)

  • limits.ip_rate_limit_rps100Per-source-IP rate cap (req/s); 0 = disabled

    Per-source-IP rate cap (req/s); 0 = disabled

  • limits.max_connections_per_tunnelMax concurrent connections per tunnel

    Max concurrent connections per tunnel

  • limits.max_tunnels_per_sessionMax tunnels per connected client

    Max tunnels per connected client

  • limits.rate_limit_rpsPer-tunnel request rate cap (req/s)

    Per-tunnel request rate cap (req/s)

  • limits.request_body_max_bytesMax proxied request body size (bytes)

    Max proxied request body size (bytes)

  • limits.tcp_port_rangeInclusive [low, high] TCP tunnel port range

    Inclusive [low, high] TCP tunnel port range

  • logging.audit_log_pathPath for audit log (JSON-lines); omit to disable

    Path for audit log (JSON-lines); omit to disable

  • logging.formatOutput format: json (structured) | pretty

    Output format: json (structured) | pretty

  • logging.levelVerbosity: trace | debug | info | warn | error

    Verbosity: trace | debug | info | warn | error

  • region.iddefaultRegion identifier recorded in tunnel history

    Region identifier recorded in tunnel history

  • region.locationPhysical location label

    Physical location label

  • region.nameDefaultHuman-readable region name shown in the dashboard

    Human-readable region name shown in the dashboard

  • server.control_portWebSocket control-plane port

    WebSocket control-plane port

  • server.dashboard_originAllowed CORS origin for the dashboard UI

    Allowed CORS origin for the dashboard UI

  • server.dashboard_port4040Dashboard port

    Dashboard port

  • server.domainBase domain for tunnel URLs

    Base domain for tunnel URLs

  • server.http_portHTTP edge port

    HTTP edge port

  • server.https_portHTTPS edge port

    HTTPS edge port

  • tls.acme_enabledfalseEnable built-in ACME renewal

    Enable built-in ACME renewal

  • tls.cert_pathPath to TLS certificate (PEM)

    Path to TLS certificate (PEM)

  • tls.key_pathPath to TLS private key (PEM)

    Path to TLS private key (PEM)

rustunnel releases & version history

FAQ

How does rustunnel compare to Cloudflare Tunnel?

Both expose local services without opening inbound ports, but Cloudflare Tunnel is free and ties tunnels to a Cloudflare account and DNS zone. rustunnel is open source under AGPL, can be self-hosted on any VPS with no vendor lock-in, supports raw TCP and UDP plus direct peer-to-peer connections, and ships an MCP server for AI agents.

Can I use a custom domain or custom subdomain?

Yes. Pay-as-you-go and self-hosted plans let you bind tunnels to a custom subdomain on the rustunnel edge. When self-hosting, the server is configured against your own wildcard DNS record so you can serve tunnels under any domain you own — there is no per-domain fee.

Does rustunnel work for webhook testing?

Yes. rustunnel is a drop-in tunnel for testing Stripe, GitHub, Slack, or any other webhook against a service running on localhost. Open an HTTP tunnel on the port your dev server is listening on, paste the public HTTPS URL into the provider's webhook configuration, and inbound deliveries are forwarded straight to your machine over an end-to-end encrypted connection.

Is rustunnel secure?

All client-server traffic is end-to-end encrypted with TLS, public HTTPS endpoints get automatic Let's Encrypt certificates, and tunnels are authenticated with API keys you control. The managed cloud routes traffic through regional edges only — payloads are not inspected or logged.

Does rustunnel work with AI agents like Claude Code, Codex, or Cursor?

Yes. rustunnel ships an MCP server that works with any MCP harness — Claude Code, Claude Desktop, Codex, Cursor, Windsurf, Cline, and custom agents. A one-command installer or copy-paste config wires it up; setup is one step — get an API key, set RUSTUNNEL_TOKEN, done.

How is rustunnel priced?

The Hobby plan is free forever. The Pay-as-you-go plan has a $3/month minimum that is credited toward usage at $0.10 per GB of bandwidth — if you transfer one gigabyte of traffic in a month you spend the minimum, and idle tunnels cost nothing. Self-hosting is free under AGPL.

What protocols does rustunnel support?

HTTP/HTTPS with automatic Let's Encrypt TLS, raw TCP on a configurable port range, UDP forwarding, and direct peer-to-peer tunnels with NAT hole-punching over QUIC. Tunnels can be grouped for client-side load balancing with TCP and HTTP health checks.

Can I self-host rustunnel?

Yes. The rustunnel server is published on GitHub under AGPL and ships with a Docker image, a Makefile target, and a systemd service template. Self-hosting gives you unlimited tunnels, custom subdomains, and full control over the relay.

Is rustunnel a free ngrok alternative?

Yes. rustunnel offers a free Hobby tier on the managed cloud (two concurrent tunnels with random subdomains) and the entire server is open source under AGPL, so you can self-host it for free with no usage limits.

What is rustunnel?

rustunnel is an open-source secure tunnel that exposes services running on your laptop or private network to the public internet over an encrypted WebSocket connection. It is similar to ngrok or Cloudflare Tunnel, but written in Rust, AGPL-licensed, and available either as a managed cloud with pay-as-you-go billing or as a self-hosted server.

More in Reverse Proxy

Rate this project

Click to rate — no account needed.

0 comments

Posting as guest
Loading comments…