@gmag11/nodered-mcp-server 1.0.1
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/LICENSE +201 -0
- package/README.md +162 -0
- package/index.js +133 -0
- package/package.json +58 -0
- package/resources/skills/nodered-flow-builder/SKILL.md +659 -0
- package/resources/skills/nodered-flow-layout/SKILL.md +395 -0
- package/resources/skills/nodered-flowfuse-dashboard/SKILL.md +941 -0
- package/resources/skills/nodered-fundamentals/SKILL.md +323 -0
- package/resources/skills/nodered-jsonata/SKILL.md +1039 -0
- package/resources/skills/nodered-mustache/SKILL.md +588 -0
- package/resources/skills/nodered-node-reference/SKILL.md +1020 -0
- package/resources/skills/nodered-node-reference/examples/common.json +113 -0
- package/resources/skills/nodered-node-reference/examples/network.json +107 -0
- package/resources/skills/nodered-node-reference/examples/parser.json +147 -0
- package/resources/skills/nodered-node-reference/examples/sequence.json +141 -0
- package/resources/skills/nodered-node-reference/examples/storage.json +104 -0
- package/resources/skills/nodered-patterns/SKILL.md +414 -0
- package/resources/skills/nodered-patterns/examples/error-handler.json +72 -0
- package/resources/skills/nodered-patterns/examples/http-endpoint.json +42 -0
- package/resources/skills/nodered-patterns/examples/mqtt-subscriber.json +47 -0
- package/resources/skills/nodered-patterns/examples/timer-flow.json +50 -0
- package/resources/skills/nodered-subflows/SKILL.md +261 -0
- package/resources/skills/nodered-uibuilder/SKILL.md +500 -0
- package/src/auth/api-key-verifier.js +36 -0
- package/src/auth/composite-verifier.js +59 -0
- package/src/auth/config.js +106 -0
- package/src/auth/oauth-clients-store.js +107 -0
- package/src/auth/oauth-provider.js +149 -0
- package/src/auth/oauth-token-store.js +312 -0
- package/src/nodered/auth.js +158 -0
- package/src/nodered/client.js +199 -0
- package/src/nodered/comms-client.js +500 -0
- package/src/renderer/colors.js +161 -0
- package/src/renderer/geometry.js +115 -0
- package/src/renderer/html-builder.js +571 -0
- package/src/renderer/index.js +51 -0
- package/src/renderer/ir-builder.js +161 -0
- package/src/renderer/layout.js +126 -0
- package/src/renderer/mermaid-builder.js +109 -0
- package/src/renderer/svg-builder.js +228 -0
- package/src/schemas/responses.js +283 -0
- package/src/server.js +844 -0
- package/src/skills/loader.js +84 -0
- package/src/staging-store.js +258 -0
- package/src/tools/add-nodes-to-group.js +216 -0
- package/src/tools/connect-nodes.js +115 -0
- package/src/tools/constants.js +45 -0
- package/src/tools/create-flow.js +87 -0
- package/src/tools/create-node.js +126 -0
- package/src/tools/create-subflow-instance.js +123 -0
- package/src/tools/create-subflow.js +101 -0
- package/src/tools/delete-context.js +60 -0
- package/src/tools/delete-flow.js +81 -0
- package/src/tools/delete-group.js +116 -0
- package/src/tools/delete-node.js +73 -0
- package/src/tools/delete-subflow.js +103 -0
- package/src/tools/deploy.js +94 -0
- package/src/tools/disconnect-nodes.js +158 -0
- package/src/tools/export-flow.js +161 -0
- package/src/tools/export-subflow.js +78 -0
- package/src/tools/flow-utils.js +376 -0
- package/src/tools/get-config-nodes.js +86 -0
- package/src/tools/get-context.js +76 -0
- package/src/tools/get-flow-diagram.js +99 -0
- package/src/tools/get-flow-nodes.js +116 -0
- package/src/tools/get-flows.js +74 -0
- package/src/tools/get-node-detail.js +77 -0
- package/src/tools/get-node-type-detail.js +92 -0
- package/src/tools/get-palette-nodes.js +63 -0
- package/src/tools/get-staging-status.js +34 -0
- package/src/tools/get-subflow-detail.js +110 -0
- package/src/tools/get-subflows.js +105 -0
- package/src/tools/import-flow.js +310 -0
- package/src/tools/inject-message.js +117 -0
- package/src/tools/install-node.js +31 -0
- package/src/tools/read-debug-messages.js +155 -0
- package/src/tools/refresh-staging.js +62 -0
- package/src/tools/remove-nodes-from-group.js +162 -0
- package/src/tools/render-staging.js +69 -0
- package/src/tools/response-utils.js +42 -0
- package/src/tools/search-nodes.js +134 -0
- package/src/tools/uninstall-node.js +31 -0
- package/src/tools/update-flow.js +95 -0
- package/src/tools/update-group.js +77 -0
- package/src/tools/update-node.js +132 -0
- package/src/tools/update-subflow.js +84 -0
- package/src/transport/http.js +252 -0
- package/src/transport/stdio.js +16 -0
- package/src/transport/ws-server.js +223 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Zod output schemas for MCP tool responses.
|
|
3
|
+
*
|
|
4
|
+
* Used by server.js to define outputSchema on each registered tool,
|
|
5
|
+
* enabling LLM clients to understand response shapes without parsing JSON.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
|
|
10
|
+
// ── Staging ─────────────────────────────────────────────────────────
|
|
11
|
+
|
|
12
|
+
export const StagingSummarySchema = z.object({
|
|
13
|
+
pendingChanges: z.number(),
|
|
14
|
+
dirtyNodeIds: z.array(z.string()),
|
|
15
|
+
dirtyFlowIds: z.array(z.string()),
|
|
16
|
+
deployed: z.boolean(),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// ── Flow / Subflow summaries ───────────────────────────────────────
|
|
20
|
+
|
|
21
|
+
export const FlowSummarySchema = z.object({
|
|
22
|
+
id: z.string(),
|
|
23
|
+
label: z.string(),
|
|
24
|
+
type: z.string(),
|
|
25
|
+
disabled: z.boolean(),
|
|
26
|
+
locked: z.boolean(),
|
|
27
|
+
info: z.string(),
|
|
28
|
+
nodeCount: z.number(),
|
|
29
|
+
nodeTypes: z.array(z.string()),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const SubflowSummarySchema = z.object({
|
|
33
|
+
id: z.string(),
|
|
34
|
+
name: z.string(),
|
|
35
|
+
info: z.string().optional(),
|
|
36
|
+
inputCount: z.number(),
|
|
37
|
+
outputCount: z.number(),
|
|
38
|
+
nodeCount: z.number(),
|
|
39
|
+
nodeTypes: z.array(z.string()),
|
|
40
|
+
instanceCount: z.number(),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// ── Node summaries ──────────────────────────────────────────────────
|
|
44
|
+
|
|
45
|
+
export const NodeBasicSchema = z.object({
|
|
46
|
+
id: z.string(),
|
|
47
|
+
type: z.string(),
|
|
48
|
+
name: z.string().optional(),
|
|
49
|
+
disabled: z.boolean().optional(),
|
|
50
|
+
x: z.number().optional(),
|
|
51
|
+
y: z.number().optional(),
|
|
52
|
+
wires: z.array(z.array(z.string())).optional(),
|
|
53
|
+
g: z.string().optional(),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export const ConfigNodeSummarySchema = z.object({
|
|
57
|
+
id: z.string(),
|
|
58
|
+
type: z.string(),
|
|
59
|
+
name: z.string().optional(),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const PaletteNodeSchema = z.object({
|
|
63
|
+
id: z.string().optional(),
|
|
64
|
+
name: z.string().optional(),
|
|
65
|
+
module: z.string(),
|
|
66
|
+
version: z.string().optional(),
|
|
67
|
+
types: z.array(z.string()).optional(),
|
|
68
|
+
enabled: z.boolean().optional(),
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// ── Pagination ──────────────────────────────────────────────────────
|
|
72
|
+
|
|
73
|
+
export const PaginationMeta = z.object({
|
|
74
|
+
offset: z.number(),
|
|
75
|
+
limit: z.number(),
|
|
76
|
+
total: z.number(),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// ── Mutation responses ──────────────────────────────────────────────
|
|
80
|
+
|
|
81
|
+
/** Response for tools that return nodeId + currentState + staging */
|
|
82
|
+
export const CreateNodeResponseSchema = z.object({
|
|
83
|
+
nodeId: z.string(),
|
|
84
|
+
currentState: z.object({}).passthrough(),
|
|
85
|
+
staging: StagingSummarySchema,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
/** Response for flow creation */
|
|
89
|
+
export const CreateFlowResponseSchema = z.object({
|
|
90
|
+
flowId: z.string(),
|
|
91
|
+
currentState: z.object({}).passthrough(),
|
|
92
|
+
staging: StagingSummarySchema,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
/** Response for subflow creation */
|
|
96
|
+
export const CreateSubflowResponseSchema = z.object({
|
|
97
|
+
subflowId: z.string(),
|
|
98
|
+
currentState: z.object({}).passthrough(),
|
|
99
|
+
staging: StagingSummarySchema,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
/** Response for subflow instance creation */
|
|
103
|
+
export const CreateSubflowInstanceResponseSchema = z.object({
|
|
104
|
+
instanceId: z.string(),
|
|
105
|
+
currentState: z.object({}).passthrough(),
|
|
106
|
+
staging: StagingSummarySchema,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
/** Response for updates (previousState + currentState + staging) */
|
|
110
|
+
export const UpdateNodeResponseSchema = z.object({
|
|
111
|
+
previousState: z.object({}).passthrough(),
|
|
112
|
+
currentState: z.object({}).passthrough(),
|
|
113
|
+
staging: StagingSummarySchema,
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
export const UpdateFlowResponseSchema = z.object({
|
|
117
|
+
previousState: z.object({}).passthrough(),
|
|
118
|
+
currentState: z.object({}).passthrough(),
|
|
119
|
+
staging: StagingSummarySchema,
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
export const UpdateSubflowResponseSchema = z.object({
|
|
123
|
+
previousState: z.object({}).passthrough(),
|
|
124
|
+
currentState: z.object({}).passthrough(),
|
|
125
|
+
staging: StagingSummarySchema,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
/** Response for connect-nodes / disconnect-nodes */
|
|
129
|
+
export const WireChangeResponseSchema = z.object({
|
|
130
|
+
previousWires: z.array(z.array(z.string())).optional(),
|
|
131
|
+
currentWires: z.array(z.array(z.string())).optional(),
|
|
132
|
+
staging: StagingSummarySchema,
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
/** Response for add-nodes-to-group */
|
|
136
|
+
export const AddNodesToGroupResponseSchema = z.object({
|
|
137
|
+
groupId: z.string(),
|
|
138
|
+
created: z.boolean(),
|
|
139
|
+
boundingBox: z.object({ x: z.number(), y: z.number(), w: z.number(), h: z.number() }).optional(),
|
|
140
|
+
staging: StagingSummarySchema,
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
/** Response for remove-nodes-from-group */
|
|
144
|
+
export const RemoveNodesFromGroupResponseSchema = z.object({
|
|
145
|
+
removed: z.array(z.string()),
|
|
146
|
+
staging: StagingSummarySchema,
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
/** Response for import-flow */
|
|
150
|
+
export const ImportFlowResponseSchema = z.object({
|
|
151
|
+
imported: z.object({
|
|
152
|
+
flows: z.number(),
|
|
153
|
+
nodes: z.number(),
|
|
154
|
+
configNodes: z.number(),
|
|
155
|
+
}).optional(),
|
|
156
|
+
conflicts: z.number().optional(),
|
|
157
|
+
strategy: z.string().optional(),
|
|
158
|
+
targetFlowId: z.string().optional(),
|
|
159
|
+
staging: StagingSummarySchema,
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
/** Response for delete-node */
|
|
163
|
+
export const DeleteNodeResponseSchema = z.object({
|
|
164
|
+
nodeId: z.string(),
|
|
165
|
+
previousState: z.object({}).passthrough(),
|
|
166
|
+
staging: StagingSummarySchema,
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
/** Response for delete-flow */
|
|
170
|
+
export const DeleteFlowResponseSchema = z.object({
|
|
171
|
+
flowId: z.string(),
|
|
172
|
+
previousState: z.object({}).passthrough(),
|
|
173
|
+
staging: StagingSummarySchema,
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
/** Response for delete-subflow */
|
|
177
|
+
export const DeleteSubflowResponseSchema = z.object({
|
|
178
|
+
subflowId: z.string(),
|
|
179
|
+
previousState: z.object({}).passthrough(),
|
|
180
|
+
staging: StagingSummarySchema,
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
/** Response for delete-group */
|
|
184
|
+
export const DeleteGroupResponseSchema = z.object({
|
|
185
|
+
groupId: z.string(),
|
|
186
|
+
previousState: z.object({}).passthrough(),
|
|
187
|
+
staging: StagingSummarySchema,
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
/** Response for delete-context */
|
|
191
|
+
export const DeleteContextResponseSchema = z.object({
|
|
192
|
+
success: z.boolean(),
|
|
193
|
+
deletedKeys: z.array(z.string()).optional(),
|
|
194
|
+
staging: StagingSummarySchema.optional(),
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
// ── Special tools ───────────────────────────────────────────────────
|
|
198
|
+
|
|
199
|
+
export const DeployResponseSchema = z.object({
|
|
200
|
+
success: z.boolean(),
|
|
201
|
+
deployType: z.enum(['full', 'flows', 'nodes']).optional(),
|
|
202
|
+
message: z.string().optional(),
|
|
203
|
+
previousPendingChanges: z.number().optional(),
|
|
204
|
+
staging: StagingSummarySchema,
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
export const InjectMessageResponseSchema = z.object({
|
|
208
|
+
success: z.boolean(),
|
|
209
|
+
nodeId: z.string(),
|
|
210
|
+
message: z.string().optional(),
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
export const DebugMessagesResponseSchema = z.object({
|
|
214
|
+
messages: z.array(z.object({}).passthrough()),
|
|
215
|
+
count: z.number(),
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
export const UninstallNodeResponseSchema = z.object({
|
|
219
|
+
uninstalled: z.boolean(),
|
|
220
|
+
module: z.string(),
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
export const RefreshStagingResponseSchema = z.object({
|
|
224
|
+
previousState: StagingSummarySchema,
|
|
225
|
+
newState: StagingSummarySchema,
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
// ── Read-only responses ─────────────────────────────────────────────
|
|
229
|
+
|
|
230
|
+
export const FlowNodesResponseSchema = z.object({
|
|
231
|
+
nodes: z.array(NodeBasicSchema),
|
|
232
|
+
total: z.number(),
|
|
233
|
+
offset: z.number(),
|
|
234
|
+
limit: z.number(),
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
export const FlowDiagramResponseSchema = z.object({
|
|
238
|
+
mermaid: z.string(),
|
|
239
|
+
nodeCount: z.number(),
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
export const ConfigNodesResponseSchema = z.object({
|
|
243
|
+
configNodes: z.array(ConfigNodeSummarySchema),
|
|
244
|
+
total: z.number(),
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
export const PaletteNodesResponseSchema = z.object({
|
|
248
|
+
nodes: z.array(PaletteNodeSchema),
|
|
249
|
+
total: z.number(),
|
|
250
|
+
offset: z.number(),
|
|
251
|
+
limit: z.number(),
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
export const SubflowDetailResponseSchema = z.object({
|
|
255
|
+
subflow: z.object({}).passthrough(),
|
|
256
|
+
internalNodes: z.array(NodeBasicSchema),
|
|
257
|
+
instances: z.array(z.object({}).passthrough()),
|
|
258
|
+
mermaid: z.string(),
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
export const SkillListResponseSchema = z.object({
|
|
262
|
+
categories: z.array(
|
|
263
|
+
z.object({
|
|
264
|
+
name: z.string(),
|
|
265
|
+
skills: z.array(
|
|
266
|
+
z.object({
|
|
267
|
+
name: z.string(),
|
|
268
|
+
description: z.string(),
|
|
269
|
+
uri: z.string(),
|
|
270
|
+
useCase: z.string(),
|
|
271
|
+
})
|
|
272
|
+
),
|
|
273
|
+
})
|
|
274
|
+
),
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
export const SuccessResponseSchema = z.object({
|
|
278
|
+
success: z.boolean(),
|
|
279
|
+
message: z.string().optional(),
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
/** Generic passthrough schema for tools with variable/untyped responses. */
|
|
283
|
+
export const GenericObjectSchema = z.object({}).passthrough();
|