51 lines
1.7 KiB
Markdown
51 lines
1.7 KiB
Markdown
|
|
# mcp-node-red-admin — implementation roadmap
|
||
|
|
|
||
|
|
Status: placeholder. Compose entry exists, server impl is TODO.
|
||
|
|
|
||
|
|
## Goal
|
||
|
|
|
||
|
|
An MCP stdio server that wraps the Node-RED admin HTTP API, exposing the
|
||
|
|
following tools to Claude Code:
|
||
|
|
|
||
|
|
| Tool | Wraps | Use case |
|
||
|
|
|---|---|---|
|
||
|
|
| `node_red_get_flows` | `GET /flows` | Read deployed flow JSON |
|
||
|
|
| `node_red_post_flow` | `POST /flow/:id` (single tab) | Deploy one tab without nuking others |
|
||
|
|
| `node_red_replace_flows` | `POST /flows` (bulk) | Replace the entire flow set |
|
||
|
|
| `node_red_inject` | `POST /inject/:nodeId` | Fire an inject node by id |
|
||
|
|
| `node_red_list_nodes` | `GET /nodes` | Discover registered node types |
|
||
|
|
| `node_red_restart_flow` | `DELETE` + redeploy | Force a restart of one tab |
|
||
|
|
|
||
|
|
## Sketch
|
||
|
|
|
||
|
|
```js
|
||
|
|
// tools/mcp/node-red-admin/server.mjs
|
||
|
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
||
|
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
||
|
|
|
||
|
|
const NODE_RED_HOST = process.env.NODE_RED_HOST;
|
||
|
|
const TOKEN = process.env.NODE_RED_TOKEN;
|
||
|
|
|
||
|
|
const server = new Server({ name: 'evolv-node-red-admin', version: '0.1.0' }, { capabilities: { tools: {} } });
|
||
|
|
server.setRequestHandler(/* listTools */);
|
||
|
|
server.setRequestHandler(/* callTool — fetch NODE_RED_HOST + tool's endpoint */);
|
||
|
|
await server.connect(new StdioServerTransport());
|
||
|
|
```
|
||
|
|
|
||
|
|
## Dockerfile sketch
|
||
|
|
|
||
|
|
```dockerfile
|
||
|
|
FROM node:20-alpine
|
||
|
|
WORKDIR /app
|
||
|
|
COPY package.json server.mjs ./
|
||
|
|
RUN npm install
|
||
|
|
CMD ["node", "server.mjs"]
|
||
|
|
```
|
||
|
|
|
||
|
|
## When to build it
|
||
|
|
|
||
|
|
After we've shipped enough EVOLV flow work that "deploy + fire inject +
|
||
|
|
read state in one turn" becomes the dominant inner loop. Today the
|
||
|
|
`curl` pattern still works for one-off deploys; the MCP earns its
|
||
|
|
keep when the loop runs 5+ times per session.
|