Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
dwsy avatar

Cf Tunnel

  • 11 installs
  • 17 repo stars
  • Updated July 25, 2026
  • dwsy/agent

Exposes local services publicly via Cloudflare Tunnel with a unified CLI, port allocation, and status monitoring.

About

A skill providing a unified Bun CLI for managing Cloudflare Tunnel exposure, control panels, and port allocation, with automatic port-conflict fallback and aggregated status across local services and public URLs. A solo builder reaches for it to quickly and cleanly expose a local dev server to the internet for demos or webhooks.

  • Unified Bun CLI for Cloudflare Tunnel share and panels
  • Automatic port conflict resolution
  • Aggregated tunnel and service status monitoring

Cf Tunnel by the numbers

  • 11 all-time installs (skills.sh)
  • Ranked #987 of 1,438 DevOps & CI/CD skills by installs in the Skillselion catalog
  • Data as of Jul 29, 2026 (Skillselion catalog sync)
npx skills add https://github.com/dwsy/agent --skill cf-tunnel

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs11
repo stars17
Last updatedJuly 25, 2026
Repositorydwsy/agent

What it does

Exposes local services publicly via Cloudflare Tunnel with a unified CLI, port allocation, and status monitoring.

Who is it for?

Builders exposing local dev servers for demos or webhooks

Skip if: Production-grade ingress or load balancing

Files

SKILL.mdMarkdownGitHub ↗

Cloudflare Tunnel 管理技能(统一版)

目标:把“临时暴露 + 管理面板 + 端口管理”统一到一个命令入口,避免端口混乱。

✅ 推荐入口(统一 Bun CLI)

bun ~/.pi/agent/skills/cf-tunnel/scripts/cf.ts

命令总览

# 启动临时暴露(等同 share start)
bun ~/.pi/agent/skills/cf-tunnel/scripts/cf.ts start --dir ./demos/html

# 暴露已有端口
bun ~/.pi/agent/skills/cf-tunnel/scripts/cf.ts start --port 8766

# 暴露单文件
bun ~/.pi/agent/skills/cf-tunnel/scripts/cf.ts start --file ./demos/html/index.html --route /index.html

# 启动/停止/查看面板
bun ~/.pi/agent/skills/cf-tunnel/scripts/cf.ts panel start --port 8788 --host 127.0.0.1
bun ~/.pi/agent/skills/cf-tunnel/scripts/cf.ts panel status
bun ~/.pi/agent/skills/cf-tunnel/scripts/cf.ts panel stop

# 综合状态(share + panel)
bun ~/.pi/agent/skills/cf-tunnel/scripts/cf.ts status

# 停止(默认全停)
bun ~/.pi/agent/skills/cf-tunnel/scripts/cf.ts stop
# 只停 share
bun ~/.pi/agent/skills/cf-tunnel/scripts/cf.ts stop --share
# 只停 panel
bun ~/.pi/agent/skills/cf-tunnel/scripts/cf.ts stop --panel

---

功能特性

  • 统一入口:cf.ts 同时管理 share / panel
  • 端口自动避让:面板端口占用时自动切换到下一个可用端口
  • 会话清晰:固定 tmux session 名
  • cf-share-web
  • cf-share-tunnel
  • cf-share-panel
  • 状态聚合:一个命令看完整状态(本地服务 / tunnel / panel / 公网 URL)
  • 向后兼容:share.tspanel.ts 仍可直接使用

---

底层命令(兼容保留)

# share 底层
bun ~/.pi/agent/skills/cf-tunnel/scripts/share.ts start --dir ./demos/html
bun ~/.pi/agent/skills/cf-tunnel/scripts/share.ts status
bun ~/.pi/agent/skills/cf-tunnel/scripts/share.ts stop

# panel 底层
bun ~/.pi/agent/skills/cf-tunnel/scripts/panel.ts --port 8788 --host 127.0.0.1
建议优先使用 cf.ts,底层命令主要用于调试。

---

API 与面板

启动面板后默认地址:

  • http://127.0.0.1:8788(若占用会自动避让)

API:

  • GET /api/status 当前状态
  • POST /api/start 启动(body 支持 port/dir/file/route
  • POST /api/stop 停止
  • GET /api/logs 日志 tail
  • GET /api/history 历史记录
  • POST /api/history/clear 清空历史

---

依赖

# Cloudflared(如未安装)
wget -q https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
sudo dpkg -i cloudflared-linux-amd64.deb

本地静态服务优先级:python3 > bunx > npx(无可用工具时直接失败)

---

故障排查

1. cf.ts status 先看三类会话是否在线 2. 如果 tunnel 无 URL:检查 ~/.cf-tunnel/share-tunnel.log 3. 如果 panel 打不开:cf.ts panel status 看实际端口(可能已自动避让) 4. 彻底重置:cf.ts stop --all 后重新 start

Related skills

DevOps & CI/CDdeployinfra

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.