node-red-mcp
Provides tools for managing Node-RED flows and nodes, including creating, reading, updating, deleting flows, adding/removing/rewiring nodes, capturing debug output, and analyzing graph topology.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@node-red-mcp list all flows and their node counts"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
A production-ready MCP server that connects AI assistants (Claude, Copilot, etc.) to the Node-RED Admin API.
Inspect flows, manage nodes, analyze graph topology, capture debug output, apply JSON patches, and rollback changes ā all through natural language.
Architecture
graph TB
subgraph "AI Client"
A[Claude Desktop]
B[VS Code MCP]
C[Custom Client]
end
subgraph "MCP Server @mysterysd/node-red-mcp"
direction LR
T[Transport Layer<br/>stdio / SSE / streamableHttp]
S[Server Factory<br/>McpServer]
T --> S
S --> Tools[38 Tools<br/>flows / nodes / graph / auth / runtime]
S --> Res[7 Resources<br/>settings / flows / graph / registry]
S --> Prompts[3 Prompts<br/>analyze / repair / refactor]
Tools --> GE[Graph Engine<br/>DAG analysis / cycles / search]
Tools --> NR[Node Registry<br/>persistent name-to-ID lookup]
Tools --> Snap[Snapshots<br/>20-deep ring buffer per flow]
Tools --> Debug[Debug Capture<br/>WebSocket /comms]
end
subgraph "Node-RED Instance"
NR_API[Admin REST API<br/>:1880]
NR_WS[WebSocket<br/>:1880/comms]
end
A & B & C -->|MCP Protocol| T
S -->|axios| NR_API
Debug -->|ws| NR_WSRelated MCP server: node-red-contrib-mcp-server
Data Flow
sequenceDiagram
participant AI as AI Assistant
participant MCP as node-red-mcp
participant NR as Node-RED
AI->>MCP: flows-create(label, nodes)
MCP->>MCP: auto-generate node IDs
MCP->>MCP: auto-layout positions
MCP->>NR: POST /flow
NR-->>MCP: { id, rev }
MCP->>MCP: refresh NodeRegistry
MCP-->>AI: { status, flowId }
AI->>MCP: flows-add-node(flowId, node)
MCP->>NR: GET /flow/:id
MCP->>MCP: snapshot current state
MCP->>MCP: append node, validate wires
MCP->>NR: PUT /flow/:id
MCP->>MCP: refresh NodeRegistry
MCP-->>AI: { status, nodeId }
AI->>MCP: nodes-resolve(query)
MCP->>MCP: lookup in NodeRegistry
MCP-->>AI: { matches: [...] }Features
š 3 Transport Modes ā stdio (default), SSE, streamable HTTP
š 38 MCP Tools ā full coverage of flows, nodes, runtime, auth, inject, graph analysis, and debug capture
š§© 5 Node-Level Mutation Tools ā add, remove, update, rewire, and move individual nodes without rewriting entire flows
š Graph Engine ā auto-builds directed acyclic graph (DAG) from flow topology, detects cycles, sources, sinks, and computes node categories
šļø Node Registry ā persistent, auto-synced hot DB for looking up node IDs by name, type, label, and flow
š Semantic Search ā query flows by node name, type, topic, URL, or any metadata
š Live Debug Capture ā WebSocket-based capture of Node-RED debug output, combined with inject or standalone
š§ JSON Patch ā RFC 6902 compliant patch engine for incremental flow edits
šø Snapshots ā in-memory 20-entry ring buffer per flow for rollback
š 7 Resources + 3 Prompts ā inspect runtime settings, diagnostics, flows, graph, registry, and get AI-assisted analysis
Table of Contents
Installation
npm install -g @mysterysd/node-red-mcpOr run directly without installing:
npx @mysterysd/node-red-mcpPrerequisites
Node.js >= 18
Node-RED instance running with the Admin API enabled (default:
http://localhost:1880)
Quick Start
# 1. Set your Node-RED URL (default: http://localhost:1880)
export NODE_RED_URL=http://my-nodered:1880
# 2. Start the MCP server in stdio mode
npx @mysterysd/node-red-mcpThen configure your MCP client:
The server auto-refreshes the Node Registry on startup, so all your nodes are immediately searchable by name.
Claude Desktop / VS Code
{
"mcpServers": {
"node-red": {
"command": "npx",
"args": ["@mysterysd/node-red-mcp"],
"env": {
"NODE_RED_URL": "http://localhost:1880",
"NODE_RED_ACCESS_TOKEN": "your-token"
}
}
}
}opencode
{
"mcpServers": {
"node-red": {
"command": "node",
"args": ["path/to/dist/index.js", "stdio"],
"env": {
"NODE_RED_URL": "http://localhost:1880"
}
}
}
}Configuration
All configuration is via environment variables:
Variable | Default | Description |
|
| Base URL of the Node-RED Admin API |
| ā | Bearer token for API auth (takes precedence over |
| ā | Alternative name for the bearer token |
| ā | Username for password-based auth |
| ā | Password for password-based auth |
|
| HTTP server port for HTTP transports |
|
| Fallback port (overridden by |
|
| File path for persistent Node Registry |
Copy.env.example to .env as a reference for all available environment variables.
Authentication
The server supports two auth methods:
Token-based (recommended):
export NODE_RED_TOKEN="your-bearer-token"Password-based (auto-login on first request):
export NODE_RED_USERNAME="admin" export NODE_RED_PASSWORD="your-password"
If neither is set, the server will attempt unauthenticated requests (Node-RED's default for local-only deployments).
Avoid usingNODE_RED_TOKEN in shared or version-controlled config files. Use environment-specific secrets whenever possible.
Usage
# stdio mode (default ā for Claude Desktop, VS Code, etc.)
node-red-mcp
node-red-mcp stdio
# SSE mode (HTTP server on :3001)
node-red-mcp sse
# Streamable HTTP mode (HTTP server on :3002)
node-red-mcp streamableHttpTransport Modes
Mode | Protocol | Best For |
| stdin/stdout JSON-RPC | Claude Desktop, VS Code MCP extensions |
| Server-Sent Events | Remote or containerized setups |
| HTTP POST + DELETE | Stateless proxies, load-balanced deployments |
Debug Capture
Two tools provide real-time debug output capture via Node-RED WebSocket (/comms):
Tool | Description |
| Inject + capture ā fires inject, listens, returns both result and debug messages in one call |
| Standalone listener ā connects, subscribes to |
Example (one-call inject + verify):
// node-red-inject({ nodeId: "my-inject", waitForDebug: 5 })
ā { status: "injected", debug: [...], debugCount: 3 }Both tools handle Node-RED's array-batched WebSocket format automatically.
Tools Reference
All 38 tools are registered with the MCP server. Each returns JSON output.
Auth
Tool | Description |
| Inspect the active Node-RED admin auth scheme |
| Exchange credentials for a bearer token |
| Revoke an existing bearer token |
Runtime
Tool | Description |
| Read runtime settings |
| Read runtime diagnostics |
| Read runtime flow state |
| Update runtime flow state |
| Capture debug messages via WebSocket for a duration (optionally filtered by node/flow) |
Flows
Tool | Description |
| List active flow tabs and metadata |
| Get a single flow by id or label |
| Create a new flow tab with nodes (auto-generates IDs, auto-layouts positions, remaps wires) |
| Replace an existing flow tab (auto-layouts positions) |
| Apply JSON Patch (RFC 6902) operations to a flow |
| Delete a flow tab |
| Clone an existing flow tab |
| Rollback a flow to a previous snapshot |
| Trigger an inject node by its ID (optionally |
Node-Level Mutations
Tool | Description |
| Add a single node to an existing flow tab. Auto-generates ID if omitted, validates wire targets, positions intelligently. |
| Remove a single node from a flow tab. Cleans up wire references from all remaining nodes. |
| Update specific properties of a single node by ID. Deep-merges the provided properties onto the existing node. Reports which keys changed. |
| Replace all wire connections for a specific node. Validates all target IDs exist in the flow. |
| Move a single node to a specific visual position (x, y) within a flow tab. |
Graph
Tool | Description |
| Analyze topology, dependencies, and graph health |
| Summary statistics and risk assessment |
| Generate a human-readable graph view |
| Resolve upstream and downstream dependencies for a node |
| Search nodes by semantic query |
| Context pack for semantic search with neighbor expansion |
| Export the full flow graph in serializable format |
Nodes
Tool | Description |
| List installed node modules and node sets |
| Install a node module from npm |
| Inspect a specific node module |
| Enable or disable a node module |
| Remove a node module |
| Inspect a specific node set within a module |
| Enable or disable a node set |
| Look up node IDs by name, type, description, or flow label using the Node Registry |
Resources
URI | Description |
| Current runtime settings (JSON) |
| Runtime diagnostics (JSON) |
| All active flows (raw JSON) |
| All installed nodes (JSON) |
| Full graph snapshot (serializable format) |
| Single flow by ID (template) |
| Node Registry snapshot ā all indexed nodes with names, types, flow labels, and categories |
Prompts
Prompt | Description |
| Analyze a flow for risks, dependencies, and graph structure |
| Draft a repair plan for invalid or broken flow wiring |
| Suggest a graph-aware refactor plan for a flow |
Node Registry
The Node Registry is a persistent, auto-synced hot database that indexes every node across all flows.
graph LR
subgraph "Node Registry"
NR[(registry.json)]
L[lookupInRegistry]
GF[getRegistryForFlow]
GS[getRegistrySnapshot]
end
MC[flows-create] -->|refresh| NR
MU[5 Mutation Tools] -->|refresh| NR
FU[flows-update] -->|refresh| NR
ST[Server Start] -->|initial load| NR
NR -->|query| RS[nodes-resolve tool]
NR -->|expose| RES[node-red://registry resource]How it works
Startup:
refreshRegistry(client)fetches all flows via Admin API and builds an indexPersistence: Index saved to
NODE_REGISTRY_PATH(default:./node-registry.json) as JSONAuto-sync: Every mutation tool (add, remove, update, rewire, move) and flows-create/update triggers a refresh
Lookup: Search by name, type, ID, or flow label with fuzzy matching and result ranking
Categories: Each node is categorized as
source,debug,transform,network,messaging,storage,template,dashboard,config, orother
Example query:
// nodes-resolve({ query: "Temperature", flowLabel: "Factory Floor" })
ā {
"matches": [
{ "id": "abc123", "type": "inject", "name": "Temperature Sensor",
"flowId": "...", "flowLabel": "Factory Floor", "category": "source" }
]
}Client Library
The client library (src/client/index.ts) provides a standalone NodeRedClient class you can use programmatically:
import { NodeRedClient } from "@mysterysd/node-red-mcp/client";
const client = new NodeRedClient({
baseUrl: "http://localhost:1880",
accessToken: process.env.NODE_RED_ACCESS_TOKEN,
});
// List all flows
const flows = await client.getFlows();
// Get a specific flow
const flow = await client.getFlow("flow-id");
// Install a node
await client.installNode({ module: "node-red-contrib-something" });API
class NodeRedClient {
baseUrl: string; // Public getter (for WebSocket URL construction)
constructor(options: ClientOptions);
// Auth
getAuthScheme(): Promise<AuthScheme>;
login(credentials?: AuthCredentials): Promise<TokenResponse>;
revoke(token?: string): Promise<unknown>;
// Runtime
getSettings(): Promise<Record<string, unknown>>;
getDiagnostics(): Promise<Record<string, unknown>>;
getFlowState(): Promise<unknown>;
setFlowState(state: unknown): Promise<unknown>;
// Flows
getFlows(): Promise<FlowsResponse>;
getFlow(id: string): Promise<FlowDocument>;
createFlow(flow: FlowDocument): Promise<FlowDocument>;
updateFlow(id: string, flow: FlowDocument): Promise<FlowDocument>;
deleteFlow(id: string): Promise<unknown>;
// Nodes
listNodes(): Promise<unknown>;
installNode(payload: Record<string, unknown>): Promise<unknown>;
getNodeModule(module: string): Promise<unknown>;
toggleNodeModule(module: string, enabled: boolean): Promise<unknown>;
removeNodeModule(module: string): Promise<unknown>;
getNodeSet(module: string, set: string): Promise<unknown>;
toggleNodeSet(module: string, set: string, enabled: boolean): Promise<unknown>;
// Inject
inject(nodeId: string): Promise<unknown>;
}Graph Engine
The graph engine (src/graph/) is a standalone library for building and analyzing Node-RED flow topologies:
import { buildGraph, formatGraph } from "@mysterysd/node-red-mcp/graph/engine";
import { queryGraph } from "@mysterysd/node-red-mcp/graph/search";
import { applyPatch } from "@mysterysd/node-red-mcp/graph/patch";graph TD
RAW[Raw Flows<br/>from Admin API] --> BG[buildGraph]
BG --> FG[FlowGraph]
FG --> VA[graph-analyze]
FG --> VS[graph-visualize]
FG --> DP[graph-dependencies]
FG --> QY[queryGraph<br/>semantic search]
FG --> PK[graph-pack<br/>context pack]
FG --> SM[summarizeGraph]
FG --> EX[graph-export]Graph Types
interface FlowGraph {
rev: string;
tabs: FlowTab[];
nodes: FlowNode[];
nodeById: Map<string, FlowNode>;
adjacency: Map<string, string[]>; // forward edges
reverseAdjacency: Map<string, Set<string>>; // backward edges
edges: GraphEdge[];
sources: string[]; // nodes with 0 in-degree
sinks: string[]; // nodes with 0 out-degree
cycles: string[][]; // detected cycles
categories: Map<string, NodeCategory>;
}Functions
Function | Description |
| Build a |
| Classify node as source, debug, transform, subflow, config, dashboard, or other |
| Check if a node is a config node (no position, no wires) |
| BFS/DFS from a start node to collect all reachable nodes |
| Convert graph to plain JSON-safe format |
| Produce a human-readable topology view |
| Detect all cycles in a directed graph |
| Build a searchable text index over all nodes |
| Search nodes by semantic query (returns scored results) |
| Find matching nodes + expand to neighbors |
| Generate a summary with counts, categories, risky nodes |
| Apply RFC 6902 JSON Patch operations |
Development
# Clone and install
git clone https://github.com/mysterysd/node-red-mcp.git
cd node-red-mcp
npm install
# Build
npm run build
# Watch mode
npm run watch
# Test (with coverage)
npm test
# Lint
npm run prettier:check
npm run prettier:fixProject Structure
src/
āāā config.ts # Centralized env var config
āāā client/ # NodeRedClient ā Admin API wrapper
āāā graph/ # Graph engine (types, engine, search, patch, registry)
ā āāā registry.ts # NodeRegistry ā persistent name-to-ID hot DB
āāā tools/
ā āāā auth/ # 3 tools: get-scheme, login, revoke
ā āāā runtime/ # 5 tools: settings, diagnostics, flow-state, debug-listen
ā āāā flows/ # 14 tools: list, get, create, update, patch, delete, clone,
ā ā # rollback, inject, add-node, remove-node, update-node,
ā ā # rewire-node, move-node
ā ā āāā mutation-utils.ts # Shared mutateFlow() utility
ā āāā graph/ # 7 tools: analyze, summary, visualize, dependencies,
ā ā # query, pack, export
ā āāā nodes/ # 8 tools: list, install, get-module, toggle-module,
ā # remove-module, get-set, toggle-set, resolve
āāā resources/ # 7 MCP resource handlers (incl. registry)
āāā prompts/ # 3 MCP prompt templates
āāā server/ # McpServer factory
āāā transports/ # stdio, SSE, streamableHttp
āāā __tests__/ # 171 unit tests (17 files)
āāā index.ts # CLI entry pointTest Stats
171 unit tests across 17 test files
~77% overall coverage (core modules at 100%)
25 integration tests against live Node-RED
Coverage includes: all 5 mutation tools (94ā100%), registry (90%), resolve (100%)
Docker
FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:20-alpine AS production
WORKDIR /app
COPY --from=build /app/dist ./dist
COPY --from=build /app/package*.json ./
RUN npm ci --omit=dev
EXPOSE 3002
ENV NODE_RED_URL=http://nodered:1880
CMD ["node", "dist/index.js", "streamableHttp"]Build and run:
docker build -t node-red-mcp .
docker run -e NODE_RED_URL=http://host.docker.internal:1880 -p 3002:3002 node-red-mcpLicense
MIT Ā© Mystery SD
Available Tools
37 toolsnode-red-auth-get-schemeGet Auth SchemeA
Inspect the active Node-RED admin auth scheme
Inputs: no named parameters.
node-red-auth-loginLoginC
Exchange Node-RED credentials for a bearer token
Inputs: scope, password, username, client_id, +1 more.
node-red-auth-revokeRevoke TokenC
Revoke a Node-RED bearer token
Inputs: token.
node-red-debug-listenListen DebugC
Capture Node-RED debug messages via WebSocket for a specified duration
Inputs: flowId, nodeId, duration.
node-red-flows-add-nodeAdd Node to FlowA
Add a single node to an existing flow tab. Auto-generates ID if omitted, validates wire targets, and positions the new node.
Inputs: node (required), flowId (required), expectedRev.
node-red-flows-cloneClone FlowC
Clone an existing flow tab
Inputs: sourceId (required), label.
node-red-flows-createCreate FlowC
Create a new flow tab in Node-RED
Inputs: label (required), nodes (required), configs, subflows.
node-red-flows-deleteDelete FlowC
Delete a flow tab from Node-RED
Inputs: id (required).
node-red-flows-getGet FlowB
Get a single flow tab by id or label
Inputs: idOrLabel (required).
node-red-flows-listList FlowsB
List active flow tabs and metadata from Node-RED
Inputs: no named parameters.
node-red-flows-move-nodeMove NodeA
Move a single node to a specific visual position (x, y) within a flow tab.
Inputs: x (required), y (required), flowId (required), nodeId (required), +1 more.
node-red-flows-patchPatch FlowC
Apply JSON patch operations to a flow tab
Inputs: id (required), operations (required), expectedRev.
node-red-flows-remove-nodeRemove Node from FlowA
Remove a single node from a flow tab. Cleans up wire references from all remaining nodes.
Inputs: flowId (required), nodeId (required), expectedRev.
node-red-flows-rewire-nodeRewire NodeA
Replace wire connections for a specific node in a flow tab. Validates all target IDs exist in the flow.
Inputs: wires (required), flowId (required), nodeId (required), expectedRev.
node-red-flows-rollbackRollback FlowC
Rollback a flow tab to a previous snapshot
Inputs: id (required), snapshotIndex.
node-red-flows-updateUpdate FlowC
Replace a flow tab with a new document
Inputs: id (required), nodes (required), label, expectedRev.
node-red-flows-update-nodeUpdate NodeA
Update specific properties of a single node in a flow tab. Deep-merges the provided properties onto the existing node.
Inputs: flowId (required), nodeId (required), properties (required), expectedRev.
node-red-graph-analyzeAnalyze FlowA
Analyze topology, dependencies, and graph health for a flow or all flows
Inputs: id.
node-red-graph-dependenciesGraph DependenciesC
Resolve upstream and downstream dependencies for a node
Inputs: flowId (required), nodeId (required).
node-red-graph-exportExport FlowsC
Export the full flow graph (raw or normalized)
Inputs: format.
node-red-graph-packGraph PackC
Return a compact context pack with semantic search and neighborhood expansion
Inputs: query (required), flowId, maxMatches, maxNeighbors.
node-red-graph-queryQuery GraphB
Semantic search across node names, types, labels, and properties
Inputs: query (required), flowId.
node-red-graph-summaryFlow SummaryC
Return a compact semantic summary for a flow or the whole runtime
Inputs: flowId.
node-red-graph-visualizeVisualize GraphC
Generate a readable graph topology view
Inputs: flowId.
node-red-injectInjectB
Trigger an inject node by its ID. Optionally capture debug output.
Inputs: nodeId (required), waitForDebug.
node-red-nodes-get-moduleGet Node ModuleC
Inspect a node module's details
Inputs: module (required).
node-red-nodes-get-setGet Node SetB
Inspect a specific node set within a module
Inputs: set (required), module (required).
node-red-nodes-installInstall NodeC
Install a node module in Node-RED
Inputs: module (required), version.
node-red-nodes-listList NodesB
List installed node modules and node sets in Node-RED
Inputs: no named parameters.
node-red-nodes-remove-moduleRemove Node ModuleC
Remove a node module from Node-RED
Inputs: module (required).
node-red-nodes-resolveResolve NodeA
Look up node IDs by name, type, or description using the node registry. Returns matching nodes with their IDs, types, and flow context.
Inputs: query, flowId, flowLabel.
node-red-nodes-toggle-moduleToggle Node ModuleC
Enable or disable a node module
Inputs: module (required), enabled (required).
node-red-nodes-toggle-setToggle Node SetC
Enable or disable a node set within a module
Inputs: set (required), module (required), enabled (required).
node-red-runtime-get-diagnosticsGet Runtime DiagnosticsB
Read Node-RED runtime diagnostics
Inputs: no named parameters.
node-red-runtime-get-flow-stateGet Flow StateB
Read runtime flow state
Inputs: no named parameters.
node-red-runtime-get-settingsGet Runtime SettingsB
Read Node-RED runtime settings
Inputs: no named parameters.
node-red-runtime-set-flow-stateSet Flow StateC
Update runtime flow state
Inputs: state (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
TDQS
Scored across 37 tools
Each tool belongs to a clearly prefixed category (auth, runtime, debug, flows, graph, nodes) and performs a distinct operation. No two tools have overlapping purposes.
All tools follow the consistent pattern 'node-red-{category}-{action}' using snake_case. There is no deviation or mixing of styles, making the naming predictable and easy to understand.
With 37 tools, the count is on the higher side but justified by the complexity of Node-RED. Each tool covers a specific aspect of management, and the organization into categories prevents overwhelming the user.
The toolset provides comprehensive coverage for Node-RED administration, including authentication, runtime inspection, flow CRUD and node manipulation, graph analysis, and node module management. No significant gaps are apparent.
Related MCP Connectors
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Generate, inspect, and manage Flowstep UI designs directly from your AI assistant.
Read, create and edit noddle diagram boards, browse versions and comment as an AI collaborator.
Create and edit flows, read responses, and reply to users ā from your AI assistant.
Related MCP Servers
- AlicenseAqualityDmaintenanceLets AI assistants interact with Node-RED to read flows, search nodes, edit function code, deploy changes safely, and manage modules.1347 PyPI1MIT
- AlicenseNot gradedqualityBmaintenanceExposes Node-RED flows as MCP tools for AI assistants, with OAuth protection and optional admin tools for flow management.144 npm2ISC
- AlicenseNot gradedqualityBmaintenanceTurns Node-RED flows into OAuth-protected MCP tools that AI assistants can call, with optional read-only access to the Node-RED admin API.26 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to access n8n node documentation, schemas, operations, and workflow templates, and optionally manage n8n workflows through the API.48,812 npmMIT