@node9/proxy 1.2.0 โ†’ 1.3.1

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 +138 -18
  2. package/dist/cli.js +312 -110
  3. package/dist/cli.mjs +308 -106
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -15,6 +15,19 @@ While others try to _guess_ if a prompt is malicious (Semantic Security), Node9
15
15
 
16
16
  ---
17
17
 
18
+ ## Contents
19
+
20
+ | | |
21
+ | ------------------------------------------------- | -------------------------------------------------- |
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) |
27
+ | [๐Ÿ›  Protection Modes](#-protection-modes) | [๐Ÿ—บ๏ธ Roadmap](#๏ธ-roadmap) |
28
+
29
+ ---
30
+
18
31
  ## ๐Ÿ’Ž The "Aha!" Moment
19
32
 
20
33
  **AIs are literal.** When you ask an agent to "Fix my disk space," it might decide to run `docker system prune -af`.
@@ -206,11 +219,117 @@ node9 shield status # see what's currently active
206
219
 
207
220
  ## ๐Ÿ›  Protection Modes
208
221
 
209
- | Mode | Target | How it works |
210
- | :-------------- | :--------------------- | :------------------------------------------------------ |
211
- | **Hook Mode** | Claude, Gemini, Cursor | `node9 addto <agent>` wires native pre-execution hooks. |
212
- | **Proxy Mode** | MCP Servers, Shell | `node9 "npx <server>"` intercepts JSON-RPC traffic. |
213
- | **Manual Mode** | You | `node9 rm -rf /` protects you from your own typos. |
222
+ | Mode | Target | How it works |
223
+ | :-------------- | :---------------------------- | :----------------------------------------------------------------------- |
224
+ | **Hook Mode** | Claude Code, Gemini, Cursor | `node9 addto <agent>` wires native pre-execution hooks. |
225
+ | **MCP Gateway** | Any MCP server, any AI client | `node9 mcp-gateway --upstream <cmd>` wraps any MCP server transparently. |
226
+ | **Manual Mode** | You | `node9 rm -rf /` protects you from your own typos. |
227
+
228
+ ---
229
+
230
+ ## ๐ŸŒ MCP Gateway
231
+
232
+ The MCP Gateway is a **transparent stdio proxy** that sits between any AI agent and any MCP server. The agent doesn't know Node9 is there โ€” it just sees the same MCP server it always did.
233
+
234
+ ```
235
+ AI Agent (Claude, Cursor, Geminiโ€ฆ)
236
+ โ†“ stdio (JSON-RPC)
237
+ Node9 MCP Gateway โ† intercepts every tools/call
238
+ โ†“ stdio (JSON-RPC)
239
+ Upstream MCP Server (filesystem, postgres, browserโ€ฆ)
240
+ ```
241
+
242
+ **Every `tools/call` is intercepted.** Read-only tools pass through silently. Write/mutate tools are routed through the full approval engine โ€” DLP scan, smart rules, shields, and human approval.
243
+
244
+ ### Setup
245
+
246
+ **1. Register any MCP server through the gateway:**
247
+
248
+ ```bash
249
+ # Filesystem server โ€” protect all file writes
250
+ claude mcp add filesystem -- node9 mcp-gateway --upstream \
251
+ "npx -y @modelcontextprotocol/server-filesystem /your/workspace"
252
+
253
+ # Any other MCP server โ€” same pattern
254
+ claude mcp add myserver -- node9 mcp-gateway --upstream \
255
+ "npx -y @some/mcp-server"
256
+ ```
257
+
258
+ **2. Add globally (all projects):**
259
+
260
+ ```bash
261
+ claude mcp add --scope user filesystem -- node9 mcp-gateway --upstream \
262
+ "npx -y @modelcontextprotocol/server-filesystem /home/you"
263
+ ```
264
+
265
+ **3. Share with your team via `.mcp.json` in the repo:**
266
+
267
+ ```json
268
+ {
269
+ "mcpServers": {
270
+ "filesystem": {
271
+ "command": "node9",
272
+ "args": ["mcp-gateway", "--upstream", "npx -y @modelcontextprotocol/server-filesystem ."]
273
+ }
274
+ }
275
+ }
276
+ ```
277
+
278
+ > **Note:** `--upstream` takes a single command string. The gateway's tokenizer splits it on whitespace and handles double-quoted paths (e.g. `"npx \"/path with spaces/server.js\""`) โ€” it does not run a shell.
279
+ >
280
+ > โš ๏ธ **Supply-chain warning:** `.mcp.json` files from untrusted repositories can specify any `--upstream` command. Always review `.mcp.json` before using it โ€” treat it with the same caution as a `Makefile` or `package.json` `postinstall` script.
281
+
282
+ ### What gets protected
283
+
284
+ The same `ignoredTools`, smart rules, shields, and DLP that protect hook-mode tools apply here โ€” but matched against **MCP tool names** (e.g. `write_file`, `execute_query`) instead of Claude's built-in tools.
285
+
286
+ **Tune your config for MCP tool names:**
287
+
288
+ ```json
289
+ {
290
+ "policy": {
291
+ "ignoredTools": ["read_file", "read_text_file", "list_*", "search_*"],
292
+ "toolInspection": {
293
+ "write_file": "content",
294
+ "execute_query": "sql",
295
+ "run_command": "command"
296
+ }
297
+ }
298
+ }
299
+ ```
300
+
301
+ **Add MCP-specific smart rules:**
302
+
303
+ ```json
304
+ {
305
+ "policy": {
306
+ "smartRules": [
307
+ {
308
+ "name": "block-write-production-config",
309
+ "tool": "write_file",
310
+ "conditions": [{ "field": "path", "op": "matches", "value": "/etc/|/prod/" }],
311
+ "verdict": "block",
312
+ "reason": "Writes to production config require a manual change process"
313
+ }
314
+ ]
315
+ }
316
+ }
317
+ ```
318
+
319
+ ### How blocked calls look to the AI
320
+
321
+ When Node9 blocks an MCP tool call, it returns a structured JSON-RPC error that tells the AI exactly what happened and instructs it to pivot:
322
+
323
+ ```json
324
+ {
325
+ "jsonrpc": "2.0",
326
+ "id": 42,
327
+ "error": {
328
+ "code": -32000,
329
+ "message": "NODE9 SECURITY ALERT: Action blocked by DLP โ€” credential detected in content field. Do NOT retry. Remove the hardcoded secret and use an environment variable instead."
330
+ }
331
+ }
332
+ ```
214
333
 
215
334
  ---
216
335
 
@@ -327,18 +446,19 @@ Use `node9 explain <tool> <args>` to dry-run any tool call and see exactly which
327
446
 
328
447
  ## ๐Ÿ–ฅ๏ธ CLI Reference
329
448
 
330
- | Command | Description |
331
- | :---------------------------- | :------------------------------------------------------------------------------------ |
332
- | `node9 setup` | Interactive menu โ€” detects installed agents and wires hooks for you |
333
- | `node9 addto <agent>` | Wire hooks for a specific agent (`claude`, `gemini`, `cursor`) |
334
- | `node9 init` | Create default `~/.node9/config.json` |
335
- | `node9 status` | Show current protection status and active rules |
336
- | `node9 doctor` | Health check โ€” verifies binaries, config, credentials, and all agent hooks |
337
- | `node9 shield <cmd>` | Manage shields (`enable`, `disable`, `list`, `status`) |
338
- | `node9 tail [--history]` | Stream live agent activity to the terminal (auto-starts daemon if needed) |
339
- | `node9 explain <tool> [args]` | Trace the policy waterfall for a given tool call (dry-run, no approval prompt) |
340
- | `node9 undo [--steps N]` | Revert the last N AI file edits using shadow Git snapshots |
341
- | `node9 check` | Called by agent hooks; evaluates a pending tool call and exits 0 (allow) or 1 (block) |
449
+ | Command | Description |
450
+ | :----------------------------------- | :------------------------------------------------------------------------------------ |
451
+ | `node9 setup` | Interactive menu โ€” detects installed agents and wires hooks for you |
452
+ | `node9 addto <agent>` | Wire hooks for a specific agent (`claude`, `gemini`, `cursor`) |
453
+ | `node9 init` | Create default `~/.node9/config.json` |
454
+ | `node9 status` | Show current protection status and active rules |
455
+ | `node9 doctor` | Health check โ€” verifies binaries, config, credentials, and all agent hooks |
456
+ | `node9 shield <cmd>` | Manage shields (`enable`, `disable`, `list`, `status`) |
457
+ | `node9 tail [--history]` | Stream live agent activity to the terminal (auto-starts daemon if needed) |
458
+ | `node9 explain <tool> [args]` | Trace the policy waterfall for a given tool call (dry-run, no approval prompt) |
459
+ | `node9 undo [--steps N]` | Revert the last N AI file edits using shadow Git snapshots |
460
+ | `node9 mcp-gateway --upstream <cmd>` | Wrap an MCP server with Node9 security โ€” intercepts every tool call |
461
+ | `node9 check` | Called by agent hooks; evaluates a pending tool call and exits 0 (allow) or 1 (block) |
342
462
 
343
463
  ### `node9 doctor`
344
464
 
@@ -408,7 +528,7 @@ This can happen when the daemon's PID file (`~/.node9/daemon.pid`) is missing
408
528
  - [x] **Shield Templates** (`node9 shield enable <service>` โ€” one-click protection for Postgres, GitHub, AWS)
409
529
  - [x] **Content Scanner / DLP** (Detect and block secrets like AWS keys and Bearer tokens in-flight)
410
530
  - [x] **Flight Recorder** (Real-time activity stream in browser dashboard and `node9 tail` terminal view)
411
- - [ ] **Universal MCP Gateway** (Standalone security tunnel for LangChain, CrewAI, and any agent without native hooks)
531
+ - [x] **Universal MCP Gateway** (Transparent stdio proxy โ€” wraps any MCP server for any AI agent: `node9 mcp-gateway --upstream <cmd>`)
412
532
  - [ ] **Cursor & Windsurf Hook** (Native hook support for AI-first IDEs)
413
533
  - [ ] **VS Code Extension** (Approval requests in a native sidebar โ€” no more OS popups)
414
534
  - [ ] **Execution Sandboxing** (Simulate dangerous commands in a virtual FS before applying)