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

Function spawnServer

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

Source from the content-addressed store, hash-verified

20const BIN = path.resolve(__dirname, '../dist/bin/codegraph.js');
21
22function spawnServer(cwd: string): ChildProcessWithoutNullStreams {
23 return spawn(process.execPath, [BIN, 'serve', '--mcp'], {
24 cwd,
25 stdio: ['pipe', 'pipe', 'pipe'],
26 // Pin to direct (in-process) mode. #172 is a contract about the in-process
27 // server's init ordering — the "File watcher active" log this test observes
28 // is emitted in-process. In daemon mode the watcher runs in the detached
29 // daemon (logging to .codegraph/daemon.log, not the child's stderr); the
30 // same response-before-init guarantee lives in the shared session code and
31 // is covered by mcp-daemon.test.ts. Direct mode also avoids leaking a
32 // detached daemon from this suite.
33 env: { ...process.env, CODEGRAPH_NO_DAEMON: '1' },
34 }) as ChildProcessWithoutNullStreams;
35}
36
37function sendInitialize(child: ChildProcessWithoutNullStreams, projectPath: string) {
38 const msg = JSON.stringify({

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected