@juexibobi/private-desktop-mcp 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +41 -20
- package/README.md +52 -6
- package/bin/cli.mjs +581 -269
- package/bin/client-setup.mjs +40 -10
- package/bin/local-bridge.mjs +251 -0
- package/bin/logging.mjs +5 -1
- package/bin/policy.mjs +1 -1
- package/bin/proxy.mjs +44 -0
- package/bin/tailscale-hub.mjs +1951 -0
- package/bin/tailscale-node.mjs +351 -0
- package/bin/tailscale.mjs +605 -0
- package/core/mcp-hub.mjs +459 -0
- package/docs/agent-install.md +22 -1
- package/package.json +8 -3
- package/skills/private-desktop-mcp/SKILL.md +7 -2
package/AGENTS.md
CHANGED
|
@@ -30,25 +30,39 @@ Follow the preview-before-confirm contract in [docs/agent-install.md](docs/agent
|
|
|
30
30
|
Supported `<client>` values: `claude-code`, `claude-desktop`, `cursor`, `vscode`, `codex`, `gemini`, `windsurf`, `all`.
|
|
31
31
|
2. Show the user the target file path and preview, wait for confirmation, then apply without `--dry-run`.
|
|
32
32
|
|
|
33
|
-
### 3. Starting & Pairing a Device Connector
|
|
33
|
+
### 3. Starting & Pairing a Device Connector (Cloudflare, Tailscale P2P, or Hybrid)
|
|
34
34
|
|
|
35
|
-
- **
|
|
35
|
+
- **Cloudflare Relay (default full mode)**:
|
|
36
36
|
```bash
|
|
37
37
|
npx --yes --prefer-online --package=@juexibobi/private-desktop-mcp@latest -- private-desktop-mcp connect --json
|
|
38
38
|
```
|
|
39
|
+
- **Tailscale P2P Node (zero Cloudflare, zero pairing)**:
|
|
40
|
+
```bash
|
|
41
|
+
npx --yes --prefer-online --package=@juexibobi/private-desktop-mcp@latest -- private-desktop-mcp serve --json
|
|
42
|
+
```
|
|
43
|
+
- **Hybrid Dual-Transport (BOTH Tailscale P2P AND Cloudflare Relay simultaneously)**:
|
|
44
|
+
```bash
|
|
45
|
+
npx --yes --prefer-online --package=@juexibobi/private-desktop-mcp@latest -- private-desktop-mcp connect --hybrid --json
|
|
46
|
+
```
|
|
47
|
+
- **Zero-Server Multi-Device Tailnet Mesh Hub (on AI client machine or homelab)**:
|
|
48
|
+
```bash
|
|
49
|
+
npx --yes --prefer-online --package=@juexibobi/private-desktop-mcp@latest -- private-desktop-mcp hub --json
|
|
50
|
+
```
|
|
51
|
+
*(Pass `--expose-tailscale` to serve the hub to the whole tailnet, `--with-local` to also include this machine, or `--peer [name=]url` for static peers.)*
|
|
39
52
|
- **Least-privilege read-only + directory jail mode (recommended for untrusted or exploratory sessions)**:
|
|
40
53
|
```bash
|
|
41
|
-
npx --yes --prefer-online --package=@juexibobi/private-desktop-mcp@latest -- private-desktop-mcp
|
|
54
|
+
npx --yes --prefer-online --package=@juexibobi/private-desktop-mcp@latest -- private-desktop-mcp serve --readonly --allow-dir <workspace_path> --json
|
|
42
55
|
```
|
|
43
56
|
- **Aggregating additional local stdio MCP servers alongside Desktop Commander**:
|
|
44
57
|
```bash
|
|
45
58
|
npx --yes --prefer-online --package=@juexibobi/private-desktop-mcp@latest -- private-desktop-mcp connect --servers ./client-configs/servers.example.json
|
|
46
59
|
```
|
|
47
|
-
- When a machine is not paired yet, `--json` emits a structured event:
|
|
60
|
+
- When using Cloudflare mode and a machine is not paired yet, `--json` emits a structured event:
|
|
48
61
|
```json
|
|
49
62
|
{"event":"pairing_required","deviceName":"...","code":"...","approvalUrl":"https://.../admin/devices","pairId":"...","expiresIn":3600}
|
|
50
63
|
```
|
|
51
64
|
Present the `code` and `approvalUrl` to the user so they can approve it behind Cloudflare Access.
|
|
65
|
+
- When using Tailscale mode, `--json` emits `{"event":"tailscale_node_ready","mode":"serve|direct","endpointUrl":"..."}` (for `serve` / `connect --hybrid`) or `{"event":"tailnet_hub_ready","endpointUrl":"...","onlineDevices":...}` (for `hub`).
|
|
52
66
|
|
|
53
67
|
### 4. Multi-Device Orchestration via MCP Tools, Resources & Prompts
|
|
54
68
|
|
|
@@ -76,32 +90,39 @@ When connected to the remote `/mcp` Streamable HTTP endpoint:
|
|
|
76
90
|
### 1. Workspace Map
|
|
77
91
|
|
|
78
92
|
```text
|
|
93
|
+
core/
|
|
94
|
+
mcp-hub.mjs Runtime-agnostic MCP multi-device protocol core (meta-tools, resources, prompts, _device injection, self-healing errors; shared by Cloudflare Worker and Node Tailnet Mesh Hub)
|
|
79
95
|
worker/
|
|
80
|
-
index.mjs
|
|
81
|
-
auth.mjs
|
|
96
|
+
index.mjs Cloudflare Worker router & SQLite-backed DeviceHub Durable Object (MCP edge lifecycle, WebSocket relay, audit log, admin UI)
|
|
97
|
+
auth.mjs Cryptographic Cloudflare Access RS256 JWT verifier (Web Crypto API, JWKS caching + key-rotation refresh)
|
|
82
98
|
bin/
|
|
83
|
-
cli.mjs
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
99
|
+
cli.mjs Cross-platform CLI (connect, serve, hub, status, doctor, report, setup-client, reset; --transport cloudflare|tailscale|hybrid, --json, heartbeat watchdog, child gateway supervisor)
|
|
100
|
+
local-bridge.mjs Shared local request execution pipeline enforcing policy, tools/list filtering, outbound DLP, and activity logging across both Cloudflare WS and Tailscale HTTP transports
|
|
101
|
+
tailscale.mjs Cross-platform Tailscale CLI discovery, status/peer parser, TTL-cached WhoIs verifier, fail-closed identity authorizer, and managed foreground `tailscale serve` launcher
|
|
102
|
+
tailscale-node.mjs Tailscale P2P MCP node HTTP ingress (`/mcp`, `/pcc/node-info`, `/healthz`) in Serve HTTPS or direct Tailnet IPv4 mode
|
|
103
|
+
tailscale-hub.mjs Zero-server / self-hosted multi-device Tailnet Mesh Hub (Tailscale peer auto-discovery, isolated per-device upstream MCP sessions, static peers, optional local gateway, push-WS relay)
|
|
104
|
+
policy.mjs Local tool governance (--readonly, --allow-dir symlink-aware path jail, allow/deny lists, self-credential guard) & outbound DLP secret redaction
|
|
105
|
+
client-setup.mjs Non-destructive MCP client config generator/merger with --dry-run preview (supports Cloudflare, Tailscale node, local/Tailscale Hub, and Bearer tokens)
|
|
106
|
+
proxy.mjs System proxy autodetection (Windows WinINET, macOS scutil, environment HTTPS_PROXY/NO_PROXY) with automatic direct bypass for Tailscale (`*.ts.net`, `100.64.0.0/10`, `fd7a:115c:a1e0::/48`)
|
|
107
|
+
activity.mjs JSON-RPC/SSE parser, correlation IDs, and TRACE/DEBUG/LIVE terminal activity formatters
|
|
108
|
+
logging.mjs Terminal secret redaction and timestamped logging helpers
|
|
109
|
+
gateway.mjs Local loopback Streamable HTTP MCP gateway fronting @wonderwhy-er/desktop-commander + optional extra stdio MCP servers (Bearer + Host + Origin guard)
|
|
90
110
|
skills/
|
|
91
111
|
private-desktop-mcp/SKILL.md Bundled Agent Skill for coding agents
|
|
92
112
|
docs/
|
|
93
|
-
agent-install.md
|
|
113
|
+
agent-install.md Canonical agent-driven setup & safety runbook
|
|
94
114
|
tests/
|
|
95
|
-
*.test.mjs
|
|
115
|
+
*.test.mjs Node.js built-in test runner suites covering worker auth, DeviceHub DO, Tailscale auth/node/mesh hub, gateway, policy/DLP, client setup, proxy, activity, and packaging
|
|
96
116
|
```
|
|
97
117
|
|
|
98
118
|
### 2. Boundary & Security Invariants
|
|
99
119
|
|
|
100
|
-
1. **Zero secret leakage**: Never commit `device.json`, Cloudflare API keys/tokens (`cfk_`, `cfut_`, `cfat_`), Access cookies, or `.env` files. Never weaken `bin/policy.mjs` protection of the `PrivateDesktopMCP` credential directory.
|
|
101
|
-
2. **Fail-closed edge authentication**: `worker/auth.mjs` must verify RS256 signatures, `iss`, `aud`, `exp`, and `nbf` against `CF_ACCESS_TEAM_DOMAIN` + `CF_ACCESS_AUD`.
|
|
102
|
-
3. **
|
|
103
|
-
4. **
|
|
104
|
-
5. **
|
|
120
|
+
1. **Zero secret leakage**: Never commit `device.json`, `hub-state.json`, Cloudflare API keys/tokens (`cfk_`, `cfut_`, `cfat_`), Tailscale bearer tokens, Access cookies, or `.env` files. Never weaken `bin/policy.mjs` protection of the `PrivateDesktopMCP` credential directory.
|
|
121
|
+
2. **Fail-closed edge & Tailscale authentication**: `worker/auth.mjs` must verify RS256 signatures, `iss`, `aud`, `exp`, and `nbf` against `CF_ACCESS_TEAM_DOMAIN` + `CF_ACCESS_AUD`. `bin/tailscale.mjs` must fail closed on Tailscale identity (`Tailscale-User-Login` + `WhoIs`, defaulting strictly to the local owner login — never trusting an entire shared tailnet without explicit `--allow-ts-user` / `--allow-ts-tag` / `--token`).
|
|
122
|
+
3. **Shared local guardrails**: Every transport (`connect` Cloudflare WS, `serve` Tailscale HTTP, `hub --with-local`) must route through `bin/local-bridge.mjs` so `--readonly`, `--allow-dir`, self-credential protection, and outbound DLP cannot be bypassed on any transport.
|
|
123
|
+
4. **Loopback gateway isolation**: `gateway.mjs` binds only to `127.0.0.1`, validates loopback `Host` headers (anti-DNS-rebinding), rejects browser `Origin` headers (anti-CSRF), and requires a per-launch 32-byte `MCP_LOCAL_TOKEN`.
|
|
124
|
+
5. **Edge/Hub-always-alive MCP discovery**: `initialize`, `notifications/initialized`, `ping`, `server/discover`, `tools/list`, `resources/list`, `resources/read` (`relay://*`), `prompts/list`, and `prompts/get` must succeed at both the Worker edge and Tailnet Mesh Hub even when zero devices are connected.
|
|
125
|
+
6. **Direct dependency declaration**: Every package imported by `core/*.mjs`, `bin/*.mjs`, or `gateway.mjs` must be declared directly in `package.json` `dependencies` and listed in `package.json` `files` so `npx --install-strategy=nested` works on a clean machine.
|
|
105
126
|
|
|
106
127
|
### 3. Verification & Release Workflow
|
|
107
128
|
|
package/README.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# Private Desktop MCP
|
|
2
2
|
|
|
3
|
-
Self-hosted, **Agent-Native** multi-device [Model Context Protocol](https://modelcontextprotocol.io/) bridge for Desktop Commander (and optional additional local MCP servers)
|
|
3
|
+
Self-hosted, **Agent-Native** multi-device [Model Context Protocol](https://modelcontextprotocol.io/) bridge for Desktop Commander (and optional additional local MCP servers) supporting **Cloudflare Workers**, **Tailscale P2P / Tailnet Mesh Hub (zero cloud)**, and **Hybrid dual-transport**.
|
|
4
4
|
|
|
5
|
-
**
|
|
5
|
+
**Transports:**
|
|
6
|
+
- **Tailscale P2P & Mesh Hub (Zero Cloud)**: End-to-end encrypted WireGuard direct connections via `tailscale serve` HTTPS (`*.ts.net:8443`) or direct Tailnet IPv4 (`100.x.y.z:8718` + `whois` verification), with automatic zero-pairing multi-device discovery via `private-desktop-mcp hub`.
|
|
7
|
+
- **Cloudflare Workers + Durable Objects**: Streamable HTTP (`POST` + `DELETE`) to public/cloud AI clients behind Cloudflare Access; outgoing WebSocket with zero-cost hibernation heartbeat from each device.
|
|
8
|
+
- **Hybrid (`connect --hybrid`)**: Runs **both** Tailscale node ingress and Cloudflare outbound WebSocket simultaneously through the same local gateway, policy guardrails, and DLP pipeline.
|
|
6
9
|
|
|
7
10
|
## Quick Start: Install with Your Coding Agent
|
|
8
11
|
|
|
@@ -42,6 +45,13 @@ npx.cmd --yes --prefer-online --package=@juexibobi/private-desktop-mcp@latest --
|
|
|
42
45
|
|
|
43
46
|
Each release gets its own immutable npm version. **Do not overwrite a fixed `.tgz` at a stable URL**: npm caching might start an old version.
|
|
44
47
|
|
|
48
|
+
## What's new in v0.6.0 (Tailscale P2P, Mesh Hub & Hybrid Edition)
|
|
49
|
+
|
|
50
|
+
- **Zero-Cloud Tailscale P2P Node (`private-desktop-mcp serve`)**: Expose any Windows, macOS, or Linux desktop over end-to-end encrypted WireGuard using managed foreground `tailscale serve --https=8443` (official Let's Encrypt TLS, cleaned up automatically on Ctrl+C) or direct Tailnet IPv4 (`--ts-direct`), with fail-closed Tailscale user/tag WhoIs verification and no 75s/1MB Worker limits.
|
|
51
|
+
- **Zero-Server Multi-Device Tailnet Mesh Hub (`private-desktop-mcp hub`)**: Shared runtime-agnostic MCP Hub core (`core/mcp-hub.mjs`) with automatic zero-pairing discovery of same-user/tagged Tailscale nodes, isolated per-device upstream MCP sessions, static `--peer` support, optional `--with-local`, `--expose-tailscale`, and compatible push-WebSocket relay (`/relay/ws`).
|
|
52
|
+
- **Hybrid Dual-Transport (`private-desktop-mcp connect --hybrid`)**: Run both Tailscale P2P ingress and Cloudflare outbound WebSocket relay concurrently through the shared local policy/DLP guardrail pipeline (`bin/local-bridge.mjs`).
|
|
53
|
+
- **Automatic Tailscale Proxy Bypass & Agent CLI Integration**: `bin/proxy.mjs` and the Mesh Hub automatically bypass system/Clash HTTP proxies for `*.ts.net`, `100.64.0.0/10`, and `fd7a:115c:a1e0::/48`; `doctor --json`, `status --json`, `report --json`, and `setup-client --hub | --tailscale` all support Tailscale natively.
|
|
54
|
+
|
|
45
55
|
## What's new in v0.5.0 (Agent-Native Edition)
|
|
46
56
|
|
|
47
57
|
### Agent-Native MCP Protocol & Multi-Device Self-Healing
|
|
@@ -68,26 +78,62 @@ Each release gets its own immutable npm version. **Do not overwrite a fixed `.tg
|
|
|
68
78
|
## CLI commands & flags
|
|
69
79
|
|
|
70
80
|
```powershell
|
|
71
|
-
# Connect (default)
|
|
81
|
+
# Connect via Cloudflare relay (default)
|
|
72
82
|
private-desktop-mcp connect
|
|
73
83
|
|
|
84
|
+
# Serve directly over Tailscale P2P (zero Cloudflare account or pairing required)
|
|
85
|
+
private-desktop-mcp serve
|
|
86
|
+
private-desktop-mcp serve --readonly --allow-dir C:\workspace
|
|
87
|
+
|
|
88
|
+
# Run BOTH Tailscale P2P AND Cloudflare relay simultaneously (Hybrid mode)
|
|
89
|
+
private-desktop-mcp connect --hybrid
|
|
90
|
+
|
|
91
|
+
# Start a zero-server multi-device Tailnet Mesh Hub (auto-discovers Tailscale nodes)
|
|
92
|
+
private-desktop-mcp hub
|
|
93
|
+
private-desktop-mcp hub --with-local --expose-tailscale
|
|
94
|
+
|
|
74
95
|
# Safe read-only mode jailed to a workspace directory
|
|
75
96
|
private-desktop-mcp connect --readonly --allow-dir C:\workspace
|
|
76
97
|
|
|
77
|
-
# Configure MCP clients (
|
|
98
|
+
# Configure MCP clients (Cloudflare, local Tailnet Mesh Hub, or Tailscale node)
|
|
78
99
|
private-desktop-mcp setup-client claude-code --dry-run --json
|
|
79
|
-
private-desktop-mcp setup-client
|
|
100
|
+
private-desktop-mcp setup-client claude-code --hub --dry-run --json
|
|
101
|
+
private-desktop-mcp setup-client cursor --tailscale --dry-run --json
|
|
80
102
|
|
|
81
103
|
# Aggregate extra local MCP servers alongside Desktop Commander
|
|
82
104
|
private-desktop-mcp connect --servers ./client-configs/servers.example.json
|
|
83
105
|
|
|
84
|
-
# Machine-readable diagnostics & status
|
|
106
|
+
# Machine-readable diagnostics & status (includes Tailscale detection)
|
|
85
107
|
private-desktop-mcp doctor --json
|
|
108
|
+
private-desktop-mcp doctor --tailscale --json
|
|
86
109
|
private-desktop-mcp report --json
|
|
87
110
|
private-desktop-mcp status --json
|
|
88
111
|
private-desktop-mcp reset --json
|
|
89
112
|
```
|
|
90
113
|
|
|
114
|
+
## Tailscale P2P & Multi-Device Mesh Hub (Zero Cloud)
|
|
115
|
+
|
|
116
|
+
If your machines are on the same [Tailscale](https://tailscale.com/) tailnet, you can run Private Desktop MCP **without any Cloudflare account, domain, or pairing codes**:
|
|
117
|
+
|
|
118
|
+
1. **On each desktop you want to control**, run:
|
|
119
|
+
```bash
|
|
120
|
+
npx --yes --prefer-online --package=@juexibobi/private-desktop-mcp@latest -- private-desktop-mcp serve
|
|
121
|
+
```
|
|
122
|
+
- Automatically uses foreground `tailscale serve --https=8443` (valid Let's Encrypt cert at `https://<node>.<tailnet>.ts.net:8443/mcp`, torn down cleanly on Ctrl+C) or falls back to direct Tailnet IP (`--ts-direct`, `http://100.x.y.z:8718/mcp`).
|
|
123
|
+
- Enforces fail-closed Tailscale user identity (`Tailscale-User-Login` + `tailscale whois` — defaults strictly to your own Tailscale login so other users on a shared tailnet are rejected), plus the exact same `--readonly`, `--allow-dir`, self-credential guard, and outbound DLP as Cloudflare mode.
|
|
124
|
+
- Automatic proxy bypass in `bin/proxy.mjs` ensures `*.ts.net`, `100.64.0.0/10`, and `fd7a:115c:a1e0::/48` never break under Clash/system HTTP proxies.
|
|
125
|
+
|
|
126
|
+
2. **On the machine running your AI client (or a homelab/NAS)**, start the **Tailnet Mesh Hub**:
|
|
127
|
+
```bash
|
|
128
|
+
npx --yes --prefer-online --package=@juexibobi/private-desktop-mcp@latest -- private-desktop-mcp hub
|
|
129
|
+
```
|
|
130
|
+
- Automatically discovers all online same-user Tailscale peers running `private-desktop-mcp serve` (plus optional `--peer-tag tag:mcp-desktop`, static `--peer`, `--with-local`, and paired WebSocket relays).
|
|
131
|
+
- Exposes ONE unified Streamable HTTP MCP server (`http://127.0.0.1:8720/mcp`, or `https://<hub>.<tailnet>.ts.net:8443/mcp` with `--expose-tailscale`) with full `relay_list_devices`, `relay_select_device`, `relay_ping_device`, `relay_set_device_policy`, `_device` per-call routing (with isolated per-device upstream MCP sessions), `relay://*` resources, and audit logs.
|
|
132
|
+
- Configure your AI client in one command:
|
|
133
|
+
```bash
|
|
134
|
+
npx --yes @juexibobi/private-desktop-mcp@latest setup-client claude-code --hub --dry-run --json
|
|
135
|
+
```
|
|
136
|
+
|
|
91
137
|
## Current canonical endpoint
|
|
92
138
|
|
|
93
139
|
```text
|