@juexibobi/private-desktop-mcp 0.3.6 → 0.4.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/README.md +79 -33
- package/bin/cli.mjs +888 -136
- package/bin/policy.mjs +286 -0
- package/bin/proxy.mjs +173 -45
- package/gateway.mjs +231 -33
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Private Desktop MCP
|
|
2
2
|
|
|
3
|
-
Self-hosted multi-device [Model Context Protocol](https://modelcontextprotocol.io/) bridge for Desktop Commander using Cloudflare Workers, Durable Objects and a one-command
|
|
3
|
+
Self-hosted multi-device [Model Context Protocol](https://modelcontextprotocol.io/) bridge for Desktop Commander (and optional additional local MCP servers) using Cloudflare Workers, SQLite-backed Durable Objects, and a one-command cross-platform connector.
|
|
4
4
|
|
|
5
|
-
**Transport:** Streamable HTTP to
|
|
5
|
+
**Transport:** Streamable HTTP (`POST` + `DELETE`, supporting both MCP `2025-*` and stateless `2026-07-28`) to AI clients; outgoing WebSocket with zero-cost hibernation heartbeat from each device to the relay.
|
|
6
6
|
|
|
7
7
|
## Public npm release
|
|
8
8
|
|
|
@@ -12,59 +12,105 @@ npx.cmd --yes --prefer-online --package=@juexibobi/private-desktop-mcp@latest --
|
|
|
12
12
|
|
|
13
13
|
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.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
## What's new in v0.4.0
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
### Security & Governance
|
|
18
|
+
- **Cryptographic Cloudflare Access JWT verification (`worker/auth.mjs`)**: Verifies RS256 signatures against `https://<team>.cloudflareaccess.com/cdn-cgi/access/certs` (with automatic `kid` key-rotation refresh), `aud`, `iss`, `exp`, and `nbf`. Fails closed if unconfigured (with an explicit temporary `ALLOW_UNVERIFIED_ACCESS_HEADER=true` migration opt-in).
|
|
19
|
+
- **Hardened local gateway (`gateway.mjs`)**: Enforces per-launch ephemeral Bearer authentication (`MCP_LOCAL_TOKEN`), loopback `Host` validation (anti-DNS-rebinding), and browser `Origin` rejection (anti-CSRF).
|
|
20
|
+
- **Local policy guardrails (`bin/policy.mjs`)**:
|
|
21
|
+
- `--readonly` (or `PCC_READONLY=1`): allows read-only tools only and hides mutating tools from `tools/list`.
|
|
22
|
+
- `--allow-dir <dir>` (repeatable, or `PCC_ALLOW_DIRS`): jails file tool paths to allowed directories (resolving symlinks and blocking `..` traversal).
|
|
23
|
+
- `--allow-tools <csv>` / `--deny-tools <csv>`: explicit tool allowlist/denylist.
|
|
24
|
+
- Always blocks remote access to the connector's own credential directory (`PrivateDesktopMCP/device.json`).
|
|
25
|
+
- **Outbound DLP secret redaction (enabled by default, `--no-dlp` to opt out)**: Redacts PEM private keys, AWS/GitHub/OpenAI/Slack/Google tokens, and the active device/gateway bearer tokens from tool responses before sending them back to the cloud LLM.
|
|
26
|
+
- **Edge read-only lock & emergency kill-switch**: Toggle per-device read-only lock or revoke all devices at once from `/admin/devices`.
|
|
27
|
+
- **Removed hardcoded diagnostic file path**: `/relay/diagnostic` now permits read-only MCP introspection methods only.
|
|
18
28
|
|
|
19
|
-
|
|
29
|
+
### Reliability & Multi-Device Experience
|
|
30
|
+
- **Zero-cost WebSocket hibernation heartbeat**: Durable Object `setWebSocketAutoResponse("ping", "pong")` paired with a 25s client heartbeat watchdog detects half-open sockets after OS sleep or Wi-Fi switches without waking hibernated DOs.
|
|
31
|
+
- **Fixed reconnect backoff & jitter**: Resets exponential backoff once a session stays healthy and applies random jitter.
|
|
32
|
+
- **Local gateway auto-recovery & fast-fail**: Supervises the local `gateway.mjs` child process, immediately fails in-flight calls if it exits unexpectedly, and restarts it automatically with bounded backoff.
|
|
33
|
+
- **In-chat multi-device meta-tools**: Built-in `relay_list_devices`, `relay_select_device`, `relay_ping_device`, and `relay_recent_activity` tools let AI clients inspect online machines, switch targets, measure RTT latency, and view sanitized metadata audit logs without leaving chat. Individual tool calls can also target a specific machine via `_device` argument or `X-Target-Device` header.
|
|
34
|
+
- **SQLite audit log & upgraded admin dashboard**: Uses Durable Object SQLite (`audit_logs`) to record metadata-only call history (never file contents or command output), plus device platform, CLI version, mode, rename, read-only toggle, and revoke-all controls.
|
|
35
|
+
- **Streamable HTTP improvements**: Forwards `DELETE /mcp` session teardown and propagates client `AbortSignal` cancellations (`{ kind: "cancel" }`) all the way to the local gateway.
|
|
36
|
+
- **Optional multi-MCP aggregation**: Pass `--servers <config.json>` (or `PCC_MCP_CONFIG`, see [client-configs/servers.example.json](client-configs/servers.example.json)) to aggregate additional local stdio MCP servers under `<server>__<tool>` namespaces alongside Desktop Commander.
|
|
37
|
+
- **Upgraded Desktop Commander**: Bumped `@wonderwhy-er/desktop-commander` to `0.3.4` (security patches, Windows process-tree termination, lazy PDF/Office loading, explicit MCP tool annotations).
|
|
38
|
+
- **Diagnostics & cross-platform proxy**: Added `doctor` and `report` CLI subcommands, macOS `scutil --proxy` autodetection alongside Windows WinINET, rotating user-private gateway logs (`PrivateDesktopMCP/logs/gateway.log`), and `--relay`/`--port`/`--name` overrides for clean self-hosting.
|
|
20
39
|
|
|
21
|
-
|
|
40
|
+
## Terminal logging
|
|
22
41
|
|
|
23
|
-
PCC
|
|
42
|
+
PCC uses **TRACE logging by default**. The normal `connect` command prints MCP call IDs, sanitized/truncated command and response previews, timings, connection details, and errors.
|
|
24
43
|
|
|
25
|
-
|
|
44
|
+
**Privacy:** TRACE can reveal sensitive file contents or command output locally in your terminal. Redaction is best effort; avoid sharing or recording the terminal. Use `--debug` for detailed metadata without content previews, or `--safe` for compact logs. The child gateway log is stored in the user-private `PrivateDesktopMCP/logs/gateway.log` directory and rotates automatically at 5 MB.
|
|
26
45
|
|
|
27
|
-
|
|
46
|
+
## System proxy detection (Windows & macOS)
|
|
28
47
|
|
|
29
|
-
|
|
48
|
+
- **Windows**: Automatically uses the current user's effective WinINET system proxy (static HTTP/Mixed proxies, bypass rules, PAC/WPAD).
|
|
49
|
+
- **macOS**: Automatically queries `scutil --proxy` (HTTPS/HTTP proxies and `ExceptionsList`).
|
|
50
|
+
- **Environment override**: Explicit `HTTPS_PROXY`, `HTTP_PROXY`, or `ALL_PROXY` settings take precedence on all platforms (`NO_PROXY` respected). Supported proxy transport is HTTP/HTTPS CONNECT.
|
|
51
|
+
|
|
52
|
+
## CLI commands & flags
|
|
53
|
+
|
|
54
|
+
```powershell
|
|
55
|
+
# Connect (default)
|
|
56
|
+
private-desktop-mcp connect
|
|
57
|
+
|
|
58
|
+
# Safe read-only mode jailed to a workspace directory
|
|
59
|
+
private-desktop-mcp connect --readonly --allow-dir C:\workspace
|
|
60
|
+
|
|
61
|
+
# Connect to your own self-hosted Cloudflare Worker
|
|
62
|
+
private-desktop-mcp connect --relay https://my-relay.example.workers.dev --name WorkPC
|
|
63
|
+
|
|
64
|
+
# Aggregate extra local MCP servers alongside Desktop Commander
|
|
65
|
+
private-desktop-mcp connect --servers ./client-configs/servers.example.json
|
|
66
|
+
|
|
67
|
+
# Diagnostics & status
|
|
68
|
+
private-desktop-mcp doctor
|
|
69
|
+
private-desktop-mcp report
|
|
70
|
+
private-desktop-mcp status
|
|
71
|
+
private-desktop-mcp reset
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Current canonical endpoint
|
|
30
75
|
|
|
31
76
|
```text
|
|
32
77
|
https://private-desktop-device-relay.ljx2043979076.workers.dev/mcp
|
|
33
78
|
```
|
|
34
79
|
|
|
35
|
-
|
|
80
|
+
Client configuration templates are available in `.mcp.json` and `client-configs/` (`vscode-mcp.json`, `mcpServers.json`, `cursor-mcp.json`, `codex.toml.example`).
|
|
36
81
|
|
|
37
82
|
## Pairing devices
|
|
38
83
|
|
|
39
|
-
1. On a
|
|
40
|
-
2. The first run prints an expiring pairing code and
|
|
41
|
-
3. Sign into Cloudflare Access and approve the **matching code** in
|
|
42
|
-
4. The device saves
|
|
43
|
-
5. Leave the terminal open while using tools. Press **Ctrl+C** to disconnect. No startup tasks or
|
|
44
|
-
6.
|
|
45
|
-
|
|
46
|
-
If multiple devices are online, select the intended one at the admin page. The relay must never route to an arbitrary device when the target is ambiguous.
|
|
84
|
+
1. On a machine with Node.js 20.18.1+ run `private-desktop-mcp connect`.
|
|
85
|
+
2. The first run prints an expiring pairing code and opens (or prints) the Access-protected approval URL.
|
|
86
|
+
3. Sign into Cloudflare Access and approve the **matching code** in `/admin/devices`.
|
|
87
|
+
4. The device saves its scoped credential in `PrivateDesktopMCP/device.json` and connects via WebSocket. Never commit or share that credential.
|
|
88
|
+
5. Leave the terminal open while using tools. Press **Ctrl+C** to disconnect. No startup tasks or system services are installed.
|
|
89
|
+
6. With multiple devices online, switch devices directly in chat via `relay_list_devices` / `relay_select_device`, pass `_device: "<name>"` on a tool call, or select one at `/admin/devices`.
|
|
47
90
|
|
|
48
|
-
##
|
|
91
|
+
## Cloudflare deployment & self-hosting
|
|
49
92
|
|
|
50
|
-
|
|
93
|
+
The Worker source is in `worker/index.mjs` and `worker/auth.mjs`. Infrastructure is described in `wrangler.toml`.
|
|
51
94
|
|
|
52
|
-
|
|
95
|
+
1. Configure a Cloudflare Access self-hosted application protecting `/mcp` and `/admin/*` with an Owner-only policy. Never protect `/relay/*` with Access (otherwise device WebSocket connections are blocked).
|
|
96
|
+
2. Configure cryptographic Access JWT verification on the Worker before deploying:
|
|
53
97
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
98
|
+
```bash
|
|
99
|
+
wrangler secret put CF_ACCESS_TEAM_DOMAIN # e.g. https://your-team.cloudflareaccess.com
|
|
100
|
+
wrangler secret put CF_ACCESS_AUD # Access application AUD tag
|
|
101
|
+
```
|
|
57
102
|
|
|
58
|
-
|
|
103
|
+
3. For self-hosted custom domains/workers, optionally configure `SHARED_HOSTS`, `ALLOWED_OWNER_HOSTS`, `ALLOWED_RELAY_HOSTS`, and `PUBLIC_BASE_URL` (see comments in `wrangler.toml`).
|
|
104
|
+
4. Deploy with `wrangler deploy`.
|
|
59
105
|
|
|
60
|
-
##
|
|
106
|
+
## Running from source
|
|
61
107
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
108
|
+
```bash
|
|
109
|
+
npm install
|
|
110
|
+
npm test
|
|
111
|
+
node bin/cli.mjs connect
|
|
112
|
+
```
|
|
67
113
|
|
|
68
114
|
## Security
|
|
69
115
|
|
|
70
|
-
This tool
|
|
116
|
+
This tool provides remote filesystem and command-execution capabilities. Restrict Cloudflare Access to your own identity, configure `CF_ACCESS_TEAM_DOMAIN` + `CF_ACCESS_AUD`, approve only devices you control, and consider running `--readonly` or `--allow-dir` for day-to-day workflows. See [SECURITY.md](SECURITY.md).
|