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 "Install 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-mcplist 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: n8n Workflow Builder
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
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/kskwon02/node-red-ai-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server