Skip to content

fix: include PROGRAMDATA in inherited Windows environment - #3334

Closed
AbarnaaSree wants to merge 1 commit into
modelcontextprotocol:mainfrom
AbarnaaSree:fix-windows-process-tree-cleanup
Closed

fix: include PROGRAMDATA in inherited Windows environment#3334
AbarnaaSree wants to merge 1 commit into
modelcontextprotocol:mainfrom
AbarnaaSree:fix-windows-process-tree-cleanup

Conversation

@AbarnaaSree

Copy link
Copy Markdown

Description

Fixes a Windows-specific MCP SSH transport issue where the subprocess can terminate shortly after the initialize message.

On Windows, the stdio client builds a restricted inherited environment for spawned MCP server processes. PROGRAMDATA was missing from the inherited environment variables.

This can cause Windows executables such as ssh.exe and related process behavior to differ from a normal environment.

Change

Added PROGRAMDATA to DEFAULT_INHERITED_ENV_VARS in src/mcp/client/stdio.py.

Testing

  • Reproduced the original Windows MCP + SSH failure.
  • Reproduced the behavior outside Claude Desktop.
  • Tested the restricted environment with Popen.
  • Verified that PROGRAMDATA is now included.
  • Ran the stdio client test suite successfully: 25 passed, 8 skipped.
  • git diff --check passes.

Related Issue

Fixes/addresses MCP SSH transport closing immediately on Windows after the initialize message.

Issue: #1822

@github-actions github-actions Bot added the missing-issue-link Auto-closed: PR needs a linked issue assigned to its author (see CONTRIBUTING.md) label Aug 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the contribution. This repository only keeps pull requests open when they're linked to an issue that a maintainer has assigned to the author — CONTRIBUTING.md explains why and how we work. This PR has been closed for now because its description doesn't yet link an open issue in this repository (with Fixes #123 or similar).

If there isn't an issue for this yet, please open one — a clear description of the problem is genuinely the most useful thing for us. Then add Fixes #<number> to this PR's description. If a maintainer would like the change as a PR from you, they'll assign you to the issue and this PR will reopen automatically.

There's no need to open a new PR — this one will be reopened. While it's closed, please push any updates as new commits rather than force-pushing, since GitHub can't reopen a PR whose branch has been rewritten.

Maintainers: reopening this PR, removing the missing-issue-link label, or adding bypass-issue-check bypasses the check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

missing-issue-link Auto-closed: PR needs a linked issue assigned to its author (see CONTRIBUTING.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant