Rustunnel 是 AI Skill Hub 本期精选MCP工具之一。综合评分 7.5 分,整体质量较高。我们推荐使用将其纳入你的 AI 工具库,帮助提升工作效率。
Rustunnel 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
Rustunnel 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/joaoh82/rustunnel
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"rustunnel": {
"command": "npx",
"args": ["-y", "rustunnel"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 Rustunnel 执行以下任务... Claude: [自动调用 Rustunnel MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"rustunnel": {
"command": "npx",
"args": ["-y", "rustunnel"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效

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.
---

┌──────────────────────────────────────────┐
│ rustunnel-server │
│ │
Internet ──── :80 ─────▶│ HTTP edge (301 → HTTPS) │
Internet ──── :443 ────▶│ HTTPS edge ──▶ yamux stream ──▶ client │
Client ───── :4040 ────▶│ Control-plane WebSocket (TLS) │
Browser ──── :8443 ────▶│ Dashboard UI + REST API │
Prometheus ─ :9090 ────▶│ Metrics endpoint │
Internet ── :20000+ ───▶│ TCP tunnel ports (one per TCP tunnel) │
└──────────────────────────────────────────┘
│ yamux multiplexed streams
▼
┌─────────────────────┐
│ rustunnel client │
│ (developer laptop) │
└──────────┬──────────┘
│ localhost
▼
┌────────────────┐
│ local service │
│ e.g. :3000 │
└────────────────┘
---
apt update && apt install -y \
pkg-config libssl-dev curl git \
certbot python3-certbot-dns-cloudflare
Install Rust (as the build user, not root):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
http_port = 80 https_port = 443
make docker-run
| Requirement | Version | Notes |
|---|---|---|
| Rust toolchain | 1.76+ | Install via [rustup](https://rustup.rs) |
pkg-config | any | Needed by reqwest (TLS) |
libssl-dev | any | On Debian/Ubuntu: apt install libssl-dev |
| Node.js + npm | 18+ | Only needed to rebuild the dashboard UI |
```bash
cargo build --workspace
brew install dnsmasq echo "address=/.localhost/127.0.0.1" | sudo tee -a $(brew --prefix)/etc/dnsmasq.conf sudo brew services start dnsmasq
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
git clone https://github.com/joaoh82/rustunnel.git
cd rustunnel
cargo build --release -p rustunnel-server -p rustunnel-client
Binaries will be at: - target/release/rustunnel-server - target/release/rustunnel
```bash install -Dm755 target/release/rustunnel-server /usr/local/bin/rustunnel-server
install -Dm755 target/release/rustunnel /usr/local/bin/rustunnel
Or use the Makefile target (runs build + install + systemd setup):
bash sudo make deploy ```
A full Docker guide covering both local development (self-signed cert) and production VPS (Let's Encrypt) is available in docs/docker-deployment.md.
make docker-build
Option 1 — Homebrew (macOS and Linux, recommended)
brew tap joaoh82/rustunnel
brew install rustunnel
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:
```bash
The easiest way to create your config file is the interactive setup wizard:
rustunnel setup
It prompts for your region and auth token, then writes ~/.rustunnel/config.yml with the correct server address and a commented tunnels: example section.
rustunnel setup — create ~/.rustunnel/config.yml
Region [auto / eu / us / ap / self-hosted] (default: auto):
Selecting nearest region… eu 12ms · us 143ms · ap 311ms · → eu (Helsinki, FI) 12ms
Server set to: eu.edge.rustunnel.com:4040
Auth token (leave blank to skip): rt_live_abc123...
Created: /Users/you/.rustunnel/config.yml
Run `rustunnel start` to connect using this config.
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.
region: auto
{
"mcpServers": {
"rustunnel": {
"command": "rustunnel-mcp",
"args": [
"--server", "edge.rustunnel.com:4040",
"--api", "https://edge.rustunnel.com:8443"
]
}
}
}
Homebrew (macOS and Linux) — installs rustunnel-mcp alongside the CLI:
brew tap joaoh82/rustunnel
brew install rustunnel
Build from source:
make release-mcp
sudo install -m755 target/release/rustunnel-mcp /usr/local/bin/rustunnel-mcp
Full setup guide, configuration options, and workflow examples are in docs/mcp-server.md.
Once you have a token, run the setup wizard:
```bash rustunnel setup
curl -L https://github.com/joaoh82/rustunnel/releases/latest/download/rustunnel-<version>-aarch64-apple-darwin.tar.gz \ | tar xz sudo install -Dm755 rustunnel /usr/local/bin/rustunnel
Available targets:
| Platform | Archive |
|----------|---------|
| macOS Apple Silicon | `rustunnel-<version>-aarch64-apple-darwin.tar.gz` |
| macOS Intel | `rustunnel-<version>-x86_64-apple-darwin.tar.gz` |
| Linux x86_64 (glibc) | `rustunnel-<version>-x86_64-unknown-linux-gnu.tar.gz` |
| Linux x86_64 (musl, static) | `rustunnel-<version>-x86_64-unknown-linux-musl.tar.gz` |
| Linux arm64 | `rustunnel-<version>-aarch64-unknown-linux-gnu.tar.gz` |
| Windows x86_64 | `rustunnel-<version>-x86_64-pc-windows-msvc.zip` |
**Option 3 — Build from source**
Requires Rust 1.76+.
bash git clone https://github.com/joaoh82/rustunnel.git cd rustunnel cargo build --release -p rustunnel-client sudo install -Dm755 target/release/rustunnel /usr/local/bin/rustunnel
```bash
cargo fmt is enforced by CI.---
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).
```toml
Default location: ~/.rustunnel/config.yml
```yaml
| Key | Type | Default | Description |
|---|---|---|---|
server.domain | string | — | Base domain for tunnel URLs |
server.http_port | u16 | — | HTTP edge port |
server.https_port | u16 | — | HTTPS edge port |
server.control_port | u16 | — | WebSocket control-plane port |
server.dashboard_port | u16 | 4040 | Dashboard port |
tls.cert_path | string | — | Path to TLS certificate (PEM) |
tls.key_path | string | — | Path to TLS private key (PEM) |
tls.acme_enabled | bool | false | Enable built-in ACME renewal |
tls.acme_email | string | "" | Contact email for ACME |
tls.acme_staging | bool | false | Use Let's Encrypt staging CA |
tls.acme_account_dir | string | /var/lib/rustunnel | ACME state directory |
tls.cloudflare_api_token | string | "" | Cloudflare DNS API token (prefer env var CLOUDFLARE_API_TOKEN) |
tls.cloudflare_zone_id | string | "" | Cloudflare Zone ID (prefer env var CLOUDFLARE_ZONE_ID) |
auth.admin_token | string | — | Master auth token |
auth.require_auth | bool | — | Reject unauthenticated clients |
database.url | string | — | PostgreSQL connection URL (required) |
database.captured_path | string | /var/lib/rustunnel/captured.db | Per-region SQLite file for captured HTTP request bodies |
server.dashboard_origin | string | "" | Allowed CORS origin for the dashboard UI (e.g. http://localhost:3000) |
logging.level | string | — | trace / debug / info / warn / error |
logging.format | string | — | json or pretty |
logging.audit_log_path | string | null | Path for audit log (JSON-lines); omit to disable |
limits.max_tunnels_per_session | usize | — | Max tunnels per connected client |
limits.max_connections_per_tunnel | usize | — | Max concurrent connections per tunnel |
limits.rate_limit_rps | u32 | — | Per-tunnel request rate cap (req/s) |
limits.ip_rate_limit_rps | u32 | 100 | Per-source-IP rate cap (req/s); 0 = disabled |
limits.request_body_max_bytes | usize | — | Max proxied request body size (bytes) |
limits.tcp_port_range | [u16, u16] | — | Inclusive [low, high] TCP tunnel port range |
limits.udp_port_range | [u16, u16] | [0, 0] | Inclusive [low, high] UDP tunnel port range; [0, 0] disables UDP tunnels |
region.id | string | "default" | Region identifier recorded in tunnel history (e.g. "eu", "us", "ap") |
region.name | string | "Default" | Human-readable region name shown in the dashboard |
region.location | string | "" | Physical location label (e.g. "Helsinki, FI") |
---
dashboard_port = 8443
dns_cloudflare_api_token = YOUR_CLOUDFLARE_API_TOKEN EOF
chmod 600 /etc/letsencrypt/cloudflare.ini
Request a certificate covering the bare domain and the wildcard (required for HTTP subdomain tunnels):
bash certbot certonly \ --dns-cloudflare \ --dns-cloudflare-credentials /etc/letsencrypt/cloudflare.ini \ -d "edge.rustunnel.com" \ -d "*.edge.rustunnel.com" \ --agree-tos \ --email your@email.com
Certbot writes the certificate to: /etc/letsencrypt/live/edge.rustunnel.com/fullchain.pem /etc/letsencrypt/live/edge.rustunnel.com/privkey.pem
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:
bash cat > /etc/letsencrypt/renewal-hooks/deploy/restart-rustunnel.sh <<'EOF' #!/bin/sh systemctl restart rustunnel.service EOF chmod +x /etc/letsencrypt/renewal-hooks/deploy/restart-rustunnel.sh
Allow the `rustunnel` service user to read the certificates:
bash
```bash
| Port | Protocol | Purpose |
|---|---|---|
| 80 | TCP | HTTP edge — redirects to HTTPS; also ACME HTTP-01 challenge |
| 443 | TCP | HTTPS edge — TLS-terminated tunnel ingress |
| 4040 | TCP | Control-plane WebSocket — clients connect here |
| 8443 | TCP | Dashboard UI and REST API |
| 9090 | TCP | Prometheus metrics (/metrics) |
| 20000–20099 | TCP | TCP tunnel range (configurable via tcp_port_range) |
| 20100–20199 | UDP | UDP tunnel range (configurable via udp_port_range) |
---
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
| Method | Path | Description |
|---|---|---|
GET | /api/status | Health check (no auth) |
GET | /api/tunnels | List active tunnels |
GET | /api/tunnels/:id | Get a single tunnel |
DELETE | /api/tunnels/:id | Force-close a tunnel |
GET | /api/tunnels/:id/requests | Captured HTTP requests |
POST | /api/tunnels/:id/replay/:req_id | Fetch stored request for replay |
GET | /api/tokens | List API tokens |
POST | /api/tokens | Create an API token |
DELETE | /api/tokens/:id | Delete an API token |
GET | /api/history | Paginated tunnel history |
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).
---
make test
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.
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.
/plugin install rustunnel
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
该工具使用 AGPL-3.0 协议,商用场景请仔细阅读协议条款,必要时咨询法律意见。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
⚠️ AGPL 3.0 — 最严格的 Copyleft,网络服务端使用也需开源,SaaS 使用受限。
经综合评估,Rustunnel 在MCP工具赛道中表现稳健,质量良好。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | rustunnel |
| 原始描述 | 开源MCP工具:Self-hosted, secure tunnel server in Rust. Expose local HTTP/HTTPS/TCP/UDP servi。⭐630 · Rust |
| Topics | mcpapi-gatewayreverse-proxyrust |
| GitHub | https://github.com/joaoh82/rustunnel |
| License | AGPL-3.0 |
| 语言 | Rust |
收录时间:2026-05-25 · 更新时间:2026-05-26 · License:AGPL-3.0 · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端