@node9/proxy 1.5.4 → 1.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.
Files changed (4) hide show
  1. package/README.md +70 -4
  2. package/dist/cli.js +493 -140
  3. package/dist/cli.mjs +491 -138
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -20,10 +20,10 @@ While others try to _guess_ if a prompt is malicious (Semantic Security), Node9
20
20
  | | |
21
21
  | ------------------------------------------------- | -------------------------------------------------- |
22
22
  | [💎 The Aha Moment](#-the-aha-moment) | [🌐 MCP Gateway](#-mcp-gateway) |
23
- | [⚡ Key Features](#-key-features) | [🔗 Config Precedence](#-configuration-precedence) |
24
- | [🎮 Try it Live](#-try-it-live) | [⚙️ Custom Rules](#️-custom-rules-advanced) |
25
- | [🚀 Quick Start](#-quick-start) | [🖥️ CLI Reference](#️-cli-reference) |
26
- | [🛡️ How Protection Works](#️-how-protection-works) | [🔧 Troubleshooting](#-troubleshooting) |
23
+ | [⚡ Key Features](#-key-features) | [🤖 MCP Server](#-node9-mcp-server) |
24
+ | [🎮 Try it Live](#-try-it-live) | [🔗 Config Precedence](#-configuration-precedence) |
25
+ | [🚀 Quick Start](#-quick-start) | [⚙️ Custom Rules](#️-custom-rules-advanced) |
26
+ | [🛡️ How Protection Works](#️-how-protection-works) | [🖥️ CLI Reference](#️-cli-reference) |
27
27
  | [🛠 Protection Modes](#-protection-modes) | [🗺️ Roadmap](#️-roadmap) |
28
28
 
29
29
  ---
@@ -359,6 +359,70 @@ When Node9 blocks an MCP tool call, it returns a structured JSON-RPC error that
359
359
 
360
360
  ---
361
361
 
362
+ ## 🤖 Node9 MCP Server
363
+
364
+ The Node9 MCP Server exposes node9 capabilities — starting with undo — as native MCP tools that Claude, Cursor, and Gemini can call directly. Unlike the MCP Gateway (which wraps _other_ servers), this server is node9's own surface.
365
+
366
+ ```
367
+ Claude / Cursor / Gemini (MCP client)
368
+ ↓ stdio (JSON-RPC 2.0)
369
+ Node9 MCP Server ← this process
370
+ ↓ direct function calls
371
+ ~/.node9/snapshots.json ← undo history
372
+ ```
373
+
374
+ ### Setup
375
+
376
+ The MCP server is registered **automatically** during `node9 init` or `node9 setup`. No separate step needed. What gets added to your agent config:
377
+
378
+ ```json
379
+ {
380
+ "mcpServers": {
381
+ "node9": {
382
+ "command": "node9",
383
+ "args": ["mcp-server"]
384
+ }
385
+ }
386
+ }
387
+ ```
388
+
389
+ ### Available Tools
390
+
391
+ | Tool | Description |
392
+ | :------------------ | :-------------------------------------------------------------------- |
393
+ | `node9_undo_list` | List snapshot history — hash, tool, summary, files changed, timestamp |
394
+ | `node9_undo_revert` | Revert the working directory to a specific snapshot hash |
395
+
396
+ ### Example — Claude using the MCP server
397
+
398
+ ```
399
+ You: revert the last change node9 captured
400
+
401
+ Claude: Let me check the snapshot history first.
402
+ [calls node9_undo_list]
403
+
404
+ [1] a3f2c1d 4/4/2026, 18:15 Write — src/undo.ts (3 files) cwd: /home/user/myproject
405
+ full hash: a3f2c1d8e9b0f1a2b3c4d5e6f7a8b9c0d1e2f3a4
406
+
407
+ I'll revert to snapshot a3f2c1d.
408
+ [calls node9_undo_revert with hash: "a3f2c1d8e9b0f1a2b3c4d5e6f7a8b9c0d1e2f3a4"]
409
+
410
+ Successfully reverted to snapshot a3f2c1d in /home/user/myproject.
411
+ ```
412
+
413
+ ### Manual testing
414
+
415
+ ```bash
416
+ npm run build
417
+ node dist/cli.js mcp-server
418
+ # paste JSON-RPC lines:
419
+ {"jsonrpc":"2.0","method":"initialize","id":1,"params":{"protocolVersion":"2024-11-05","clientInfo":{"name":"test"},"capabilities":{}}}
420
+ {"jsonrpc":"2.0","method":"tools/list","id":2}
421
+ {"jsonrpc":"2.0","method":"tools/call","id":3,"params":{"name":"node9_undo_list","arguments":{}}}
422
+ ```
423
+
424
+ ---
425
+
362
426
  ## 🔗 Configuration Precedence
363
427
 
364
428
  Node9 merges configuration from multiple sources in priority order. Higher tiers win:
@@ -582,6 +646,7 @@ When the daemon is not running the HUD shows `🛡 node9 | offline` instead of a
582
646
  | `node9 explain <tool> [args]` | Trace the policy waterfall for a given tool call (dry-run, no approval prompt) |
583
647
  | `node9 undo [--steps N]` | Revert the last N AI file edits using shadow Git snapshots |
584
648
  | `node9 mcp-gateway --upstream <cmd>` | Wrap an MCP server with Node9 security — intercepts every tool call |
649
+ | `node9 mcp-server` | Run the Node9 MCP server — exposes undo and other tools to Claude, Cursor, and Gemini |
585
650
  | `node9 check` | Called by agent hooks; evaluates a pending tool call and exits 0 (allow) or 1 (block) |
586
651
 
587
652
  ### `node9 doctor`
@@ -653,6 +718,7 @@ This can happen when the daemon's PID file (`~/.node9/daemon.pid`) is missing
653
718
  - [x] **Content Scanner / DLP** (Detect and block secrets like AWS keys and Bearer tokens in-flight)
654
719
  - [x] **Flight Recorder** (Real-time activity stream in browser dashboard and `node9 tail` terminal view)
655
720
  - [x] **Universal MCP Gateway** (Transparent stdio proxy — wraps any MCP server for any AI agent: `node9 mcp-gateway --upstream <cmd>`)
721
+ - [x] **Node9 MCP Server** (Native MCP tools for Claude/Cursor/Gemini: `node9_undo_list`, `node9_undo_revert` — auto-registered by `node9 init`)
656
722
  - [ ] **Cursor & Windsurf Hook** (Native hook support for AI-first IDEs)
657
723
  - [ ] **VS Code Extension** (Approval requests in a native sidebar — no more OS popups)
658
724
  - [ ] **Execution Sandboxing** (Simulate dangerous commands in a virtual FS before applying)