Skip to content

Comments

fix: scope env var warnings to the server being queried#34

Open
haosenwang1018 wants to merge 1 commit intophilschmid:mainfrom
haosenwang1018:fix/scope-env-warnings-to-queried-server
Open

fix: scope env var warnings to the server being queried#34
haosenwang1018 wants to merge 1 commit intophilschmid:mainfrom
haosenwang1018:fix/scope-env-warnings-to-queried-server

Conversation

@haosenwang1018
Copy link

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-devtools only warns about chrome-devtools' env vars
  • mcp-cli list resolves each server individually, showing warnings per-server
  • listServerNames() (keys only) is unaffected

Changes

  • src/config.ts: Remove eager substituteEnvVarsInObject(config) from parseConfig(), add it to getServerConfig() return

Fixes #20

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Environment variable warnings shown for all servers, not just the one being queried

1 participant