MCPcopy Create free account
hub / github.com/agenticsorg/edge-agents / apiCommand

Function apiCommand

scripts/sparc2/src/cli/apiCommand.ts:14–44  ·  view source on GitHub ↗
(
  args: Record<string, any>,
  options: Record<string, any>,
)

Source from the content-addressed store, hash-verified

12 * @param options Command options
13 */
14export async function apiCommand(
15 args: Record<string, any>,
16 options: Record<string, any>,
17): Promise<void> {
18 try {
19 const port = options.port ? parseInt(options.port, 10) : 3001;
20
21 // Server startup will be logged in the mcpServer module
22
23 // Start the MCP HTTP API server
24 await startMCPServer({
25 port,
26 model: options.model,
27 mode: options.mode as "automatic" | "semi" | "manual" | "custom" | "interactive",
28 diffMode: options.diffMode as "file" | "function",
29 processing: options.processing as "sequential" | "parallel" | "concurrent" | "swarm",
30 configPath: options.config,
31 });
32
33 // Keep the process running
34 await new Promise(() => {
35 // This promise never resolves, keeping the process alive
36 console.log(`SPARC2 API server running on http://localhost:${port}`);
37 console.log("Press Ctrl+C to stop the server");
38 });
39 } catch (error: unknown) {
40 const errorMessage = error instanceof Error ? error.message : String(error);
41 console.error(`Error starting API server: ${errorMessage}`);
42 Deno.exit(1);
43 }
44}

Callers

nothing calls this directly

Calls 1

startMCPServerFunction · 0.90

Tested by

no test coverage detected