mcp-node-red 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -1
- package/README.md +107 -232
- package/dist/client.d.ts +14 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +181 -4
- package/dist/client.js.map +1 -1
- package/dist/env.d.ts +2 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +13 -0
- package/dist/env.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/schemas.d.ts +286 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +47 -0
- package/dist/schemas.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +232 -0
- package/dist/server.js.map +1 -1
- package/dist/tools/delete-context.d.ts +8 -0
- package/dist/tools/delete-context.d.ts.map +1 -0
- package/dist/tools/delete-context.js +26 -0
- package/dist/tools/delete-context.js.map +1 -0
- package/dist/tools/delete-flow.d.ts +8 -0
- package/dist/tools/delete-flow.d.ts.map +1 -0
- package/dist/tools/delete-flow.js +17 -0
- package/dist/tools/delete-flow.js.map +1 -0
- package/dist/tools/get-context.d.ts +8 -0
- package/dist/tools/get-context.d.ts.map +1 -0
- package/dist/tools/get-context.js +23 -0
- package/dist/tools/get-context.js.map +1 -0
- package/dist/tools/get-diagnostics.d.ts +8 -0
- package/dist/tools/get-diagnostics.d.ts.map +1 -0
- package/dist/tools/get-diagnostics.js +12 -0
- package/dist/tools/get-diagnostics.js.map +1 -0
- package/dist/tools/get-flow-state.d.ts +8 -0
- package/dist/tools/get-flow-state.d.ts.map +1 -0
- package/dist/tools/get-flow-state.js +12 -0
- package/dist/tools/get-flow-state.js.map +1 -0
- package/dist/tools/get-nodes.d.ts +8 -0
- package/dist/tools/get-nodes.d.ts.map +1 -0
- package/dist/tools/get-nodes.js +12 -0
- package/dist/tools/get-nodes.js.map +1 -0
- package/dist/tools/get-settings.d.ts +8 -0
- package/dist/tools/get-settings.d.ts.map +1 -0
- package/dist/tools/get-settings.js +12 -0
- package/dist/tools/get-settings.js.map +1 -0
- package/dist/tools/install-node.d.ts +8 -0
- package/dist/tools/install-node.d.ts.map +1 -0
- package/dist/tools/install-node.js +17 -0
- package/dist/tools/install-node.js.map +1 -0
- package/dist/tools/remove-node-module.d.ts +8 -0
- package/dist/tools/remove-node-module.d.ts.map +1 -0
- package/dist/tools/remove-node-module.js +17 -0
- package/dist/tools/remove-node-module.js.map +1 -0
- package/dist/tools/set-debug-state.d.ts +8 -0
- package/dist/tools/set-debug-state.d.ts.map +1 -0
- package/dist/tools/set-debug-state.js +18 -0
- package/dist/tools/set-debug-state.js.map +1 -0
- package/dist/tools/set-flow-state.d.ts +8 -0
- package/dist/tools/set-flow-state.d.ts.map +1 -0
- package/dist/tools/set-flow-state.js +17 -0
- package/dist/tools/set-flow-state.js.map +1 -0
- package/dist/tools/set-node-module-state.d.ts +8 -0
- package/dist/tools/set-node-module-state.d.ts.map +1 -0
- package/dist/tools/set-node-module-state.js +18 -0
- package/dist/tools/set-node-module-state.js.map +1 -0
- package/dist/tools/trigger-inject.d.ts +8 -0
- package/dist/tools/trigger-inject.d.ts.map +1 -0
- package/dist/tools/trigger-inject.js +17 -0
- package/dist/tools/trigger-inject.js.map +1 -0
- package/package.json +22 -5
- package/.github/workflows/ci.yml +0 -37
- package/.github/workflows/release.yml +0 -30
- package/.mcp.json.example +0 -11
- package/.releaserc.json +0 -17
- package/CLAUDE.md +0 -147
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.1.0](https://github.com/fx/mcp-node-red/compare/mcp-node-red-v1.0.1...mcp-node-red-v1.1.0) (2026-02-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add delete_flow tool and API coverage spec ([#1](https://github.com/fx/mcp-node-red/issues/1)) ([4bccdf3](https://github.com/fx/mcp-node-red/commit/4bccdf33724bdb92b2eb60b17408942bb2eb8b29))
|
|
9
|
+
* add dotenv support for .env and .env.local files ([#10](https://github.com/fx/mcp-node-red/issues/10)) ([cb23353](https://github.com/fx/mcp-node-red/commit/cb233535ca6e86c23e46617e8f9ffcdbd04fb7f0))
|
|
10
|
+
* add flow state tools (get_flow_state, set_flow_state) ([#2](https://github.com/fx/mcp-node-red/issues/2)) ([cf4b108](https://github.com/fx/mcp-node-red/commit/cf4b1082bc2483ff9ebcb0f3b016a29aec35cb7a))
|
|
11
|
+
* add MCP server for Node-RED workflow management ([4330d3a](https://github.com/fx/mcp-node-red/commit/4330d3a84f4341b000e12859d02da0604d0cf4bf))
|
|
12
|
+
* add semantic-release for automated releases ([654965d](https://github.com/fx/mcp-node-red/commit/654965d940b859d784d753172f7f6f57a08bc18c))
|
|
13
|
+
* **context:** add get_context and delete_context tools ([#3](https://github.com/fx/mcp-node-red/issues/3)) ([9da4888](https://github.com/fx/mcp-node-red/commit/9da4888f2a469d4b8f96c9794a8840a75aeb2bf9))
|
|
14
|
+
* initial commit from template ([5ef23d6](https://github.com/fx/mcp-node-red/commit/5ef23d6ea3b7584c9116a1de1263e4f937e3b2c4))
|
|
15
|
+
* **nodes:** add node module management tools ([#4](https://github.com/fx/mcp-node-red/issues/4)) ([bbd3376](https://github.com/fx/mcp-node-red/commit/bbd3376a115c938e9f28a63cbb29b777557e8ec7))
|
|
16
|
+
* **runtime:** add get_settings and get_diagnostics tools ([#5](https://github.com/fx/mcp-node-red/issues/5)) ([e58b564](https://github.com/fx/mcp-node-red/commit/e58b5641af52aa817f6828268d537f3c682040b7))
|
|
17
|
+
* **tools:** add trigger_inject and set_debug_state tools ([#6](https://github.com/fx/mcp-node-red/issues/6)) ([8b2f51a](https://github.com/fx/mcp-node-red/commit/8b2f51a409553875c6c0fe3b38f75ade81998147))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* clean up release pipeline and npm package contents ([5869433](https://github.com/fx/mcp-node-red/commit/58694339c1d624b8c7fb2e9ce9a2fdb92472e5cf))
|
|
23
|
+
* correct Node-RED API response handling for v4.1.5 ([#11](https://github.com/fx/mcp-node-red/issues/11)) ([eff418b](https://github.com/fx/mcp-node-red/commit/eff418bed18b5da754b1011e6a40a25b7d9bc950))
|
|
24
|
+
* ensure dist/index.js is executable in npm package ([9d95bca](https://github.com/fx/mcp-node-red/commit/9d95bca133b17a98c81834470e45f19b20be1555))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Documentation
|
|
28
|
+
|
|
29
|
+
* improve installation with claude mcp commands and collapse sections ([5edf6ff](https://github.com/fx/mcp-node-red/commit/5edf6ff55c0526f941b53f0e8cefb2bccfb930c4))
|
|
30
|
+
* reorganize README and move dev docs to docs/ ([29d8575](https://github.com/fx/mcp-node-red/commit/29d857568368fdd1f55457bba448906076981ba3))
|
|
31
|
+
* update all documentation for 17 MCP tools ([#7](https://github.com/fx/mcp-node-red/issues/7)) ([67e5c2c](https://github.com/fx/mcp-node-red/commit/67e5c2ce345c77892c793320c5617b4645c68d24))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Miscellaneous
|
|
35
|
+
|
|
36
|
+
* add husky pre-commit hooks with lint-staged ([cbdc6f1](https://github.com/fx/mcp-node-red/commit/cbdc6f15db4dbfb5ff72f0fcd7c8e12b5a9f3064))
|
|
37
|
+
* format code ([c09882f](https://github.com/fx/mcp-node-red/commit/c09882f98dce5486c8301aa62f78bc37975d0026))
|
|
38
|
+
* format package.json ([424b6a9](https://github.com/fx/mcp-node-red/commit/424b6a91d2971bcc2fd0e599bd2d96b056862305))
|
|
39
|
+
* **release:** 1.0.0 [skip ci] ([7d8cf9d](https://github.com/fx/mcp-node-red/commit/7d8cf9dcf2b9dc8671ad28d60a15e812a2ad3214))
|
|
40
|
+
* **release:** 1.0.1 [skip ci] ([8ab070f](https://github.com/fx/mcp-node-red/commit/8ab070f2c6ac71ad799b718e4c4e07041d7ddb5c))
|
|
41
|
+
* rename to mcp-node-red and add CI/CD workflows ([80ca66a](https://github.com/fx/mcp-node-red/commit/80ca66a1d818f428e1a8f5df905ad388bd34d406))
|
|
42
|
+
* switch from semantic-release to release-please ([#8](https://github.com/fx/mcp-node-red/issues/8)) ([6bd24b2](https://github.com/fx/mcp-node-red/commit/6bd24b2ae3236d550daf414131fdddba4fd0df16))
|
|
43
|
+
|
|
1
44
|
## [1.0.1](https://github.com/fx/mcp-node-red/compare/v1.0.0...v1.0.1) (2025-10-08)
|
|
2
45
|
|
|
3
46
|
|
|
@@ -5,7 +48,7 @@
|
|
|
5
48
|
|
|
6
49
|
* ensure dist/index.js is executable in npm package ([9d95bca](https://github.com/fx/mcp-node-red/commit/9d95bca133b17a98c81834470e45f19b20be1555))
|
|
7
50
|
|
|
8
|
-
|
|
51
|
+
## 1.0.0 (2025-10-08)
|
|
9
52
|
|
|
10
53
|
|
|
11
54
|
### Features
|
package/README.md
CHANGED
|
@@ -1,28 +1,70 @@
|
|
|
1
1
|
# Node-RED MCP Server
|
|
2
2
|
|
|
3
|
-
MCP server for Node-RED workflow management
|
|
3
|
+
MCP server for Node-RED workflow management. Provides AI assistants with 17 tools to manage flows, node modules, context stores, and runtime settings through the Node-RED Admin API v2.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
- **update_flow**: Update specific flow by ID using PUT /flow/:id
|
|
10
|
-
- **validate_flow**: Validate flow configuration without deploying
|
|
7
|
+
<details>
|
|
8
|
+
<summary><strong>Claude Code</strong></summary>
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
**Standalone Node-RED:**
|
|
11
|
+
```bash
|
|
12
|
+
claude mcp add node-red -e NODE_RED_URL=http://localhost:1880 -e NODE_RED_TOKEN=your-api-token -- npx mcp-node-red
|
|
13
|
+
```
|
|
13
14
|
|
|
15
|
+
**Home Assistant Add-on (Basic Auth):**
|
|
14
16
|
```bash
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
claude mcp add node-red -e NODE_RED_URL=http://username:password@homeassistant.local:1880 -- npx mcp-node-red
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
</details>
|
|
21
|
+
|
|
22
|
+
<details>
|
|
23
|
+
<summary><strong>Claude Desktop</strong></summary>
|
|
24
|
+
|
|
25
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `~/.config/claude/claude_desktop_config.json` (Linux):
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"mcpServers": {
|
|
30
|
+
"node-red": {
|
|
31
|
+
"command": "npx",
|
|
32
|
+
"args": ["mcp-node-red"],
|
|
33
|
+
"env": {
|
|
34
|
+
"NODE_RED_URL": "http://localhost:1880",
|
|
35
|
+
"NODE_RED_TOKEN": "your-api-token"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
17
40
|
```
|
|
18
41
|
|
|
42
|
+
Restart Claude Desktop to load the server.
|
|
43
|
+
|
|
44
|
+
</details>
|
|
45
|
+
|
|
19
46
|
## Configuration
|
|
20
47
|
|
|
21
|
-
|
|
48
|
+
### Environment Variables
|
|
49
|
+
|
|
50
|
+
- `NODE_RED_URL` (required): Your Node-RED instance URL
|
|
51
|
+
- `NODE_RED_TOKEN` (optional): API token for authentication
|
|
52
|
+
|
|
53
|
+
### Environment Files
|
|
54
|
+
|
|
55
|
+
The server loads environment variables from `.env` and `.env.local` files in the working directory:
|
|
22
56
|
|
|
57
|
+
- `.env` -- Base defaults (tracked in version control if desired)
|
|
58
|
+
- `.env.local` -- Local overrides (gitignored, never committed)
|
|
59
|
+
|
|
60
|
+
Precedence (highest to lowest):
|
|
61
|
+
1. Real environment variables (e.g., set via shell or MCP config)
|
|
62
|
+
2. `.env.local`
|
|
63
|
+
3. `.env`
|
|
64
|
+
|
|
65
|
+
Copy `.env.example` as a starting template:
|
|
23
66
|
```bash
|
|
24
|
-
|
|
25
|
-
export NODE_RED_TOKEN=your-api-token # Optional
|
|
67
|
+
cp .env.example .env
|
|
26
68
|
```
|
|
27
69
|
|
|
28
70
|
### Node-RED Setup
|
|
@@ -41,289 +83,122 @@ adminAuth: {
|
|
|
41
83
|
}
|
|
42
84
|
```
|
|
43
85
|
|
|
44
|
-
2. Generate API token
|
|
86
|
+
2. Generate API token:
|
|
45
87
|
```bash
|
|
46
88
|
curl -X POST http://localhost:1880/auth/token \
|
|
47
89
|
-H "Content-Type: application/json" \
|
|
48
90
|
-d '{"client_id":"node-red-admin","grant_type":"password","scope":"*","username":"admin","password":"your-password"}'
|
|
49
91
|
```
|
|
50
92
|
|
|
51
|
-
#### Home Assistant Add-on
|
|
93
|
+
#### Home Assistant Add-on
|
|
52
94
|
|
|
53
|
-
|
|
95
|
+
The Home Assistant Node-RED add-on uses Basic Auth with your Home Assistant credentials:
|
|
54
96
|
|
|
55
97
|
```bash
|
|
56
|
-
# Test connection
|
|
98
|
+
# Test connection
|
|
57
99
|
curl http://USERNAME:PASSWORD@homeassistant.local:1880/flows
|
|
58
100
|
```
|
|
59
101
|
|
|
60
102
|
**Configuration**:
|
|
61
|
-
```bash
|
|
62
|
-
# Use basic auth in URL
|
|
63
|
-
export NODE_RED_URL=http://admin:your-ha-password@192.168.0.232:1880
|
|
64
|
-
# No NODE_RED_TOKEN needed for HA add-on
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
**Note**: Home Assistant add-on does not use `/auth/token` endpoint. API authentication is handled via HTTP Basic Auth using your Home Assistant credentials.
|
|
68
|
-
|
|
69
|
-
## Clients
|
|
70
|
-
|
|
71
|
-
<details>
|
|
72
|
-
<summary>Claude Code</summary>
|
|
73
|
-
|
|
74
|
-
Create `.mcp.json` in your project (copy from `.mcp.json.example`):
|
|
75
|
-
|
|
76
103
|
```json
|
|
77
104
|
{
|
|
78
105
|
"mcpServers": {
|
|
79
106
|
"node-red": {
|
|
80
|
-
"command": "
|
|
81
|
-
"args": ["
|
|
107
|
+
"command": "npx",
|
|
108
|
+
"args": ["mcp-node-red"],
|
|
82
109
|
"env": {
|
|
83
|
-
"NODE_RED_URL": "http://
|
|
84
|
-
"NODE_RED_TOKEN": "your-api-token"
|
|
110
|
+
"NODE_RED_URL": "http://admin:your-ha-password@homeassistant.local:1880"
|
|
85
111
|
}
|
|
86
112
|
}
|
|
87
113
|
}
|
|
88
114
|
}
|
|
89
115
|
```
|
|
90
116
|
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
claude --mcp-config .mcp.json
|
|
94
|
-
```
|
|
117
|
+
Note: No `NODE_RED_TOKEN` needed - credentials are in the URL.
|
|
95
118
|
|
|
96
|
-
|
|
119
|
+
## Features
|
|
97
120
|
|
|
98
|
-
|
|
99
|
-
|
|
121
|
+
### Flow Management
|
|
122
|
+
- **get_flows**: Retrieve all flows from your Node-RED instance
|
|
123
|
+
- **create_flow**: Create new flows via POST /flow
|
|
124
|
+
- **update_flow**: Update individual flows safely via PUT /flow/:id
|
|
125
|
+
- **validate_flow**: Validate flow configuration without deploying
|
|
126
|
+
- **delete_flow**: Delete a flow and all its nodes by ID
|
|
100
127
|
|
|
101
|
-
|
|
128
|
+
### Runtime Control
|
|
129
|
+
- **get_flow_state**: Get runtime state of flows (started/stopped)
|
|
130
|
+
- **set_flow_state**: Start or stop all flows in the runtime
|
|
102
131
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
"args": ["/path/to/mcp-node-red/dist/index.js"],
|
|
109
|
-
"env": {
|
|
110
|
-
"NODE_RED_URL": "http://localhost:1880",
|
|
111
|
-
"NODE_RED_TOKEN": "your-api-token"
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
```
|
|
132
|
+
### Node Module Management
|
|
133
|
+
- **get_nodes**: List all installed node modules with versions and status
|
|
134
|
+
- **install_node**: Install a node module from the npm registry
|
|
135
|
+
- **set_node_module_state**: Enable or disable an installed node module
|
|
136
|
+
- **remove_node_module**: Uninstall a node module from Node-RED
|
|
117
137
|
|
|
118
|
-
|
|
138
|
+
### Context Store
|
|
139
|
+
- **get_context**: Read context data at global, flow, or node scope
|
|
140
|
+
- **delete_context**: Delete context values at any scope
|
|
119
141
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
"node-red": {
|
|
124
|
-
"command": "npx",
|
|
125
|
-
"args": ["-y", "mcp-node-red"],
|
|
126
|
-
"env": {
|
|
127
|
-
"NODE_RED_URL": "http://localhost:1880",
|
|
128
|
-
"NODE_RED_TOKEN": "your-api-token"
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
```
|
|
142
|
+
### Runtime Info
|
|
143
|
+
- **get_settings**: Get Node-RED runtime settings including version
|
|
144
|
+
- **get_diagnostics**: Get system diagnostics (Node.js, OS, memory)
|
|
134
145
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
146
|
+
### Node Interaction
|
|
147
|
+
- **trigger_inject**: Trigger an inject node (same as clicking the button)
|
|
148
|
+
- **set_debug_state**: Enable or disable a debug node's output
|
|
138
149
|
|
|
139
150
|
## Usage
|
|
140
151
|
|
|
141
|
-
|
|
152
|
+
Once configured, ask your AI assistant natural language questions:
|
|
142
153
|
|
|
143
154
|
```
|
|
144
155
|
Get all flows from my Node-RED instance
|
|
145
156
|
```
|
|
146
157
|
|
|
147
|
-
Returns current flows with revision number for optimistic locking.
|
|
148
|
-
|
|
149
|
-
### Create Flow
|
|
150
|
-
|
|
151
158
|
```
|
|
152
|
-
Create a new flow with label "
|
|
159
|
+
Create a new flow with label "Temperature Monitor"
|
|
153
160
|
```
|
|
154
161
|
|
|
155
|
-
Creates a new flow using POST /flow endpoint. Flow ID can be provided or will be auto-generated.
|
|
156
|
-
|
|
157
|
-
**Flow format**:
|
|
158
|
-
```json
|
|
159
|
-
{
|
|
160
|
-
"id": "optional-id",
|
|
161
|
-
"label": "My Flow",
|
|
162
|
-
"nodes": [],
|
|
163
|
-
"configs": []
|
|
164
|
-
}
|
|
165
162
|
```
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
Update flow "flow1" to change its label to "New Name"
|
|
164
|
+
```
|
|
168
165
|
|
|
169
166
|
```
|
|
170
|
-
|
|
167
|
+
Delete the flow with ID "flow1"
|
|
171
168
|
```
|
|
172
169
|
|
|
173
|
-
Updates specific flow using PUT /flow/:id endpoint. Only affects the specified flow, leaving all other flows untouched.
|
|
174
|
-
|
|
175
|
-
**Flow format**:
|
|
176
|
-
```json
|
|
177
|
-
{
|
|
178
|
-
"id": "flow1",
|
|
179
|
-
"label": "My Flow",
|
|
180
|
-
"nodes": [],
|
|
181
|
-
"configs": []
|
|
182
|
-
}
|
|
183
170
|
```
|
|
184
|
-
|
|
185
|
-
|
|
171
|
+
What node modules are installed?
|
|
172
|
+
```
|
|
186
173
|
|
|
187
174
|
```
|
|
188
|
-
|
|
189
|
-
{
|
|
190
|
-
"id": "test",
|
|
191
|
-
"label": "Test Flow",
|
|
192
|
-
"nodes": []
|
|
193
|
-
}
|
|
175
|
+
Install the node-red-contrib-mqtt module
|
|
194
176
|
```
|
|
195
177
|
|
|
196
|
-
Checks for:
|
|
197
|
-
- Required fields (id, label)
|
|
198
|
-
- Valid node references
|
|
199
|
-
- Structural integrity
|
|
200
|
-
|
|
201
|
-
## API Reference
|
|
202
|
-
|
|
203
|
-
### get_flows
|
|
204
|
-
|
|
205
|
-
Get all flows from Node-RED.
|
|
206
|
-
|
|
207
|
-
**Input**: None
|
|
208
|
-
|
|
209
|
-
**Output**:
|
|
210
|
-
```json
|
|
211
|
-
{
|
|
212
|
-
"rev": "abc123",
|
|
213
|
-
"flows": [...]
|
|
214
|
-
}
|
|
215
178
|
```
|
|
216
|
-
|
|
217
|
-
### create_flow
|
|
218
|
-
|
|
219
|
-
Create a new flow using POST /flow.
|
|
220
|
-
|
|
221
|
-
**Input**:
|
|
222
|
-
- `flow` (string): JSON string containing flow data with format: `{id, label, nodes: [], configs: []}`
|
|
223
|
-
|
|
224
|
-
**Output**:
|
|
225
|
-
```json
|
|
226
|
-
{
|
|
227
|
-
"id": "flow1"
|
|
228
|
-
}
|
|
179
|
+
Trigger the inject node to test my flow
|
|
229
180
|
```
|
|
230
181
|
|
|
231
|
-
**Important**: Flow ID is optional - Node-RED will auto-generate if not provided. Returns 200 or 204 with the flow ID.
|
|
232
|
-
|
|
233
|
-
### update_flow
|
|
234
|
-
|
|
235
|
-
Update specific flow by ID using PUT /flow/:id.
|
|
236
|
-
|
|
237
|
-
**Input**:
|
|
238
|
-
- `flowId` (string): Flow ID to update
|
|
239
|
-
- `updates` (string): JSON string containing flow data with format: `{id, label, nodes: [], configs: []}`
|
|
240
|
-
|
|
241
|
-
**Output**:
|
|
242
|
-
```json
|
|
243
|
-
{
|
|
244
|
-
"id": "flow1"
|
|
245
|
-
}
|
|
246
182
|
```
|
|
247
|
-
|
|
248
|
-
**Important**: This endpoint updates ONLY the specified flow. All other flows remain completely untouched. No risk of destroying unrelated workflows.
|
|
249
|
-
|
|
250
|
-
### validate_flow
|
|
251
|
-
|
|
252
|
-
Validate flow configuration.
|
|
253
|
-
|
|
254
|
-
**Input**:
|
|
255
|
-
- `flow` (string): JSON string containing flow data with format: `{id, label, nodes: [], configs: []}`
|
|
256
|
-
|
|
257
|
-
**Output**:
|
|
258
|
-
```json
|
|
259
|
-
{
|
|
260
|
-
"valid": true,
|
|
261
|
-
"errors": ["error1", "error2"]
|
|
262
|
-
}
|
|
183
|
+
Show me the global context data
|
|
263
184
|
```
|
|
264
185
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
```bash
|
|
268
|
-
# Build
|
|
269
|
-
npm run build
|
|
270
|
-
|
|
271
|
-
# Watch mode
|
|
272
|
-
npm run dev
|
|
273
|
-
|
|
274
|
-
# Test
|
|
275
|
-
npm test
|
|
276
|
-
|
|
277
|
-
# Coverage
|
|
278
|
-
npm run test:coverage
|
|
279
|
-
|
|
280
|
-
# Lint
|
|
281
|
-
npm run lint
|
|
282
|
-
npm run lint:fix
|
|
283
|
-
|
|
284
|
-
# Format
|
|
285
|
-
npm run format
|
|
186
|
+
```
|
|
187
|
+
Get the Node-RED runtime settings and version
|
|
286
188
|
```
|
|
287
189
|
|
|
288
|
-
##
|
|
289
|
-
|
|
290
|
-
The server uses Admin API v2 endpoints:
|
|
291
|
-
|
|
292
|
-
### GET /flows
|
|
293
|
-
- Returns all flows: `{rev: "...", flows: [...]}`
|
|
294
|
-
- Headers: `Node-RED-API-Version: v2`, `Authorization`
|
|
295
|
-
|
|
296
|
-
### POST /flow
|
|
297
|
-
- Creates a new flow
|
|
298
|
-
- Request: `{id, label, nodes: [], configs: []}`
|
|
299
|
-
- Response: 200 or 204 with `{id: "..."}` in body
|
|
300
|
-
- Flow ID is optional - auto-generated if not provided
|
|
301
|
-
|
|
302
|
-
### PUT /flow/:id
|
|
303
|
-
- Updates a single flow by ID
|
|
304
|
-
- Request: `{id, label, nodes: [], configs: []}`
|
|
305
|
-
- Response: 204 with `{id: "..."}` in body
|
|
306
|
-
- Only affects the specified flow, all other flows remain untouched
|
|
307
|
-
|
|
308
|
-
## Error Handling
|
|
190
|
+
## Safety Features
|
|
309
191
|
|
|
310
|
-
|
|
192
|
+
- **Individual flow updates**: Uses PUT /flow/:id to update only the specified flow
|
|
193
|
+
- **No accidental deletions**: Other flows remain completely untouched
|
|
194
|
+
- **Validation**: All flow configurations are validated before sending to Node-RED
|
|
195
|
+
- **Read-only by default**: Only modifies flows when explicitly requested
|
|
196
|
+
- **Module management guards**: Core modules cannot be removed; enable/disable is reversible
|
|
197
|
+
- **Scoped context operations**: Context reads and deletes are scoped to specific keys
|
|
311
198
|
|
|
312
|
-
|
|
313
|
-
{
|
|
314
|
-
"content": [{
|
|
315
|
-
"type": "text",
|
|
316
|
-
"text": "Error: ..."
|
|
317
|
-
}],
|
|
318
|
-
"isError": true
|
|
319
|
-
}
|
|
320
|
-
```
|
|
199
|
+
## Development
|
|
321
200
|
|
|
322
|
-
|
|
323
|
-
- Invalid JSON in request
|
|
324
|
-
- Flow not found
|
|
325
|
-
- Validation failures
|
|
326
|
-
- Network/API errors
|
|
201
|
+
See [docs/development.md](docs/development.md) for development setup, testing, and contribution guidelines.
|
|
327
202
|
|
|
328
203
|
## License
|
|
329
204
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Config, NodeRedFlowsResponse, UpdateFlowRequest } from './schemas.js';
|
|
1
|
+
import type { Config, FlowState, NodeModule, NodeRedDiagnostics, NodeRedFlowsResponse, NodeRedSettings, UpdateFlowRequest } from './schemas.js';
|
|
2
2
|
export declare class NodeRedClient {
|
|
3
3
|
private readonly baseUrl;
|
|
4
4
|
private readonly token?;
|
|
@@ -12,9 +12,22 @@ export declare class NodeRedClient {
|
|
|
12
12
|
updateFlow(flowId: string, flowData: UpdateFlowRequest): Promise<{
|
|
13
13
|
id: string;
|
|
14
14
|
}>;
|
|
15
|
+
deleteFlow(flowId: string): Promise<void>;
|
|
16
|
+
getFlowState(): Promise<FlowState>;
|
|
17
|
+
setFlowState(state: 'start' | 'stop'): Promise<FlowState>;
|
|
18
|
+
getSettings(): Promise<NodeRedSettings>;
|
|
19
|
+
getDiagnostics(): Promise<NodeRedDiagnostics>;
|
|
20
|
+
getContext(scope: 'global' | 'flow' | 'node', id?: string, key?: string, store?: string): Promise<unknown>;
|
|
21
|
+
deleteContext(scope: 'global' | 'flow' | 'node', id?: string, key?: string, store?: string): Promise<void>;
|
|
22
|
+
triggerInject(nodeId: string): Promise<void>;
|
|
23
|
+
setDebugNodeState(nodeId: string, enabled: boolean): Promise<void>;
|
|
15
24
|
validateFlow(flowData: UpdateFlowRequest): Promise<{
|
|
16
25
|
valid: boolean;
|
|
17
26
|
errors?: string[];
|
|
18
27
|
}>;
|
|
28
|
+
getNodes(): Promise<NodeModule[]>;
|
|
29
|
+
installNode(module: string): Promise<NodeModule>;
|
|
30
|
+
setNodeModuleState(module: string, enabled: boolean): Promise<NodeModule>;
|
|
31
|
+
removeNodeModule(module: string): Promise<void>;
|
|
19
32
|
}
|
|
20
33
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,MAAM,EACN,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EAClB,MAAM,cAAc,CAAC;AAStB,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAS;gBAExB,MAAM,EAAE,MAAM;IAc1B,OAAO,CAAC,UAAU;IAeZ,QAAQ,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAezC,UAAU,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAmBhE,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAmBhF,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYzC,YAAY,IAAI,OAAO,CAAC,SAAS,CAAC;IAelC,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAgBzD,WAAW,IAAI,OAAO,CAAC,eAAe,CAAC;IAevC,cAAc,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAe7C,UAAU,CACd,KAAK,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,EACjC,EAAE,CAAC,EAAE,MAAM,EACX,GAAG,CAAC,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,CAAC;IAyBb,aAAa,CACjB,KAAK,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,EACjC,EAAE,CAAC,EAAE,MAAM,EACX,GAAG,CAAC,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;IAsBV,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY5C,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAclE,YAAY,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IA0CzF,QAAQ,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAiBjC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAgBhD,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;IAgBzE,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAWtD"}
|