Zero-binary dual-engine Cloudflare Tunnel plugin for local Magpie or OpenAI-compatible gateways, with 1-click Edge Worker deployment, classic cloudflared fallback, 4-gate auth preflight, and QR endpoint card. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.
Install
# from a prebuilt release tarball
dsh plugin --profile web add -w "https://github.com/U-first/dsh-magpie-tunnel/releases/download/v1.0.0/dsh-magpie-tunnel-1.0.0.tgz"
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:U-first/dsh-magpie-tunnel
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
TL;DR: Install
dsh-magpie-tunnelin DeepSeek Harness (DSH) and publish your local Magpie gateway (or any authenticated local OpenAI-compatible server) on a fixed HTTPS URL in 3 GUI steps—with zero 53 MB external binary, zerowranglerCLI, and optional custom domain (works on free*.workers.devtoo). Connect from any laptop, tablet, phone, or AI client on any network.
Dual-Engine Architecture & Highlights
| Aspect | Zero-Binary worker-ws Engine (v1.0 Default) |
Classic cloudflared Sidecar Engine (Optional) |
|---|---|---|
| External Binary Size | 0 MB (runs natively in Node >= 22; embedded Edge Worker is 14.7 KB) | ~53 MB (downloaded on demand to private dir with SHA-256 verification) |
| Process Footprint | In-process (no extra child process) | Managed child sidecar (~35–65 MB RAM, isolated crash boundary) |
| Domain Requirement | Free *.workers.dev OR Cloudflare Custom Domain |
Cloudflare-hosted domain or Zero Trust Tunnel Token |
| Setup Experience | One-shot CF API Token → 1-Click REST API Auto-Deploy | Browser OAuth → 1-Click Tunnel + DNS / Import ~/.cloudflared |
| Streaming SSE & Cancel | Native 6-frame binary mux (dmt.v1) + sliding-window backpressure + instant abort |
Official cloudflared HTTP/2 transport |
| Cloudflare Cost | Cloudflare Free Tier (SQLite Durable Objects + zero-wake hibernated heartbeats) | Free Cloudflare Tunnel |
Key Engineering Properties
- Zero Runtime Dependencies:
"dependencies"is completely empty; Host, Client, and Edge share one typed binary protocol specification (docs/PROTOCOL.md). - Guided, Beginner-Friendly Setup Wizard:
- Visual 4-step progress bar, smart disabled Start Tunnel button with missing-step hover tooltip until ready, default-collapsed Advanced Settings drawer, and built-in zero-dependency SVG QR code for instant mobile scanning.
- Step 1: Verify a one-shot Cloudflare API Token (kept strictly in RAM across panel close/reopen, cleared automatically after deploy, never written to disk).
- Step 2: Auto-discovers active zones & existing Worker domains, avoids occupied DNS records (
[100117]conflict recovery), auto-provisions missingworkers.devsubdomains ([10063]), uploads the 14.7 KB ESM worker + SQLite Hibernatable Durable Object, injects a random 256-bitTUNNEL_SECRET, and verifies/_dmt/health. - Step 3: Paste or one-click auto-detect your local Magpie Gateway API Key from DSH (optional—remote clients'
Authorization: Bearerheaders are forwarded transparently while the 401/403 anti-naked preflight remains enforced).
- Proxy / TUN / Fake-IP Resilient Networking: Built-in DoH (
1.1.1.1) + direct-IP SNI health check and direct-IP WebSocket fallback bypass stale local/TUN negative DNS caches right after binding a new custom domain; Cloudflare API requests automatically retry across system proxy and freshConnection: closesockets. - 4-Gate Anti-Naked-Exposure Preflight: Blocks startup unless your local origin rejects unauthenticated proxied requests with
401or403. - True Plug-and-Play & Zero Residue: One-click sidebar toggle, automatic resource teardown on unload, React
PluginErrorBoundaryUI resilience, and one-click purge of~/.dsh/magpie-tunnel/.
Supported Devices & Clients
Any standard OpenAI-compatible client (Base URL + API Key) on any network works immediately:
| Category | Popular Clients | Configuration |
|---|---|---|
| Desktop AI Clients | Cherry Studio, ChatBox, AnythingLLM | Base URL: https://your-url/v1 + Magpie API Key |
| AI Coding IDEs & Extensions | Cursor, Cline, Continue, Roo Code | Set Custom OpenAI Base URL to https://your-url/v1 |
| Web / Self-Hosted UIs | Open WebUI, LobeChat, NextChat | Add OpenAI-compatible provider with your HTTPS URL & key |
| Mobile & Tablet Apps | dsh-go, ChatBox Mobile, etc. | Copy Base URL & cookie-protected API Key from the endpoint card |
| Scripts & SDKs | OpenAI Python / Node.js SDK, curl |
Set base_url="https://your-url/v1" and api_key |
3-Minute Quick Start
1. Install the Plugin
- DSH Desktop GUI: Open Plugins → Add plugin, enter
github:U-first/dsh-magpie-tunnel, then click Install and Enable. - DSH CLI:
dsh plugin --profile web add github:U-first/dsh-magpie-tunnel
No external binary is downloaded on install when using the default worker-ws engine.
2. Complete the 3-Step Wizard
Open Settings → Magpie Tunnel (default tab: Zero-Binary Worker (Recommended)):
- Step 1: Create a scoped Cloudflare API Token (
Workers Scripts: Edit,Account Settings: Read; plusZone: ReadandWorkers Routes: Editif binding a custom domain) and click Verify Token & Load Zones. - Step 2: Optionally enter a custom hostname (or leave empty for free
*.workers.dev) and click Deploy Edge Worker & Configure. - Step 3: Click Auto-Detect from Local DSH (or paste
sk-magpie-key-...and save).
Prefer classic
cloudflared? Switch to the Classic cloudflared tab inside the wizard card, or click Import ~/.cloudflared. Existingv0.1–v0.3configs automatically remain oncloudflaredupon upgrade.
3. Start & Connect
- Click Start Tunnel (or toggle Magpie Tunnel in the sidebar footer).
- Click Verify Public Endpoint E2E to verify unauthenticated
401/403blocking and authenticated200 OKmodel listing. - Paste
https://your-url/v1and your API key into your remote clients.
How It Works
flowchart LR
Clients["Remote Devices & Clients<br/>Cherry Studio / ChatBox / Cursor /<br/>Open WebUI / LobeChat / dsh-go"]
Edge["Cloudflare Worker +<br/>Hibernatable Durable Object<br/>(14.7 KB ESM, dmt.v1)"]
Host["DSH Host Built-In worker-ws<br/>(Zero External Binary, Flow Control)"]
Origin["Local Magpie / OpenAI Gateway<br/>http://127.0.0.1:3425"]
Clients -->|"HTTPS (Bearer API Key)"| Edge
Edge <-->|"WSS + 6-Frame Binary Mux<br/>(Zero-Wake Hibernated Heartbeat)"| Host
Host -->|"Loopback Streaming Proxy"| Origin
- Single encrypted outbound WebSocket—no open inbound router ports.
- Tuned for LLM workloads:
300sdefault header timeout for reasoning models,64 KiBstreaming chunks with adaptive256 KiB → 4 MiBsliding-window backpressure, and instantRESET("client_aborted")propagation that destroys the local HTTP request immediately when a client cancels generation. - Full wire specification in docs/PROTOCOL.md and architecture notes in DESIGN.md.
Security & Zero-Residue Cleanup
- 4-Gate Preflight Guard: Validates local origin reachability, mandatory
401/403rejection on unauthenticated proxied probes, optional saved API key verification, and engine configuration completeness. - Edge Sensitive-Path Blocking: Blocks
/.env,/.git,.., andnode_modulesat the Worker edge (403), while permitting/.well-known. - DSH Session Cookie Write Guard: Every mutating, deploy, and secret-reveal
POSTroute enforcesconnection.browserAuth.isAuthenticated(req). - Secret Isolation & Redaction: Deployment API tokens are never written to disk;
workerSecret,tunnelToken, andmagpieApiKeyare masked from allGETresponses and redacted from logs; control-plane auth uses constant-time comparison. - Read-Only Agent Tool:
magpie_tunnel_statusreports status/preflight only and never mutates tunnel state or leaks secrets. - Zero-Residue Cleanup: Use Stop & Purge Private Data to stop the tunnel and wipe
~/.dsh/magpie-tunnel/.
FAQ
npm install
npm run check # Runs tsc --noEmit, 3-target esbuild bundle, and full Vitest suite
See docs/PROTOCOL.md, DESIGN.md, and CHANGELOG.md.
License
Links
More in this category
zhu1090093659/dsh-web#packages/dsh-remote-web-ui★ 10703
Remote control of a dsh web workspace from phone or PC: QR-code pairing through a token-gated channel, SSE real-time sync, and separate mobile and full desktop GUI modes.
zhu1090093659/dsh-web#packages/dsh-ssh★ 10703
SSH ops panel for DSH: web terminal, SFTP transfer with progress, local port forwarding, and one-command cluster execution across hosts; agents share the same host config.
liguobao/ds-harness-remote★ 4109
Multi-device remote access for DeepSeek Harness and supported coding workspaces through an end-to-end encrypted channel, with adaptive Relay/WebRTC transport, device authorization, workspace files, read-only previews, terminals, and optional Codex Remote.
saya-ch/dsh-mobile★ 1033
Access DeepSeek Harness from the Android app or a mobile browser with secure LAN and remote connections, persistent device pairing, and a customizable mobile interface.
WNLUO/dsh-mobile-plugin★ 536
The DeepSeek Harness app lets you use the DeepSeek Harness on this computer or server from your phone. Phones and tablets both work, on Android and iOS. On your phone you can keep chatting, look at files and manage plugins, and the machine you are using can also connect to DeepSeek Harness on your other machines and open each one separately.
uumit-ai/dsh-uumit-remote★ 534
Open dsh web from your phone or another computer through a UUMit account, without running your own server or installing another program: a built-in tunnel client connects to UUMit's hosted tunnel, and a panel in the sidebar handles pairing and who can use it (only you, people you invite by link or phone number, or everyone), with revocation. Requires dsh web on DSH >=0.2.1-rc.2.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.