fix(mcp): add environment variable support for stdio MCP servers #62
No reviewers
Labels
No Label
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sarman/tftsr-devops_investigation#62
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "bug/mcp-env-vars-support"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description:
MCP servers that require environment variables at startup (e.g. GitHub MCP server which needs
GITHUB_PERSONAL_ACCESS_TOKEN) were failing with "connection closed: initialize response" because the stdio transport had
no mechanism to pass env vars to the spawned process.
Changes:
Both are merged at discovery time (encrypted takes precedence). Dangerous privilege-escalation vars (LD_PRELOAD,
DYLD_INSERT_LIBRARIES, etc.) are rejected
logs)
an optional custom headers field
GitHub MCP) don't implement the optional resources capability
Testing:
dangerous var rejection, and env var parsing
GITHUB_PERSONAL_ACCESS_TOKEN are provided
Automated PR Review (qwen3-coder-next via liteLLM):\n\nSummary
The PR adds environment variable support for stdio MCP servers, enhancing security by encrypting sensitive env vars and merging them with plaintext ones. However, it introduces a critical logic flaw where the environment variable merging incorrectly overwrites encrypted values with plaintext values instead of the intended precedence.
Findings
Evidence: Fix: Swap the merge logic so encrypted values overwrite plaintext ones: (Per comment and docs, encrypted values must take precedence.)
Verdict: REQUEST CHANGES