@fnet/cli 0.118.4 → 0.119.0
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
|
@@ -71,34 +71,37 @@
|
|
|
71
71
|
if (transportType === 'stdio') {
|
|
72
72
|
// Use stdio transport
|
|
73
73
|
transport = new StdioServerTransport();
|
|
74
|
-
} else if (transportType === '
|
|
75
|
-
// Use
|
|
74
|
+
} else if (transportType === 'http') {
|
|
75
|
+
// Use Streamable HTTP transport (modern HTTP transport)
|
|
76
76
|
const app = express();
|
|
77
77
|
app.use(express.json());
|
|
78
78
|
|
|
79
79
|
const port = args['cli-port'] || args.cli_port || 3000;
|
|
80
|
-
const
|
|
81
|
-
console.log(`MCP server started with
|
|
80
|
+
const httpServer = app.listen(port, () => {
|
|
81
|
+
console.log(`MCP server started with Streamable HTTP transport on port ${port}`);
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
transport = new StreamableHTTPServerTransport({
|
|
85
85
|
sessionIdGenerator: () => Math.random().toString(36).substring(2, 15),
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
// Handle POST requests for client-to-server communication
|
|
89
|
+
app.post('/mcp', async (req, res) => {
|
|
89
90
|
await transport.handleRequest(req, res, req.body);
|
|
90
91
|
});
|
|
91
92
|
|
|
92
|
-
|
|
93
|
+
// Handle GET requests for server-to-client notifications via SSE
|
|
94
|
+
app.get('/mcp', async (req, res) => {
|
|
93
95
|
await transport.handleRequest(req, res);
|
|
94
96
|
});
|
|
95
97
|
|
|
96
|
-
|
|
98
|
+
// Handle DELETE requests for session termination
|
|
99
|
+
app.delete('/mcp', async (req, res) => {
|
|
97
100
|
await transport.handleRequest(req, res);
|
|
98
101
|
});
|
|
99
102
|
} else {
|
|
100
103
|
console.error(`Unknown MCP transport type: ${transportType}`);
|
|
101
|
-
console.error(`Supported types: stdio,
|
|
104
|
+
console.error(`Supported types: stdio, http`);
|
|
102
105
|
process.exit(1);
|
|
103
106
|
}
|
|
104
107
|
|