Switch MCP transport from stdio to Streamable HTTP

Mount POST /mcp on the main Express app (stateless Streamable HTTP).
Keep optional MCP-only HTTP process via npm run mcp. Update docs.
This commit is contained in:
2026-08-07 08:51:59 +02:00
parent f7f1481a39
commit 3032f2ea85
6 changed files with 152 additions and 58 deletions

View File

@@ -1,4 +1,6 @@
const express = require('express');
const { formatSize, createWebshareMcpServer } = require('../src/mcp-server');
const { registerMcpHttp } = require('../src/mcp-http');
describe('formatSize', () => {
it('formats bytes', () => {
@@ -17,3 +19,14 @@ describe('createWebshareMcpServer', () => {
expect(server.server).toBeDefined();
});
});
describe('registerMcpHttp', () => {
it('registers POST /mcp on an express app', () => {
const app = express();
registerMcpHttp(app, { username: 'u', password: 'p', path: '/mcp' });
const layer = app._router.stack.find(
(l) => l.route && l.route.path === '/mcp' && l.route.methods.post
);
expect(layer).toBeTruthy();
});
});