@fnet/cli 0.2.6 → 0.2.8

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.2.6",
3
+ "version": "0.2.8",
4
4
  "files": [
5
5
  "dist",
6
6
  "template"
@@ -11,7 +11,9 @@ app.use(express.json());
11
11
 
12
12
  const port = args['cli-port'] || args.cli_port || 3000;
13
13
  const host = args['cli-host'] || args.cli_host || '0.0.0.0';
14
- const mcpEndpoint = '/mcp';
14
+ const basePath = '{{atom.doc.features.cli.mcp.path or 'mcp'}}';
15
+ const mcpEndpoint = `/${basePath}`; // MCP protocol endpoint
16
+ const httpEndpoint = `/${basePath}/input`; // HTTP input endpoint
15
17
  const verbose = args['cli-verbose'] || args.cli_verbose || false;
16
18
 
17
19
  // Verbose logging helper
@@ -105,9 +107,35 @@ app.get(mcpEndpoint, handleSessionRequest);
105
107
  // Handle DELETE requests for session termination
106
108
  app.delete(mcpEndpoint, handleSessionRequest);
107
109
 
110
+ // Handle HTTP POST requests for normal input processing (non-MCP)
111
+ app.post(httpEndpoint, async (req, res) => {
112
+ log('HTTP input request received');
113
+ log('Request body:', JSON.stringify(req.body, null, 2));
114
+
115
+ try {
116
+ // Call the Node function directly with the request body
117
+ const result = await Node(req.body);
118
+
119
+ log('HTTP input processed successfully');
120
+ log('Result:', JSON.stringify(result, null, 2));
121
+
122
+ // Return the result as JSON
123
+ res.json(result);
124
+ } catch (error) {
125
+ log('HTTP input processing error:', error.message);
126
+
127
+ // Return error response
128
+ res.status(500).json({
129
+ error: error.message,
130
+ stack: verbose ? error.stack : undefined
131
+ });
132
+ }
133
+ });
134
+
108
135
  app.listen(port, host, () => {
109
136
  console.log(`MCP server started with Streamable HTTP transport`);
110
- console.log(`Endpoint: http://${host}:${port}${mcpEndpoint}`);
137
+ console.log(`MCP endpoint: http://${host}:${port}${mcpEndpoint}`);
138
+ console.log(`HTTP endpoint: http://${host}:${port}${httpEndpoint}`);
111
139
  console.log(`Listening on ${host}:${port}`);
112
140
  if (verbose) {
113
141
  console.log(`Verbose logging enabled`);