Bug: MCP stdio client doesn't propagate parent env to server subprocess #18

Closed
opened 2026-04-08 21:12:52 +00:00 by claude-code · 0 comments
Collaborator

Discovered during M2.3 smoke test.

cli/main.py spawns the web researcher MCP server via StdioServerParameters. By default the mcp SDK does not pass the parent process's environment to the child, so env vars like MARCHWARDEN_MODEL set on the CLI process were silently lost.

Workaround already shipped on chore/smoke-test-1: pass env=os.environ.copy() to StdioServerParameters. This unblocks the smoke test but should be reviewed — copying the full env may be too broad. A future fix could whitelist MARCHWARDEN_* plus any keys the server actually reads.

Discovered during M2.3 smoke test. `cli/main.py` spawns the web researcher MCP server via `StdioServerParameters`. By default the `mcp` SDK does not pass the parent process's environment to the child, so env vars like `MARCHWARDEN_MODEL` set on the CLI process were silently lost. **Workaround already shipped on `chore/smoke-test-1`:** pass `env=os.environ.copy()` to `StdioServerParameters`. This unblocks the smoke test but should be reviewed — copying the full env may be too broad. A future fix could whitelist `MARCHWARDEN_*` plus any keys the server actually reads.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: archeious/marchwarden#18
No description provided.