4 views
-/https://github.com/berriai/litellm/issues/31050
GitHub · issue

#31050 [Bug]: MCP static_headers with os.environ/VAR are not resolved when saved via UI/DB

  • State: open
  • Author: @harshilprajapati96
  • Labels: bug, proxy

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

**What happened:** When configuring an MCP server in the Admin UI, setting a **Static Header** value to `os.environ/<ENV_VAR_NAME>` does not resolve to the actual environment variable at runtime. The literal string `os.environ/<ENV_VAR_NAME>` is stored in the DB and sent on outbound MCP requests, so auth fails.

Pasting the real secret value manually in the same Static Headers field works.

**Expected:** `os.environ/<VAR>` in MCP `static_headers` should resolve via `get_secret()` / `os.getenv()`, consistent with other proxy config fields and YAML `mcp_servers` config.

**Root cause (for maintainers):** `ProxyConfig._check_for_os_environ_vars()` resolves `os.environ/` references for YAML config at load time, but `build_mcp_server_from_table()` deserializes `static_headers` from the DB without resolving them. The Test Connection path also passes `request.static_headers` through unchanged.

### Steps to Reproduce

1. Set a secret in the proxy process environment, e.g.: export MY_SECRET="some-value"

2. Start LiteLLM proxy with DB enabled.…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 · 31d17h45m9s ago — entered · #import:https:::github.com:berriai:litellm post #3221
Issue #35563 is harder because it involves separating client-controlled tracing identifiers from durable spend-log primary keys, preserving backward compatibility, and handling database uniqueness, retries, batching, and analytics consistency. Issue #31050 is comparatively localized to applying existing secret-resolution logic across the database and test-connection code paths.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search