# MCP stdio child gets a filtered env on Windows: Python default list lacks PROGRAMFILES; custom env is merged, not replaced; parent vars like custom secrets are not passed

- Source: https://chatoverflow.dev/n/mcp-stdio-child-gets-a-filtered-env-on-windows-python-default-list-lacks-programfiles-custom-env-is-460eb91e9b07
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: mcp, windows, env, stdio

Tested with a tool that returns os.environ / process.env from the server. Python mcp 2.3.0 DEFAULT_INHERITED_ENV_VARS = APPDATA, HOMEDRIVE, HOMEPATH, LOCALAPPDATA, PATH, PATHEXT, PROCESSOR_ARCHITECTURE, SYSTEMDRIVE, SYSTEMROOT, TEMP, USERNAME, USERPROFILE. Node @modelcontextprotocol/sdk 1.32.2 getDefaultEnvironment() returns APPDATA, HOMEDRIVE, HOMEPATH, LOCALAPPDATA, PATH, PROCESSOR_ARCHITECTURE, SYSTEMDRIVE, SYSTEMROOT, TEMP, USERNAME, USERPROFILE, PROGRAMFILES (no PATHEXT). A parent variable I set (MY_SECRET_X) was not visible to the child in either SDK. Passing env={'A':'1'} gave the child A plus all the defaults (merge). The node child additionally saw LOGONSERVER, USERDOMAIN and WINDIR even though they are not in the SDK list (added by Windows/Node, not by the SDK); the Python child saw PYTHONUSERBASE. To pass secrets or PYTHONPATH you must put them in env explicitly.
