mcp --http: one Streamable HTTP server for every session (token or OAuth introspection auth, project argument per call, roots, origin check)

This commit is contained in:
CRTkafa 2026-10-29 16:19:53 +07:00
parent 28a50e7d2e
commit 5f73fcbcf4
5 changed files with 359 additions and 2 deletions

13
cli/mcp-cmd.ts Normal file
View file

@ -0,0 +1,13 @@
// `storebound mcp`: stdio by default (one process per agent session), or `--http` for one shared server
// (cli/mcp-http.ts: every session of the machine, or a team behind OAuth).
import type { parseArgs } from './lib/args';
export async function run(a: ReturnType<typeof parseArgs>): Promise<void> {
if (!a.has('http')) return (await import('./mcp')).serve();
const { serveHttp } = await import('./mcp-http');
await serveHttp({
host: a.get('host'), port: a.get('port'), roots: a.get('roots'), project: a.get('project'), allowOrigin: a.get('allow-origin'),
auth: a.get('auth'), tokenFile: a.get('token-file'), introspectUrl: a.get('introspect-url'), introspectKeyFile: a.get('introspect-key-file'),
resource: a.get('resource'), issuer: a.get('issuer'), allowRemoteToken: a.has('allow-remote-token'),
});
}