DEFAULT_INHERITED_ENV_VARS
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend
Research direction
Start in src/client/stdio.ts, especially the Windows branch of DEFAULT_INHERITED_ENV_VARS. Review how the inherited environment is used when spawning MCP servers, then add PATHEXT, COMSPEC, PROGRAMFILES(X86), PROGRAMW6432, and WINDIR to both main and v1.x as applicable. Done means the Windows environment includes all five variables without changing the non-Windows list.
Written by the indexing model from the issue text.
Description
Summary
The Windows branch of DEFAULT_INHERITED_ENV_VARS in src/client/stdio.ts is missing several variables that Windows needs to resolve and execute common commands. As a result, MCP servers that try to spawn npm, git, .bat/.cmd files, or use cmd.exe features can fail in non-obvious ways even when PATH is correctly inherited.
Current state
src/client/stdio.ts (identical on main):
export const DEFAULT_INHERITED_ENV_VARS =
process.platform === 'win32'
? [
'APPDATA', 'HOMEDRIVE', 'HOMEPATH', 'LOCALAPPDATA',
'PATH', 'PROCESSOR_ARCHITECTURE', 'SYSTEMDRIVE',
'SYSTEMROOT', 'TEMP', 'USERNAME', 'USERPROFILE',
'PROGRAMFILES'
]
: ['HOME', 'LOGNAME', 'PATH', 'SHELL', 'TERM', 'USER'];
Missing variables
PATHEXT— Windows uses this to determine which file extensions count as executable when resolving a bare command name. Without it, spawningnpm,git, or any.cmd/.batshim by name fails withENOENTeven whenPATHis set correctly.COMSPEC— Path tocmd.exe. Required by Node'schild_process.spawn({ shell: true }), bynpm runscripts internally, and by anything that shells out viacmd.exe.PROGRAMFILES(X86)— 32-bit Program Files path on 64-bit Windows. Tools that probe both paths get inconsistent results when only one is inherited.PROGRAMW6432— Resolves to the 64-bit Program Files path even from 32-bit processes.WINDIR— Path to the Windows directory. Used as a fallback by some legacy tooling and PowerShell modules.
Proposed change
Add these five variables to the Windows branch of DEFAULT_INHERITED_ENV_VARS. They're non-secret, system-defined, and pose no privacy or security concern beyond what's already inherited (PATH, SYSTEMROOT, etc.).
The same gap exists on both main and v1.x.
- Dominant language
- TypeScript
- Stars
- 13.4k
- Forks
- 2.2k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/typescript-sdk
-
Auth metadata discovery: fallback URL built on resource host instead of authorization-server host Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
modelcontextprotocol/typescript-sdk#2783 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
modelcontextprotocol/typescript-sdk#2766 · 1 comment ·
-
Difficulty 2/5 1-2 days Newbie friendliness 72/100
All issues in modelcontextprotocol/typescript-sdk
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
fullcalendar/fullcalendar#8106 ·