fix: set cwd to homedir when spawning chroma-mcp to prevent pydantic .env.local crash (#1297)

chroma-mcp uses pydantic-settings which auto-reads .env/.env.local from
the CWD. When the project directory contains non-chroma variables (e.g.
CELERY_TASK_ALWAYS_EAGER), pydantic rejects them with "Extra inputs are
not permitted", crashing the subprocess and triggering a permanent
backoff loop. Passing cwd: os.homedir() to StdioClientTransport ensures
pydantic never reads project env files.

Generated by Claude Code
Vibe coded by ousamabenyounes

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ousama Ben Younes
2026-04-10 09:55:02 +00:00
parent 3651a34e96
commit c7c4fd54d6
2 changed files with 59 additions and 0 deletions
+6
View File
@@ -116,10 +116,16 @@ export class ChromaMcpManager {
args: uvxSpawnArgs.join(' ')
});
// Run chroma-mcp from the home directory so that pydantic-settings (used
// by chroma-mcp internally) does not pick up .env / .env.local files from
// the project directory. Those files often contain project-specific vars
// that pydantic rejects with "Extra inputs are not permitted", crashing the
// subprocess immediately. Fixes #1297.
this.transport = new StdioClientTransport({
command: uvxSpawnCommand,
args: uvxSpawnArgs,
env: spawnEnvironment,
cwd: os.homedir(),
stderr: 'pipe'
});