Nr Mcp

io.github.Texan-NXTassist由 GitHub 帳號 Texan-NXTassist 發布v1.2.2更新於 Oct 25, 2026

MCP server for Node-RED — safe deploy, optimistic locking, smart search, 13 tools

已驗證STDIO僅桌面效率與工作流開發者工具

概覽

AI 產生的概覽

本機 MCP 伺服器,讓 AI 助理讀取、搜尋、編輯並安全部署 Node-RED 流程,觸發 inject 節點並管理已安裝模組。

可以做什麼
讀取流程概覽、單一頁籤、含上下游連線的節點設定、函式程式碼與流程層級內容變數,並讀取流程內容中的除錯輸出。依名稱、類型或 JavaScript 程式碼內容搜尋節點。批次建立與刪除節點及群組,並自動清理連線與群組。透過完整的 GET 到 POST 流程寫入並依 rev 欄位做樂觀鎖來部署變更,因此保留頁籤順序。遠端觸發 inject 節點以測試流程。列出已安裝模組與可用節點類型,並從 Node-RED 註冊表安裝 npm 套件。
適用情境
適合管理 Node-RED 安裝(例如家庭自動化、物聯網或能源管理)時使用,讓助理檢查流程、修改函式程式碼、增刪節點、測試流程與安裝模組,而不必手動編輯編輯器。當其他人也可能同時部署時,安全部署與衝突偵測格外重要。
執行需求
以 Python 套件(nr-mcp)透過 pip 或 uv 在本機執行,需要 Python 3.11+ 以及啟用 Admin API 的 Node-RED 實例。設定 NR_URL(預設 NR_TOKEN 用於 Bearer 驗證,或 NR_USER 與 NR_PASS 用於 Basic Auth;依此順序嘗試驗證。需要能存取 Node-RED Admin API 的網路。
安裝前請注意
此伺服器持有 Node-RED 管理憑證(NR_TOKEN 或 NR_USER 與 NR_PASS),且能變更實例:建立與刪除節點、部署流程、觸發 inject 節點、安裝 npm 套件。部署會寫入整組流程,出錯會影響整個實例;樂觀鎖只能發現並行修改。NR_URL 只應指向你有權修改的 Node-RED 實例。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Nr Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

nr-mcp

A Model Context Protocol (MCP) server that lets AI assistants interact with Node-RED — read flows, search nodes, edit function code, deploy changes safely, and manage modules.

Built to solve real problems: the existing Node-RED MCP implementations use PUT /flow/:id which reorders your tabs. nr-mcp uses the correct GET → POST /flows pattern with optimistic locking, so your tab order is always preserved.

Features

13 tools for complete Node-RED flow management:

ToolDescription
nr_get_flow_summaryOverview of all tabs with node counts and groups
nr_get_flowGet a single tab with all nodes — by name or ID
nr_search_nodesSearch nodes by name, type, or JavaScript code content
nr_get_function_codeExtract full JS code from function nodes (incl. init/finalize)
nr_get_node_configFull config with computed upstream/downstream connections
nr_get_flow_contextRead flow-level context variables
nr_safe_deployDeploy changes with optimistic locking — never reorders tabs
nr_create_nodesBatch-create nodes/groups in a single deploy
nr_delete_nodesBatch-delete with automatic wire and group cleanup
nr_injectTrigger inject nodes remotely to test flows
nr_get_installed_modulesList installed modules and available node types
nr_install_moduleInstall npm packages from the Node-RED registry
nr_get_debug_outputRead debug/error data from flow context

Why not just use the existing MCP servers?

  • Tab reorder bug: Other implementations use PUT /flow/:id which silently reorders your tabs in Node-RED. nr-mcp uses the correct GET → POST /flows full-deploy pattern.
  • Optimistic locking: Every deploy checks the rev field. If someone else deployed between your read and write, you get a clear conflict error instead of silent data loss.
  • Smart search: Search across node names, types, function code, templates, and actions in one call.
  • Production-tested: Built and used daily for managing complex Node-RED installations (home automation, IoT, energy management).

Installation

Prerequisites

  • Python 3.11+
  • uv (recommended) or pip
  • Node-RED instance with Admin API enabled

Install from PyPI

bash
pip install nr-mcp

Install with uv (recommended)

bash
uv tool install nr-mcp

Or from source:

bash
git clone https://github.com/Texan-NXTassist/nr-mcp.gitcd nr-mcpuv tool install .

This creates the nr-mcp command in ~/.local/bin/.

Configuration

Environment variables

VariableRequiredDescription
NR_URLNoNode-RED URL (default: http://localhost:1880)
NR_TOKENNo*Bearer token for token-based auth
NR_USERNo*Username for Basic Auth
NR_PASSNo*Password for Basic Auth

* At least one auth method is recommended. Auth is checked in order: token → basic auth → no auth.

Claude Desktop

Add to your claude_desktop_config.json:

json
{  "mcpServers": {    "nr-mcp": {      "command": "nr-mcp",      "env": {        "NR_URL": "http://localhost:1880",        "NR_USER": "admin",        "NR_PASS": "your-password"      }    }  }}

Tip: If you get a "working directory" error, create a wrapper script:

bash
#!/bin/bashcd /tmpexec nr-mcp "$@"

Then point command to the wrapper path.

Cursor / VS Code

Add to your MCP settings (.cursor/mcp.json or VS Code equivalent):

json
{  "mcpServers": {    "nr-mcp": {      "command": "nr-mcp",      "env": {        "NR_URL": "http://localhost:1880",        "NR_TOKEN": "your-access-token"      }    }  }}

Usage examples

Once connected, you can ask your AI assistant things like:

  • "Show me all Node-RED tabs and their node counts"
  • "Search for nodes that contain 'mqtt' in their code"
  • "Show me the function code for node abc123"
  • "Update the function code in node xyz to add error handling"
  • "Create an inject node and an HTTP request node on the Weather tab"
  • "What modules are installed? Is node-red-dashboard available?"
  • "Install node-red-contrib-influxdb"
  • "Trigger the 'Test' inject node and check for errors"

Architecture

nr-mcp is a Python MCP server that communicates with Node-RED via its Admin API. It uses stdio transport (standard for MCP) and makes HTTP calls to your Node-RED instance.

AI Assistant ↔ MCP (stdio) ↔ nr-mcp ↔ HTTP ↔ Node-RED Admin API

Key design decisions

  • GET→POST pattern: All deploys fetch full flows, modify in-place, then POST back. Never uses PUT /flow/:id which reorders tabs.
  • Optimistic locking: Uses the Node-RED rev field to detect concurrent modifications.
  • No caching: Every tool call fetches fresh data. Slightly slower, but always correct.
  • Single retry on conflict: Deploy operations retry once on 409 Conflict.

For more details, see docs/ARCHITECTURE.md.

Node-RED setup

The Admin API must be enabled (it is by default). If you've restricted it, ensure these endpoints are accessible:

  • GET /flows and POST /flows — flow read/write
  • GET /context/flow/:id — flow context
  • POST /inject/:id — inject trigger
  • GET /nodes and POST /nodes — module management

See Node-RED Admin API docs for auth configuration.

Contributing

Contributions welcome! Please open an issue first to discuss what you'd like to change.

bash
git clone https://github.com/Texan-NXTassist/nr-mcp.gitcd nr-mcpuv venv && source .venv/bin/activateuv pip install -e .

License

MIT — see LICENSE.

來源:README.md,提交 3580418

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.2.2最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分