fix(providers): expand ${VAR_NAME} brace syntax in MCP config env vars#1726
Closed
coleam00 wants to merge 3 commits into
Closed
fix(providers): expand ${VAR_NAME} brace syntax in MCP config env vars#1726coleam00 wants to merge 3 commits into
coleam00 wants to merge 3 commits into
Conversation
fixes #1612) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update JSDoc for expandEnvVarsInRecord to document both $VAR_NAME and ${VAR_NAME} expansion forms.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
expandEnvVarsInRecordinpackages/providers/src/mcp/config.tsonly matched bare$VAR_NAMEsyntax. Users writing${VAR_NAME}in MCP configenv/headersfields had their variables silently left unexpanded and never reported inmissingVars.${GITHUB_TOKEN}). Without this fix, secrets are silently not injected, causing MCP servers to start with missing credentials — no error surfaced.$VARand${VAR}forms. Added 4 targeted tests and updated the MCP servers doc.expandEnvVarsInRecordlogic — error handling,missingVarstracking, caller sites — is unchanged. Bare$VARbehavior is identical.UX Journey
Before
After
Architecture Diagram
Before
After
Connection inventory:
config.ts:expandEnvVarsInRecordconfig.ts:expandEnvVarsInRecordmissingVarsdag-executor.test.tsloadMcpConfigmcp-servers.mdLabel Snapshot
risk: lowsize: XSprovidersproviders:mcpChange Metadata
bugprovidersLinked Issue
Validation Evidence (required)
bun run validaterun post code-review fixSecurity Impact (required)
Compatibility / Migration
$VARbehavior is unchangedHuman Verification (required)
$VAR/${VAR}, and missing-var reportingmissingVarsSide Effects / Blast Radius (required)
expandEnvVarsInRecord)missingVarsreporting unchanged; existing bare-$VARtests all passRollback Plan (required)
packages/providers/src/mcp/config.ts${VAR}syntaxRisks and Mitigations
\$; both branches are[A-Z_][A-Z0-9_]*— no nested quantifiers possible. No backtracking risk.