{
  "markdown": "# nr-mcp\n\n<!-- mcp-name: io.github.Texan-NXTassist/nr-mcp -->\n\nA [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server that lets AI assistants interact with [Node-RED](https://nodered.org) — read flows, search nodes, edit function code, deploy changes safely, and manage modules.\n\nBuilt 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.\n\n## Features\n\n**13 tools** for complete Node-RED flow management:\n\n| Tool | Description |\n|------|-------------|\n| `nr_get_flow_summary` | Overview of all tabs with node counts and groups |\n| `nr_get_flow` | Get a single tab with all nodes — by name or ID |\n| `nr_search_nodes` | Search nodes by name, type, or JavaScript code content |\n| `nr_get_function_code` | Extract full JS code from function nodes (incl. init/finalize) |\n| `nr_get_node_config` | Full config with computed upstream/downstream connections |\n| `nr_get_flow_context` | Read flow-level context variables |\n| `nr_safe_deploy` | Deploy changes with optimistic locking — **never reorders tabs** |\n| `nr_create_nodes` | Batch-create nodes/groups in a single deploy |\n| `nr_delete_nodes` | Batch-delete with automatic wire and group cleanup |\n| `nr_inject` | Trigger inject nodes remotely to test flows |\n| `nr_get_installed_modules` | List installed modules and available node types |\n| `nr_install_module` | Install npm packages from the Node-RED registry |\n| `nr_get_debug_output` | Read debug/error data from flow context |\n\n### Why not just use the existing MCP servers?\n\n- **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.\n- **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.\n- **Smart search**: Search across node names, types, function code, templates, and actions in one call.\n- **Production-tested**: Built and used daily for managing complex Node-RED installations (home automation, IoT, energy management).\n\n## Installation\n\n### Prerequisites\n\n- Python 3.11+\n- [uv](https://docs.astral.sh/uv/) (recommended) or pip\n- Node-RED instance with [Admin API](https://nodered.org/docs/api/admin/) enabled\n\n### Install from PyPI\n\n```bash\npip install nr-mcp\n```\n\n### Install with uv (recommended)\n\n```bash\nuv tool install nr-mcp\n```\n\nOr from source:\n\n```bash\ngit clone https://github.com/Texan-NXTassist/nr-mcp.git\ncd nr-mcp\nuv tool install .\n```\n\nThis creates the `nr-mcp` command in `~/.local/bin/`.\n\n## Configuration\n\n### Environment variables\n\n| Variable | Required | Description |\n|----------|----------|-------------|\n| `NR_URL` | No | Node-RED URL (default: `http://localhost:1880`) |\n| `NR_TOKEN` | No* | Bearer token for token-based auth |\n| `NR_USER` | No* | Username for Basic Auth |\n| `NR_PASS` | No* | Password for Basic Auth |\n\n\\* At least one auth method is recommended. Auth is checked in order: token → basic auth → no auth.\n\n### Claude Desktop\n\nAdd to your `claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"nr-mcp\": {\n      \"command\": \"nr-mcp\",\n      \"env\": {\n        \"NR_URL\": \"http://localhost:1880\",\n        \"NR_USER\": \"admin\",\n        \"NR_PASS\": \"your-password\"\n      }\n    }\n  }\n}\n```\n\n> **Tip**: If you get a \"working directory\" error, create a wrapper script:\n> ```bash\n> #!/bin/bash\n> cd /tmp\n> exec nr-mcp \"$@\"\n> ```\n> Then point `command` to the wrapper path.\n\n### Cursor / VS Code\n\nAdd to your MCP settings (`.cursor/mcp.json` or VS Code equivalent):\n\n```json\n{\n  \"mcpServers\": {\n    \"nr-mcp\": {\n      \"command\": \"nr-mcp\",\n      \"env\": {\n        \"NR_URL\": \"http://localhost:1880\",\n        \"NR_TOKEN\": \"your-access-token\"\n      }\n    }\n  }\n}\n```\n\n## Usage examples\n\nOnce connected, you can ask your AI assistant things like:\n\n- *\"Show me all Node-RED tabs and their node counts\"*\n- *\"Search for nodes that contain 'mqtt' in their code\"*\n- *\"Show me the function code for node abc123\"*\n- *\"Update the function code in node xyz to add error handling\"*\n- *\"Create an inject node and an HTTP request node on the Weather tab\"*\n- *\"What modules are installed? Is node-red-dashboard available?\"*\n- *\"Install node-red-contrib-influxdb\"*\n- *\"Trigger the 'Test' inject node and check for errors\"*\n\n## Architecture\n\nnr-mcp is a Python MCP server that communicates with Node-RED via its [Admin API](https://nodered.org/docs/api/admin/). It uses `stdio` transport (standard for MCP) and makes HTTP calls to your Node-RED instance.\n\n```\nAI Assistant ↔ MCP (stdio) ↔ nr-mcp ↔ HTTP ↔ Node-RED Admin API\n```\n\n### Key design decisions\n\n- **GET→POST pattern**: All deploys fetch full flows, modify in-place, then POST back. Never uses `PUT /flow/:id` which reorders tabs.\n- **Optimistic locking**: Uses the Node-RED `rev` field to detect concurrent modifications.\n- **No caching**: Every tool call fetches fresh data. Slightly slower, but always correct.\n- **Single retry on conflict**: Deploy operations retry once on 409 Conflict.\n\nFor more details, see [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).\n\n## Node-RED setup\n\nThe Admin API must be enabled (it is by default). If you've restricted it, ensure these endpoints are accessible:\n\n- `GET /flows` and `POST /flows` — flow read/write\n- `GET /context/flow/:id` — flow context\n- `POST /inject/:id` — inject trigger\n- `GET /nodes` and `POST /nodes` — module management\n\nSee [Node-RED Admin API docs](https://nodered.org/docs/api/admin/) for auth configuration.\n\n## Contributing\n\nContributions welcome! Please open an issue first to discuss what you'd like to change.\n\n```bash\ngit clone https://github.com/Texan-NXTassist/nr-mcp.git\ncd nr-mcp\nuv venv && source .venv/bin/activate\nuv pip install -e .\n```\n\n## License\n\nMIT — see [LICENSE](LICENSE).\n",
  "bytes": 5972,
  "sha": "5fba5e1eab5407582ffb7a67b7dbe169cf99e975a06711852ec49d922e83520a",
  "repo_slug": "texan-nxtassist/nr-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_texan_nxtassist_nr_mcp_d76c5c9c/readme"
}