fix: scope env var warnings to the server being queried#34
Open
haosenwang1018 wants to merge 1 commit intophilschmid:mainfrom
Open
fix: scope env var warnings to the server being queried#34haosenwang1018 wants to merge 1 commit intophilschmid:mainfrom
haosenwang1018 wants to merge 1 commit intophilschmid:mainfrom
Conversation
Previously, environment variables were substituted eagerly for the entire config at parse time, causing missing-var warnings/errors for ALL servers even when only one server was being queried. Now env var substitution is deferred to getServerConfig(), so warnings only appear for the server being accessed. Fixes philschmid#20
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.
Problem
When running
mcp-cli info <server>, warnings about missing environment variables appear for ALL servers in the config, not just the one being queried (#20). This creates unnecessary noise, especially when using mcp-cli with AI agents.Root Cause
substituteEnvVarsInObject()was called on the entire config at parse time (parseConfig), resolving env vars for every server upfront.Fix
Defer env var substitution to
getServerConfig(), so variables are only resolved for the server being accessed. This means:mcp-cli info chrome-devtoolsonly warns about chrome-devtools' env varsmcp-cli listresolves each server individually, showing warnings per-serverlistServerNames()(keys only) is unaffectedChanges
src/config.ts: Remove eagersubstituteEnvVarsInObject(config)fromparseConfig(), add it togetServerConfig()returnFixes #20