@fnet/cli 0.116.0 → 0.116.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/package.json
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
{# Define macros for reusable code blocks #}
|
|
4
4
|
{% macro importMcpDependencies() %}
|
|
5
|
-
import { Server
|
|
5
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
6
|
+
import { ListToolsRequestSchema, CallToolRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
6
7
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
8
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
8
9
|
import express from "express";
|
|
@@ -26,11 +27,15 @@ import express from "express";
|
|
|
26
27
|
tools: [{
|
|
27
28
|
name: "{{atom.doc.features.cli.mcp.tool.name or atom.doc.name}}",
|
|
28
29
|
description: "{{atom.doc.features.cli.mcp.tool.description or atom.doc.description}}",
|
|
30
|
+
{% if atom.doc.input %}
|
|
31
|
+
inputSchema: {{atom.doc.input | dump | safe}}
|
|
32
|
+
{% else %}
|
|
29
33
|
inputSchema: {
|
|
30
34
|
type: "object",
|
|
31
35
|
properties: {},
|
|
32
36
|
additionalProperties: true
|
|
33
37
|
}
|
|
38
|
+
{% endif %}
|
|
34
39
|
}]
|
|
35
40
|
};
|
|
36
41
|
});
|
|
@@ -60,41 +65,40 @@ import express from "express";
|
|
|
60
65
|
});
|
|
61
66
|
|
|
62
67
|
// Get transport type from arguments
|
|
63
|
-
const transportType = args['mcp-transport
|
|
68
|
+
const transportType = args['mcp-transport'] || args.mcp_transport || 'stdio';
|
|
64
69
|
let transport;
|
|
65
70
|
|
|
66
71
|
if (transportType === 'stdio') {
|
|
67
72
|
// Use stdio transport
|
|
68
73
|
transport = new StdioServerTransport();
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
// Use HTTP transport
|
|
74
|
+
} else if (transportType === 'sse') {
|
|
75
|
+
// Use SSE transport
|
|
72
76
|
const app = express();
|
|
73
77
|
app.use(express.json());
|
|
74
78
|
|
|
75
79
|
const port = args['cli-port'] || args.cli_port || 3000;
|
|
76
80
|
const server = app.listen(port, () => {
|
|
77
|
-
console.log(`MCP server started with
|
|
81
|
+
console.log(`MCP server started with SSE transport on port ${port}`);
|
|
78
82
|
});
|
|
79
83
|
|
|
80
84
|
transport = new StreamableHTTPServerTransport({
|
|
81
85
|
sessionIdGenerator: () => Math.random().toString(36).substring(2, 15),
|
|
82
86
|
});
|
|
83
87
|
|
|
84
|
-
app.post('/
|
|
88
|
+
app.post('/sse', async (req, res) => {
|
|
85
89
|
await transport.handleRequest(req, res, req.body);
|
|
86
90
|
});
|
|
87
91
|
|
|
88
|
-
app.get('/
|
|
92
|
+
app.get('/sse', async (req, res) => {
|
|
89
93
|
await transport.handleRequest(req, res);
|
|
90
94
|
});
|
|
91
95
|
|
|
92
|
-
app.delete('/
|
|
96
|
+
app.delete('/sse', async (req, res) => {
|
|
93
97
|
await transport.handleRequest(req, res);
|
|
94
98
|
});
|
|
95
99
|
} else {
|
|
96
100
|
console.error(`Unknown MCP transport type: ${transportType}`);
|
|
97
|
-
console.error(`Supported types: stdio,
|
|
101
|
+
console.error(`Supported types: stdio, sse`);
|
|
98
102
|
process.exit(1);
|
|
99
103
|
}
|
|
100
104
|
|
|
@@ -121,11 +125,15 @@ import express from "express";
|
|
|
121
125
|
tools: [{
|
|
122
126
|
name: "{{atom.doc.features.cli.mcp.tool.name or atom.doc.name}}",
|
|
123
127
|
description: "{{atom.doc.features.cli.mcp.tool.description or atom.doc.description}}",
|
|
128
|
+
{% if atom.doc.input %}
|
|
129
|
+
inputSchema: {{atom.doc.input | dump | safe}}
|
|
130
|
+
{% else %}
|
|
124
131
|
inputSchema: {
|
|
125
132
|
type: "object",
|
|
126
133
|
properties: {},
|
|
127
134
|
additionalProperties: true
|
|
128
135
|
}
|
|
136
|
+
{% endif %}
|
|
129
137
|
}]
|
|
130
138
|
};
|
|
131
139
|
});
|
|
@@ -158,41 +166,40 @@ import express from "express";
|
|
|
158
166
|
// In a future version, we could expose workflow nodes as separate MCP tools
|
|
159
167
|
|
|
160
168
|
// Get transport type from arguments
|
|
161
|
-
const transportType = args['mcp-transport
|
|
169
|
+
const transportType = args['mcp-transport'] || args.mcp_transport || 'stdio';
|
|
162
170
|
let transport;
|
|
163
171
|
|
|
164
172
|
if (transportType === 'stdio') {
|
|
165
173
|
// Use stdio transport
|
|
166
174
|
transport = new StdioServerTransport();
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
// Use HTTP transport
|
|
175
|
+
} else if (transportType === 'sse') {
|
|
176
|
+
// Use SSE transport
|
|
170
177
|
const app = express();
|
|
171
178
|
app.use(express.json());
|
|
172
179
|
|
|
173
180
|
const port = args['cli-port'] || args.cli_port || 3000;
|
|
174
181
|
const server = app.listen(port, () => {
|
|
175
|
-
console.log(`MCP server started with
|
|
182
|
+
console.log(`MCP server started with SSE transport on port ${port}`);
|
|
176
183
|
});
|
|
177
184
|
|
|
178
185
|
transport = new StreamableHTTPServerTransport({
|
|
179
186
|
sessionIdGenerator: () => Math.random().toString(36).substring(2, 15),
|
|
180
187
|
});
|
|
181
188
|
|
|
182
|
-
app.post('/
|
|
189
|
+
app.post('/sse', async (req, res) => {
|
|
183
190
|
await transport.handleRequest(req, res, req.body);
|
|
184
191
|
});
|
|
185
192
|
|
|
186
|
-
app.get('/
|
|
193
|
+
app.get('/sse', async (req, res) => {
|
|
187
194
|
await transport.handleRequest(req, res);
|
|
188
195
|
});
|
|
189
196
|
|
|
190
|
-
app.delete('/
|
|
197
|
+
app.delete('/sse', async (req, res) => {
|
|
191
198
|
await transport.handleRequest(req, res);
|
|
192
199
|
});
|
|
193
200
|
} else {
|
|
194
201
|
console.error(`Unknown MCP transport type: ${transportType}`);
|
|
195
|
-
console.error(`Supported types: stdio,
|
|
202
|
+
console.error(`Supported types: stdio, sse`);
|
|
196
203
|
process.exit(1);
|
|
197
204
|
}
|
|
198
205
|
|
|
@@ -271,9 +278,7 @@ import { default as Engine } from '../default/{{atom.doc.features.cli_default_en
|
|
|
271
278
|
|
|
272
279
|
{% if atom.doc.features.cli.mcp.enabled===true %}
|
|
273
280
|
{{ importMcpDependencies() }}
|
|
274
|
-
{%
|
|
275
|
-
|
|
276
|
-
{% if atom.doc.features.cli.http.enabled===true %}
|
|
281
|
+
{% elif atom.doc.features.cli.http.enabled===true %}
|
|
277
282
|
// Using express for HTTP mode
|
|
278
283
|
import express from 'express';
|
|
279
284
|
{% endif %}
|
|
@@ -73,41 +73,40 @@
|
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
// Get transport type from arguments
|
|
76
|
-
const transportType = args['mcp-transport
|
|
76
|
+
const transportType = args['mcp-transport'] || args.mcp_transport || 'stdio';
|
|
77
77
|
let transport;
|
|
78
78
|
|
|
79
79
|
if (transportType === 'stdio') {
|
|
80
80
|
// Use stdio transport
|
|
81
81
|
transport = new StdioServerTransport();
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
// Use HTTP transport
|
|
82
|
+
} else if (transportType === 'sse') {
|
|
83
|
+
// Use SSE transport
|
|
85
84
|
const app = express();
|
|
86
85
|
app.use(express.json());
|
|
87
86
|
|
|
88
87
|
const port = args['cli-port'] || args.cli_port || 3000;
|
|
89
88
|
const server = app.listen(port, () => {
|
|
90
|
-
console.log(`MCP server started with
|
|
89
|
+
console.log(`MCP server started with SSE transport on port ${port}`);
|
|
91
90
|
});
|
|
92
91
|
|
|
93
92
|
transport = new StreamableHTTPServerTransport({
|
|
94
93
|
sessionIdGenerator: () => Math.random().toString(36).substring(2, 15),
|
|
95
94
|
});
|
|
96
95
|
|
|
97
|
-
app.post('/
|
|
96
|
+
app.post('/sse', async (req, res) => {
|
|
98
97
|
await transport.handleRequest(req, res, req.body);
|
|
99
98
|
});
|
|
100
99
|
|
|
101
|
-
app.get('/
|
|
100
|
+
app.get('/sse', async (req, res) => {
|
|
102
101
|
await transport.handleRequest(req, res);
|
|
103
102
|
});
|
|
104
103
|
|
|
105
|
-
app.delete('/
|
|
104
|
+
app.delete('/sse', async (req, res) => {
|
|
106
105
|
await transport.handleRequest(req, res);
|
|
107
106
|
});
|
|
108
107
|
} else {
|
|
109
108
|
console.error(`Unknown MCP transport type: ${transportType}`);
|
|
110
|
-
console.error(`Supported types: stdio,
|
|
109
|
+
console.error(`Supported types: stdio, sse`);
|
|
111
110
|
process.exit(1);
|
|
112
111
|
}
|
|
113
112
|
|
|
@@ -191,9 +190,7 @@ import Node from '../../../cli';
|
|
|
191
190
|
|
|
192
191
|
{% if atom.doc.features.cli.mcp.enabled===true %}
|
|
193
192
|
{{ importMcpDependencies('esm') }}
|
|
194
|
-
{%
|
|
195
|
-
|
|
196
|
-
{% if atom.doc.features.cli.http.enabled===true %}
|
|
193
|
+
{% elif atom.doc.features.cli.http.enabled===true %}
|
|
197
194
|
// Using express for HTTP mode
|
|
198
195
|
import express from 'express';
|
|
199
196
|
{% endif %}
|
|
@@ -223,9 +220,8 @@ import Node from '../../../src';
|
|
|
223
220
|
|
|
224
221
|
{% if atom.doc.features.cli.mcp.enabled===true %}
|
|
225
222
|
{{ importMcpDependencies('esm') }}
|
|
226
|
-
{%
|
|
227
|
-
|
|
228
|
-
{% if atom.doc.features.cli.http.enabled===true %}
|
|
223
|
+
{% elif atom.doc.features.cli.http.enabled===true %}
|
|
224
|
+
// Using express for HTTP mode
|
|
229
225
|
import express from 'express';
|
|
230
226
|
{% endif %}
|
|
231
227
|
|
|
@@ -260,9 +256,7 @@ const Node = require('../../../cli');
|
|
|
260
256
|
|
|
261
257
|
{% if atom.doc.features.cli.mcp.enabled===true %}
|
|
262
258
|
{{ importMcpDependencies('cjs') }}
|
|
263
|
-
{%
|
|
264
|
-
|
|
265
|
-
{% if atom.doc.features.cli.http.enabled===true %}
|
|
259
|
+
{% elif atom.doc.features.cli.http.enabled===true %}
|
|
266
260
|
// Using express for HTTP mode
|
|
267
261
|
const express = require('express');
|
|
268
262
|
{% endif %}
|
|
@@ -292,9 +286,8 @@ const Node = require('../../../src');
|
|
|
292
286
|
|
|
293
287
|
{% if atom.doc.features.cli.mcp.enabled===true %}
|
|
294
288
|
{{ importMcpDependencies('cjs') }}
|
|
295
|
-
{%
|
|
296
|
-
|
|
297
|
-
{% if atom.doc.features.cli.http.enabled===true %}
|
|
289
|
+
{% elif atom.doc.features.cli.http.enabled===true %}
|
|
290
|
+
// Using express for HTTP mode
|
|
298
291
|
const express = require('express');
|
|
299
292
|
{% endif %}
|
|
300
293
|
|