Files
hose-use/src/cli/commands/mcp.ts
T

17 lines
608 B
TypeScript

import { usageError } from "../errors.js";
import type { CliParsedArgs, CliResult, CliRunOptions } from "../types.js";
export async function handleMcpCommand(
parsed: CliParsedArgs,
options: CliRunOptions
): Promise<CliResult> {
if (parsed.action && parsed.action !== "serve") {
throw usageError(`未知 mcp 子命令: ${parsed.action}。用法: hose-use mcp [serve]`);
}
// Lazy loading avoids a runner -> registry -> server -> runner startup cycle.
const { startServer } = await import("../../server.js");
await startServer(options);
return { stdout: "", stderr: "", exitCode: 0 };
}