@fnet/cli 0.116.0 → 0.116.2

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fnet/cli",
3
- "version": "0.116.0",
3
+ "version": "0.116.2",
4
4
  "files": [
5
5
  "dist",
6
6
  "template"
@@ -60,8 +60,16 @@
60
60
  {% if atom.doc.features.cli.enabled %}
61
61
  {% if atom.doc.features.project.format ==='cjs' %}
62
62
  ,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/index.cjs"
63
+ {% if atom.doc.features.cli.mcp.enabled===true %}
64
+ ,"mcp": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/index.cjs --cli-mode=mcp"
65
+ ,"mcp-inspect": "bunx @modelcontextprotocol/inspector bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/index.cjs --cli-mode=mcp"
66
+ {% endif %}
63
67
  {% else %}
64
68
  ,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/"
69
+ {% if atom.doc.features.cli.mcp.enabled===true %}
70
+ ,"mcp": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/ --cli-mode=mcp"
71
+ ,"mcp-inspect": "bunx @modelcontextprotocol/inspector bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/ --cli-mode=mcp"
72
+ {% endif %}
65
73
  {% endif %}
66
74
  ,"compile": "fbin compile {{atom.doc.features.cli.dir}}/index.js -o .bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}}"
67
75
  ,"install-bin": "fbin install ./.bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}} --yes"
@@ -2,7 +2,8 @@
2
2
 
3
3
  {# Define macros for reusable code blocks #}
4
4
  {% macro importMcpDependencies() %}
5
- import { Server, ListToolsRequestSchema, CallToolRequestSchema } from "@modelcontextprotocol/sdk/server/mcp.js";
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-type'] || args.mcp_transport_type || 'stdio';
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
- console.log("MCP server started with stdio transport");
70
- } else if (transportType === 'http') {
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 HTTP transport on port ${port}`);
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('/mcp', async (req, res) => {
88
+ app.post('/sse', async (req, res) => {
85
89
  await transport.handleRequest(req, res, req.body);
86
90
  });
87
91
 
88
- app.get('/mcp', async (req, res) => {
92
+ app.get('/sse', async (req, res) => {
89
93
  await transport.handleRequest(req, res);
90
94
  });
91
95
 
92
- app.delete('/mcp', async (req, res) => {
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, http`);
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-type'] || args.mcp_transport_type || 'stdio';
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
- console.log("MCP server started with stdio transport");
168
- } else if (transportType === 'http') {
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 HTTP transport on port ${port}`);
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('/mcp', async (req, res) => {
189
+ app.post('/sse', async (req, res) => {
183
190
  await transport.handleRequest(req, res, req.body);
184
191
  });
185
192
 
186
- app.get('/mcp', async (req, res) => {
193
+ app.get('/sse', async (req, res) => {
187
194
  await transport.handleRequest(req, res);
188
195
  });
189
196
 
190
- app.delete('/mcp', async (req, res) => {
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, http`);
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
- {% endif %}
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-type'] || args.mcp_transport_type || 'stdio';
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
- console.log("MCP server started with stdio transport");
83
- } else if (transportType === 'http') {
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 HTTP transport on port ${port}`);
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('/mcp', async (req, res) => {
96
+ app.post('/sse', async (req, res) => {
98
97
  await transport.handleRequest(req, res, req.body);
99
98
  });
100
99
 
101
- app.get('/mcp', async (req, res) => {
100
+ app.get('/sse', async (req, res) => {
102
101
  await transport.handleRequest(req, res);
103
102
  });
104
103
 
105
- app.delete('/mcp', async (req, res) => {
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, http`);
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
- {% endif %}
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
- {% endif %}
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
- {% endif %}
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
- {% endif %}
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