MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / spawnServer

Function spawnServer

__tests__/mcp-initialize.test.ts:38–51  ·  view source on GitHub ↗
(cwd: string)

Source from the content-addressed store, hash-verified

36}
37
38function spawnServer(cwd: string): ChildProcessWithoutNullStreams {
39 return spawn(process.execPath, [...WASM_RUNTIME_FLAGS, BIN, 'serve', '--mcp'], {
40 cwd,
41 stdio: ['pipe', 'pipe', 'pipe'],
42 // Pin to direct (in-process) mode. #172 is a contract about the in-process
43 // server's init ordering — the "File watcher active" log this test observes
44 // is emitted in-process. In daemon mode the watcher runs in the detached
45 // daemon (logging to .codegraph/daemon.log, not the child's stderr); the
46 // same response-before-init guarantee lives in the shared session code and
47 // is covered by mcp-daemon.test.ts. Direct mode also avoids leaking a
48 // detached daemon from this suite.
49 env: { ...process.env, CODEGRAPH_NO_DAEMON: '1' },
50 }) as ChildProcessWithoutNullStreams;
51}
52
53function sendInitialize(child: ChildProcessWithoutNullStreams, projectPath: string) {
54 const msg = JSON.stringify({

Callers 1

Calls 1

spawnFunction · 0.85

Tested by

no test coverage detected