11<p align =" center " >
2- <picture >
3- <source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fmysterysd%2Fnode-red-mcp%2Fmain%2Fpackage.json&query=%24.version&prefix=v&label=node-red-mcp&color=%238F00FF&style=for-the-badge&logo=nodered&logoColor=white">
4- <img alt="node-red-mcp" src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fmysterysd%2Fnode-red-mcp%2Fmain%2Fpackage.json&query=%24.version&prefix=v&label=node-red-mcp&color=%238F00FF&style=for-the-badge&logo=nodered&logoColor=black">
5- </picture >
2+ <img alt =" node-red-mcp " src =" docs/node-red-ai-mcp.png " width =" 100% " >
63</p >
74
85<div align =" center " >
1512
1613** A production-ready [ MCP] ( https://modelcontextprotocol.io ) server that connects AI assistants (Claude, Copilot, etc.) to the [ Node-RED] ( https://nodered.org/ ) Admin API.**
1714
18- Inspect flows, manage nodes, analyze graph topology, apply JSON patches, and rollback changes — all through natural language.
15+ Inspect flows, manage nodes, analyze graph topology, capture debug output, apply JSON patches, and rollback changes — all through natural language.
1916
2017</div >
2118
@@ -29,6 +26,7 @@ Inspect flows, manage nodes, analyze graph topology, apply JSON patches, and rol
2926- [ Configuration] ( #configuration )
3027- [ Authentication] ( #authentication )
3128- [ Usage] ( #usage )
29+ - [ Debug Capture] ( #debug-capture )
3230 - [ Transport Modes] ( #transport-modes )
3331- [ Tools Reference] ( #tools-reference )
3432 - [ Auth] ( #auth )
@@ -49,9 +47,10 @@ Inspect flows, manage nodes, analyze graph topology, apply JSON patches, and rol
4947## Features
5048
5149- 🚀 ** 3 Transport Modes** — stdio (default), SSE, streamable HTTP
52- - 🔌 ** 30 MCP Tools** — full coverage of flows, nodes, runtime, auth, inject, and graph analysis
50+ - 🔌 ** 31 MCP Tools** — full coverage of flows, nodes, runtime, auth, inject, graph analysis, and debug capture
5351- 📊 ** Graph Engine** — auto-builds directed acyclic graph (DAG) from flow topology, detects cycles, sources, sinks, and computes node categories
5452- 🔍 ** Semantic Search** — query flows by node name, type, topic, URL, or any metadata
53+ - 🐛 ** Live Debug Capture** — WebSocket-based capture of Node-RED debug output, combined with inject or standalone
5554- 🔧 ** JSON Patch** — RFC 6902 compliant patch engine for incremental flow edits
5655- 📸 ** Snapshots** — in-memory 20-entry ring buffer per flow for rollback
5756- 🔗 ** 6 Resources + 3 Prompts** — inspect runtime settings, diagnostics, flows, and get AI-assisted analysis
@@ -148,6 +147,23 @@ node-red-mcp sse
148147node-red-mcp streamableHttp
149148```
150149
150+ ### Debug Capture
151+
152+ Two tools provide real-time debug output capture via Node-RED WebSocket (` /comms ` ):
153+
154+ | Tool | Description |
155+ | ---| ---|
156+ | ` node-red-inject ` (with ` waitForDebug ` ) | Inject + capture — fires inject, listens, returns both result and debug messages in one call |
157+ | ` node-red-debug-listen ` | Standalone listener — connects, subscribes to ` debug ` , captures messages for N seconds with optional node/flow filtering |
158+
159+ ** Example** (one-call inject + verify):
160+ ```
161+ node-red-inject({ nodeId: "my-inject", waitForDebug: 5 })
162+ → { status: "injected", debug: [...], debugCount: 3 }
163+ ```
164+
165+ Both tools handle Node-RED's array-batched WebSocket format automatically.
166+
151167### Transport Modes
152168
153169| Mode | Protocol | Best For |
@@ -158,7 +174,7 @@ node-red-mcp streamableHttp
158174
159175## Tools Reference
160176
161- All 27 tools are registered with the MCP server. Each returns JSON output.
177+ All 31 tools are registered with the MCP server. Each returns JSON output.
162178
163179### Auth
164180
@@ -176,20 +192,21 @@ All 27 tools are registered with the MCP server. Each returns JSON output.
176192| ` node-red-runtime-get-diagnostics ` | Read runtime diagnostics |
177193| ` node-red-runtime-get-flow-state ` | Read runtime flow state |
178194| ` node-red-runtime-set-flow-state ` | Update runtime flow state |
195+ | ` node-red-debug-listen ` | Capture debug messages via WebSocket for a duration (optionally filtered by node/flow) |
179196
180197### Flows
181198
182199| Tool | Description |
183200| ---| ---|
184201| ` node-red-flows-list ` | List active flow tabs and metadata |
185202| ` node-red-flows-get ` | Get a single flow by id or label |
186- | ` node-red-flows-create ` | Create a new flow tab with nodes |
203+ | ` node-red-flows-create ` | Create a new flow tab with nodes (auto-generates IDs, remaps wires) |
187204| ` node-red-flows-update ` | Replace an existing flow tab |
188205| ` node-red-flows-patch ` | Apply JSON Patch (RFC 6902) operations to a flow |
189206| ` node-red-flows-delete ` | Delete a flow tab |
190207| ` node-red-flows-clone ` | Clone an existing flow tab |
191208| ` node-red-flows-rollback ` | Rollback a flow to a previous snapshot |
192- | ` node-red-inject ` | Trigger an inject node by its ID |
209+ | ` node-red-inject ` | Trigger an inject node by its ID (optionally ` waitForDebug ` to capture debug output in one call) |
193210
194211### Graph
195212
@@ -260,6 +277,7 @@ await client.installNode({ module: "node-red-contrib-something" });
260277
261278``` typescript
262279class NodeRedClient {
280+ baseUrl: string ; // Public getter (for WebSocket URL construction)
263281 constructor (options : ClientOptions );
264282
265283 // Auth
@@ -370,19 +388,19 @@ npm run prettier:fix
370388```
371389src/
372390├── config.ts # Centralized env var config (NODE_RED_URL, NODE_RED_TOKEN, MCP_SERVER_PORT)
373- ├── client/ # NodeRedClient — Admin API wrapper
391+ ├── client/ # NodeRedClient — Admin API wrapper (baseUrl public getter)
374392├── graph/ # Standalone graph engine (types, engine, search, patch)
375393├── tools/
376394│ ├── auth/ # get-scheme, login, revoke
377- │ ├── runtime/ # get-settings, get-diagnostics, get-flow-state, set-flow-state
395+ │ ├── runtime/ # get-settings, get-diagnostics, get-flow-state, set-flow-state, debug-listen
378396│ ├── flows/ # list, get, create, update, patch, delete, clone, rollback, inject
379397│ ├── graph/ # analyze, summary, visualize, dependencies, query, pack, export
380398│ └── nodes/ # list, install, get-module, toggle-module, remove-module, get-set, toggle-set
381399├── resources/ # 6 MCP resource handlers
382400├── prompts/ # 3 MCP prompt templates
383401├── server/ # McpServer factory
384402├── transports/ # stdio, SSE, streamableHttp
385- ├── __tests__/ # 58 unit tests
403+ ├── __tests__/ # 122 unit tests (15 files), 21 live integration tests
386404└── index.ts # CLI entry point
387405```
388406
0 commit comments