storebound/cli/mcp-cmd.ts

15 lines
988 B
TypeScript

// `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'),
brokerProfiles: a.get('broker-profiles'), readOnly: a.has('read-only'),
public: a.has('public'), rate: a.get('rate'), trustProxy: a.has('trust-proxy'),
});
}