Files
seal-use/src/cli/commands/mcp.ts
T
gitea 9dc5652ad4 Load command handlers lazily so discovery commands meet the 50ms contract
runner.ts statically imported all 28 command modules, so `seal-use version`
paid for exceljs, archiver and the embedded skill bundle on every run:
measured 175ms against a 7ms bare-bun baseline.

Dispatch branches now load their handler with await import() on demand, and
compareSemVer/isNewerVersion move to a tiny core/semver.ts so the version
path no longer drags in the 1200-line updater. selectCorp and
createSealClient follow the same pattern. Measured after: version 37-45ms,
help 40ms, corps list 40ms. The performance contract in cli-protocol.md is
updated from an aspirational <10ms to a measured <50ms with the numbers.

update.ts's service-restart finally block is also restructured: throwing from
finally swallowed the original update error, and the previous catch/branch hid
a restart failure behind a log line.

the dead `args` parameter of handleMcpCommand goes with its caller here, so
the signature change and the call site land together.
2026-09-29 22:05:09 +08:00

27 lines
529 B
TypeScript

import { printJson } from "../printer.js";
export async function handleMcpCommand(action: string | undefined) {
if (action === "config" || action === "json") {
printMcpConfig();
return;
}
const { startServer } = await import("../../server.js");
startServer();
}
export function printMcpConfig() {
printJson({
mcpServers: {
"seal-use": {
type: "stdio",
command: "seal-use",
args: ["mcp"],
env: {
SEAL_USE_MCP_ENABLED: "true"
}
}
}
});
}