
rustunnel
io.github.joaoh82由 GitHub 帳號 joaoh82 發布v0.8.9更新於 Nov 5, 2026
Give AI agents public HTTPS/TCP/UDP URLs for any localhost service. Open source, self-hostable.
概覽
Rustunnel 為本機服務產生公開的 HTTPS、TCP 或 UDP 網址,讓 AI 助理把本機應用程式、資料庫或遊戲伺服器對外開放。
- 可以做什麼
- 把本機連接埠以 HTTP、TCP、UDP 或點對點方式開放為公開網址
- 自動選擇區域或指定區域,並可申請自訂子網域
- 依設定檔啟動全部通道,或依連接埠啟動一次性通道
- 輸出機器可讀的 JSON 事件,包含通道就緒、重新連線與錯誤資訊
- 在自架伺服器上建立與管理 API 權杖
- 適用情境
- 當助理需要給瀏覽器、Webhook 或其他人一個可存取的網址,指向本機執行的服務(例如開發伺服器、資料庫或遊戲伺服器),又不想部署時適用。
- 執行需求
- 以本機程序執行(提供 macOS、Linux、Windows 的 MCP 安裝包)。需要 rustunnel 驗證權杖:在 rustunnel.com 註冊免費帳號並從儀表板建立權杖,或使用自架伺服器。權杖可透過 RUSTUNNEL_TOKEN 環境變數或設定檔提供。自架服務需要 Linux 伺服器、PostgreSQL、TLS 憑證與萬用字元 DNS。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 rustunnel,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
rustunnel
[CI] [License: AGPLv3] [Rust] [Listed on Skillselion]
The open-source tunnel that scales with you. Don't pay for idle time. Secure, Rust-fast, and Pay-as-you-go.
Expose local services through a public server over encrypted WebSocket connections with TLS termination, HTTP/TCP proxying, a live dashboard, Prometheus metrics, and audit logging.
You can self-host or use our managed service.
Using an AI agent? rustunnel ships an MCP server: one-click setup for Cursor (then add your API token):
For Claude Code, Claude Desktop, Windsurf, and others, see the agent integration guide or the agent manual at rustunnel.com/agents.md.
Table of Contents
- Hosted service
- Architecture overview
- Requirements
- Local development setup
- Production deployment (Ubuntu / systemd)
- Docker deployment · full guide
- Client configuration
- Port reference
- Config file reference (server)
- REST API
- AI agent integration (MCP server)
- Monitoring
- Roadmap
- Contributing
- License
- Contact
Hosted service
You can use rustunnel without running your own server. We operate a global fleet of public edge servers that you can connect to immediately.
Available regions
The client auto-selects the nearest region by default. Use --region <id> to connect to a specific one. The legacy address edge.rustunnel.com is a CNAME to eu.edge.rustunnel.com and will continue to work for backward compatibility.
Getting an auth token
Sign up for a free account at rustunnel.com. No waiting list, no manual approval.
- Create an account at rustunnel.com
- Go to Dashboard → API Keys and create a token
- Copy the token. It is shown only once
Plans:
The Hobby (free) plan is a great way to get started: 2 concurrent tunnels, random subdomains only, and 1 GB/mo. Upgrade to pay-as-you-go from your dashboard whenever you need custom subdomains or more tunnels. Pay-as-you-go has no tunnel cap.
Quick start with the hosted server
Once you have a token, run the setup wizard:
Then expose a local service:
The client prints the public URL as soon as the tunnel is established:
Architecture overview
Requirements
To build
To run the server in production
Local development setup
Build
Run tests
The integration test suite spins up a real server on random ports and exercises auth, HTTP tunnels, TCP tunnels, and reconnection logic. It requires a running PostgreSQL instance.
make db-start runs deploy/docker-compose.dev-deps.yml which starts a Postgres 16 container on localhost:5432. The make test target injects TEST_DATABASE_URL automatically. If you run cargo test directly, export the variable first:
Run the server locally
Generate a self-signed certificate for local testing:
A ready-made local config is checked into the repository at deploy/local/server.toml.
It points to the self-signed cert paths above and has auth disabled for convenience.
Start the server with it directly:
Key settings in deploy/local/server.toml:
Run the client locally
With the server running, expose a local service (e.g. something on port 3000):
--insecureskips TLS certificate verification. Required when using a self-signed certificate locally. Never use this flag against a production server.
The client will print a public URL, for example:
Testing the HTTP tunnel locally
The tunnel URL uses a subdomain (e.g. http://abc123.localhost:8080).
Browsers won't resolve *.localhost subdomains by default, so you have two options:
Option A: curl with a Host header (no setup required)
Option B: wildcard DNS via dnsmasq (enables browser access)
Then visit http://abc123.localhost:8080 in the browser (include :8080 since the
local config uses port 8080, not port 80).
Git hooks
A pre-push hook is included in .githooks/ that mirrors the CI check step
(format check + Clippy). Run this once after cloning to activate it:
From that point on, every git push will automatically run:
If either check fails the push is aborted, keeping the remote branch green.
Production deployment (Ubuntu / systemd)
The steps below match a deployment where:
- Domain:
edge.rustunnel.com - Wildcard DNS:
*.edge.rustunnel.com → <server IP> - TLS certs: Let's Encrypt via Certbot + Cloudflare DNS challenge
1: Install dependencies
Install Rust (as the build user, not root):
2: Build release binaries
Binaries will be at:
target/release/rustunnel-servertarget/release/rustunnel
3: Create system user and directories
4: Install the server binary
Or use the Makefile target (runs build + install + systemd setup):
5: Set up PostgreSQL
rustunnel requires PostgreSQL for shared state (tokens, tunnel history, audit log).
Create a dedicated database and user:
Tip: For managed PostgreSQL (e.g. AWS RDS, DigitalOcean Managed Database, Supabase) skip the
apt installstep above and just note the connection URL for the config in the next step.
Schema migrations run automatically when the server starts. No manual SQL needed.
6: Create the server config file
Create /etc/rustunnel/server.toml with the content below.
Replace your-admin-token-here with a strong random secret (e.g. openssl rand -hex 32).
Secure the file:
7: TLS certificates (Let's Encrypt + Cloudflare)
Create the Cloudflare credentials file:
Request a certificate covering the bare domain and the wildcard (required for HTTP subdomain tunnels):
Certbot writes the certificate to:
These paths are already set in the config above. Certbot sets up automatic renewal via a systemd timer.
rustunnel reads TLS certificates from disk at startup, so it must be restarted after each renewal. Add a Certbot deploy hook to do this automatically:
Allow the rustunnel service user to read the certificates:
8: Set up systemd service
9: Open firewall ports
10: Verify the server is running
Port reminder: port 4040 is the control-plane WebSocket (clients connect here), not the dashboard. Hitting it with plain HTTP returns
HTTP/0.9which is expected. The dashboard is ondashboard_port. Check yourserver.tomlif unsure.
Updating the server
Pull the latest code, rebuild, install, and restart in one command:
This runs git pull → cargo build --release → install → systemctl restart → systemctl status.
Docker deployment
A full Docker guide covering both local development (self-signed cert) and production VPS (Let's Encrypt) is available in docs/docker-deployment.md.
Pull the published image
Multi-arch images (linux/amd64 + linux/arm64) are published to GitHub
Container Registry on every stable release. No build required:
Quick reference (build from source)
Files
Client configuration
Installation
Option 1: Homebrew (macOS and Linux, recommended)
Homebrew installs pre-built binaries. No Rust toolchain required.
The formula is updated automatically on every release. This installs
both rustunnel (the CLI client) and rustunnel-mcp (the MCP server
for AI agent integration).
Option 2: Pre-built binary
Download the archive for your platform from the
latest GitHub Release,
extract it, and move the rustunnel binary to a directory on your $PATH:
Available targets:
Option 3: Build from source
Requires Rust 1.76+.
Setup wizard
The easiest way to create your config file is the interactive setup wizard:
It prompts for your region and auth token, then writes ~/.rustunnel/config.yml with the correct server address and a commented tunnels: example section.
Pick a specific region (eu, us, ap) to connect directly, or auto (the default) to let the client probe all regions and pick the nearest. Choose self-hosted if you run your own server. The wizard will then prompt for your server address.
After running setup, use rustunnel start to connect with all tunnels defined in the config, or use rustunnel http <port> / rustunnel tcp <port> for one-off tunnels.
Quick start (CLI flags)
Machine-readable output (--json)
All tunnel-running commands (http, tcp, udp, p2p, start) and
token create accept a --json flag. With it, stdout emits NDJSON,
one JSON event object per line, instead of the human-readable startup
box, which makes the CLI easy to drive from scripts and AI agents:
Events:
Diagnostics still go to stderr, so stdout stays valid NDJSON. For the
http, tcp, udp, and p2p commands the auth token can also be
supplied via the RUSTUNNEL_TOKEN environment variable instead of
--token (start reads tokens from the config file).
Config file
Default location: ~/.rustunnel/config.yml
Start all tunnels from the config file:
Token management
Hosted service: manage tokens from the rustunnel.com dashboard under Dashboard → API Keys. You can create, label, and revoke tokens without any CLI commands.
Self-hosted: create additional tokens via the dashboard API:
Or via curl:
Port reference
Config file reference (server)
Monitoring
A Prometheus metrics endpoint is available at :9090/metrics:
Start with the full monitoring stack (Prometheus + Grafana):
Production note: The default Grafana password is
changeme. Set theGRAFANA_PASSWORDenvironment variable before starting the stack in production:
REST API
The dashboard port exposes a REST API for programmatic access to tunnels, tokens, captured requests, and tunnel history. All endpoints (except the health check) require an Authorization: Bearer <token> header.
/api/tunnels, /api/groups, and their per-tunnel sub-resources are scoped by caller: the admin token sees everything; a user-scoped API token sees only its own tunnels and groups; tunnels the caller can't see return 404, never 403. See docs/api-reference.md § Visibility scope for the full rules.
Quick reference
Full request/response schemas, query parameters, and examples are in docs/api-reference.md.
A machine-readable OpenAPI 3.0 spec is served at GET /api/openapi.json (no auth required).
AI agent integration (MCP server)
rustunnel ships a rustunnel-mcp binary that implements the
Model Context Protocol over stdio,
letting AI agents (Claude, GPT-4o, custom agents) open and manage tunnels
without any manual intervention.
Works with any MCP harness. For copy-paste config for Claude Code, Claude Desktop, Codex, Cursor, Windsurf, Cline, and custom agents, plus a one-command installer, see the Agent Integration Guide:
Quick setup (Claude Desktop, hosted server)
Set RUSTUNNEL_TOKEN once and the agent never has to pass a token on a tool call.
Available tools
Installation
Homebrew (macOS and Linux): installs rustunnel-mcp alongside the CLI:
Build from source:
Full setup guide, configuration options, and workflow examples are in docs/mcp-server.md.
Claude Code plugin
The easiest way to use rustunnel with Claude Code. Install the plugin and it handles all MCP configuration automatically. Just enter your token once and start asking Claude to expose ports.
The plugin prompts for your server address and API token at enable time, stores
them securely, and starts the MCP server in the background. No .mcp.json editing
or manual setup needed.
Plugin directory: plugins/claude-code/
Documentation: docs/claude-plugin.md
OpenClaw skill
rustunnel ships an OpenClaw skill that gives any OpenClaw-compatible AI agent first-class knowledge of rustunnel: config file format, authentication, tool signatures, and common workflows, without you having to explain it.
Skill file: skills/rustunnel/SKILL.md
What it covers:
To load the skill in Claude Code:
Once loaded, you can ask the agent things like:
"Expose my local port 3000 as an HTTPS tunnel using rustunnel."
"List my active tunnels and close the one forwarding port 5432."
"Set up my rustunnel config file with my token."
The skill instructs the agent to read credentials from ~/.rustunnel/config.yml
automatically, so you won't be prompted for your token on every invocation.
Roadmap
A detailed list of shipped features and planned future work is maintained in docs/ROADMAP.md.
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository and create a feature branch from
main. - Run
make install-hooksonce after cloning to activate the pre-push quality gate. - Make your changes. Ensure
make check(fmt + Clippy) andmake testpass locally. - Open a Pull Request with a clear description of what changed and why.
- A maintainer will review and merge once CI is green.
Guidelines
- Keep PRs focused: one logical change per PR.
- Add or update tests for any new behaviour.
- Follow the existing code style;
cargo fmtis enforced by CI. - For larger changes or new features, open an issue first to discuss the approach.
License
This project is licensed under the GNU AGPLv3 License. See the LICENSE file for details.
Contact
João Henrique Machado Silva
- GitHub: @joaoh82
- Project: github.com/joaoh82/rustunnel
- Issues & feature requests: GitHub Issues
來源:README.md,提交 bdf559c
工具
0版本歷史
4- v0.8.9最新Nov 5, 2026
- v0.8.8Nov 3, 2026
- v0.8.6Nov 3, 2026
- v0.8.5Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分