DeepSeek Harness Plugin

U-first/dsh-magpie-tunnel

Stars ★ 0 Category Remote & Mobile Added 2026-12-01

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-tunnel in 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, zero wrangler CLI, and optional custom domain (works on free *.workers.dev too). 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 missing workers.dev subdomains ([10063]), uploads the 14.7 KB ESM worker + SQLite Hibernatable Durable Object, injects a random 256-bit TUNNEL_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: Bearer headers 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 fresh Connection: close sockets.
  • 4-Gate Anti-Naked-Exposure Preflight: Blocks startup unless your local origin rejects unauthenticated proxied requests with 401 or 403.
  • True Plug-and-Play & Zero Residue: One-click sidebar toggle, automatic resource teardown on unload, React PluginErrorBoundary UI 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)):

  1. Step 1: Create a scoped Cloudflare API Token (Workers Scripts: Edit, Account Settings: Read; plus Zone: Read and Workers Routes: Edit if binding a custom domain) and click Verify Token & Load Zones.
  2. Step 2: Optionally enter a custom hostname (or leave empty for free *.workers.dev) and click Deploy Edge Worker & Configure.
  3. 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. Existing v0.1–v0.3 configs automatically remain on cloudflared upon upgrade.

3. Start & Connect

  1. Click Start Tunnel (or toggle Magpie Tunnel in the sidebar footer).
  2. Click Verify Public Endpoint E2E to verify unauthenticated 401/403 blocking and authenticated 200 OK model listing.
  3. Paste https://your-url/v1 and 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: 300s default header timeout for reasoning models, 64 KiB streaming chunks with adaptive 256 KiB → 4 MiB sliding-window backpressure, and instant RESET("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/403 rejection on unauthenticated proxied probes, optional saved API key verification, and engine configuration completeness.
  • Edge Sensitive-Path Blocking: Blocks /.env, /.git, .., and node_modules at the Worker edge (403), while permitting /.well-known.
  • DSH Session Cookie Write Guard: Every mutating, deploy, and secret-reveal POST route enforces connection.browserAuth.isAuthenticated(req).
  • Secret Isolation & Redaction: Deployment API tokens are never written to disk; workerSecret, tunnelToken, and magpieApiKey are masked from all GET responses and redacted from logs; control-plane auth uses constant-time comparison.
  • Read-Only Agent Tool: magpie_tunnel_status reports 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

MIT

Content from the project README on GitHub ↗

Links

More in this category

View the whole category →

Community comments

Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.