Skip to content

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

@filipeestacio

Description

@filipeestacio

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

Description

When running mcp-cli info <server>, warnings about missing environment variables are displayed for ALL servers in the config, not just the server being queried. This creates unnecessary noise, especially when using mcp-cli with AI agents.

Steps to Reproduce

  1. Create config with multiple servers, some using ${VAR} placeholders
  2. Run mcp-cli info chrome-devtools (a server without env vars)
  3. See warnings for all OTHER servers' missing env vars

Expected Behavior

Warnings should only appear for environment variables referenced by the server being queried (or all servers when running mcp-cli info without arguments).

Actual Behavior

[mcp-cli] Warning: Missing environment variable: ${MCP_EMAIL_SERVER_ACCOUNT_NAME}
[mcp-cli] Warning: Missing environment variable: ${CONTEXT7_API_KEY}
...
# Even though I'm only querying chrome-devtools which doesn't use these

Related

Proposed Solution

  1. Lazy evaluation: Only substitute env vars for the server(s) being accessed
  2. OR: Filter warnings to only show for relevant servers
  3. Combine with only show STDERR with -v or -debug #17: Only show warnings in debug mode

Workaround

MCP_STRICT_ENV=false mcp-cli info chrome-devtools 2>/dev/null

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions