diff --git a/lib/api/routes/companion.js b/lib/api/routes/companion.js index 9e7b797..50fdf40 100644 --- a/lib/api/routes/companion.js +++ b/lib/api/routes/companion.js @@ -62,7 +62,9 @@ spacesScopedRouter.post('/turn', const send = (event, data) => res.write(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`); // Write a per-turn MCP config temp file declaring the companion stdio server. - // DB connection env is inherited from the void-server process — no creds needed here. + // The stdio child is spawned by `claude`; pass the DB/Ollama connection env + // explicitly so the tools work regardless of how claude propagates env to + // MCP children (don't rely on inheritance or cwd-based dotenv). const mcpConfigPath = join(tmpdir(), `void-mcp-${randomUUID()}.json`); const agentActor = { kind: 'agent', @@ -78,7 +80,9 @@ spacesScopedRouter.post('/turn', env: { VOID_SPACE_ID: req.params.space_id, VOID_AGENT_JSON: JSON.stringify(agentActor), - VOID_VIEW_JSON: view ? JSON.stringify(view) : '' + VOID_VIEW_JSON: view ? JSON.stringify(view) : '', + DATABASE_URL: process.env.DATABASE_URL || '', + OLLAMA_URL: process.env.OLLAMA_URL || '' } } }