litellm/litellm
mateo-berri fc8ad45ba3 feat(mcp): per-user env-vars for MCP servers (backend + UI wiring)
Adds end-to-end support for per-server env-var definitions and per-user
values that interpolate `${VAR}` placeholders in `static_headers` at
tool-call time.

Schema:
- New `env_vars` JSONB column on `LiteLLM_MCPServerTable` (list of
  `{name, scope: "instance"|"per_user", value}`); per-user values reuse
  `LiteLLM_MCPUserCredentials` with payload `type="vars"`.

Backend:
- `litellm/proxy/_experimental/mcp_server/env_vars.py` — parse / resolve
  / interpolate helpers + `MissingEnvVarsError`.
- `MCPServerManager._resolve_env_vars_for_server` substitutes
  placeholders before merging extra headers. Missing required per-user
  vars surface as `CallToolResult(isError=True)` with a dashboard
  deep-link, so MCP clients (Claude Code, etc.) print the message to
  the user.
- `GET`/`POST /v1/mcp/server/{server_id}/my-env-vars` for the fill
  modal and status pill. Only `per_user` definitions are returned;
  instance values stay admin-only. Stale names (after a rename or scope
  flip) are trimmed on both read and write paths.

UI:
- Fill modal + status pill now hit the real endpoints (mocks remain as
  fallback for demo mode).
- `MCPServer` type gains `env_vars`; networking helpers
  `getMyMcpEnvVars` / `storeMyMcpEnvVars` added.

Tests:
- New `tests/test_litellm/proxy/_experimental/mcp_server/test_env_vars.py`
  covers parse / collect / resolve / interpolate / missing_required and
  user-var storage round-trip.
- Manager tests extended to exercise placeholder interpolation and the
  missing-vars deep-link error path.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-23 19:11:41 -07:00
..
a2a_protocol feat(guardrails): LLM-as-a-Judge guardrail (#26360) 2026-04-24 17:15:32 -07:00
anthropic_interface style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
assistants
batch_completion
batches fix(vertex-ai): fix zero cost/usage on completed Vertex AI batch jobs (#27912) 2026-05-15 04:47:02 -07:00
caching fix(caching): replay openai/responses bridge cache hits as chat streams (#28158) 2026-05-18 16:27:06 -07:00
completion_extras fix(caching): replay openai/responses bridge cache hits as chat streams (#28158) 2026-05-18 16:27:06 -07:00
compression Prompt Compression - add it to the proxy (#25729) 2026-04-20 15:08:00 -07:00
containers style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
endpoints/speech/speech_to_completion_bridge
evals style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
experimental_mcp_client feat(mcp): add OBO MCP Auth (#27421) 2026-05-07 15:35:21 -07:00
files thread trusted params through vertex file content 2026-05-01 18:24:22 -07:00
fine_tuning address greptile review feedback (greploop iteration 1) 2026-03-27 20:04:41 +05:30
google_genai feat(proxy): LiteLLM headers on Google native generateContent routes (#25500) 2026-04-29 12:34:14 -07:00
images Feat(dashscope): add image generation support for qwen-image-2.0 and qwen-image-2.0-pro (#25672) 2026-04-22 20:03:46 -07:00
integrations feat: propagate team_id and team_alias to all child OTEL spans (#28273) 2026-05-19 15:31:25 -07:00
interactions feat(interactions): migrate to Google Interactions API steps schema (May 2026) (#28153) 2026-05-20 13:32:12 -07:00
litellm_core_utils Day 0 support : Gemini 3.5 Flash (#28268) 2026-05-19 15:50:54 -07:00
llms feat(interactions): migrate to Google Interactions API steps schema (May 2026) (#28153) 2026-05-20 13:32:12 -07:00
ocr chore: reject bare str at file-input sinks to prevent local-file read (#27762) 2026-05-12 16:40:07 -07:00
passthrough fix(passthrough): log when streaming spend-tracking flush fails to schedule 2026-04-30 02:39:29 +00:00
proxy feat(mcp): per-user env-vars for MCP servers (backend + UI wiring) 2026-05-23 19:11:41 -07:00
proxy_auth
rag style: black formatting 2026-04-25 14:47:54 -07:00
realtime_api
rerank_api Fix review 2026-04-30 09:10:24 +05:30
responses fix(responses): preserve cache_control in Responses API -> Chat Completion transformation (#27727) 2026-05-13 12:17:06 -07:00
router_strategy feat: add weighted-routing failover (#27980) 2026-05-15 17:28:54 +00:00
router_utils fix(responses): register cooldowns on failure + fail fast on stale encrypted_content (#27820) 2026-05-13 09:03:13 -07:00
search style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
secret_managers Implement normalize_nonempty_secret_str function to trim whitespace from secrets and treat empty values as unset. Update proxy_server to use this function for Grafana credentials. Enhance tests to validate the new normalization behavior. 2026-05-04 18:17:31 +00:00
skills chore(proxy): scope skills and container resources 2026-04-30 18:23:58 -07:00
types feat(mcp): per-user env-vars for MCP servers (backend + UI wiring) 2026-05-23 19:11:41 -07:00
vector_store_files
vector_stores chore(vector stores): tighten managed store access 2026-04-30 15:04:25 -07:00
videos style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
__init__.py feat(interactions): migrate to Google Interactions API steps schema (May 2026) (#28153) 2026-05-20 13:32:12 -07:00
_internal_context.py fix(proxy): harden request parameter handling 2026-04-16 01:38:12 +00:00
_lazy_imports.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
_lazy_imports_registry.py fix(utils): import get_secret at runtime (#28014) 2026-05-15 14:01:18 -07:00
_logging.py fix(bedrock-mantle): use /anthropic/v1/messages path for Mantle endpo… (#27976) 2026-05-15 13:31:59 -07:00
_redis.py Litellm oss staging (#28161) 2026-05-18 16:27:44 -07:00
_redis_credential_provider.py feat: add ability to auth to azure with token (#27556) 2026-05-09 22:34:09 +00:00
_service_logger.py
_uuid.py
_version.py
anthropic_beta_headers_config.json fix(anthropic,bedrock,databricks): four reasoning_effort follow-ups 2026-05-03 10:03:53 -07:00
anthropic_beta_headers_manager.py
blog_posts.json
budget_manager.py docs(budget_manager): add docstring to BudgetManager.reset_cost (#27867) 2026-05-13 13:28:22 -07:00
constants.py feat(mcp): support MCP access group names in URL-based namespacing (#27726) 2026-05-13 20:20:38 -07:00
cost.json
cost_calculator.py Litellm oss staging (#28161) 2026-05-18 16:27:44 -07:00
exceptions.py Litellm oss staging (#28161) 2026-05-18 16:27:44 -07:00
main.py Litellm oss staging (#28161) 2026-05-18 16:27:44 -07:00
model_prices_and_context_window_backup.json feat(gemini): add gemini-3.1-flash-lite model cost map (#28320) 2026-05-20 10:03:14 -07:00
mypy.ini
policy_templates_backup.json
provider_endpoints_support_backup.json Feature/add audio support for scaleway (#26110) 2026-04-20 14:49:41 -07:00
py.typed
router.py fix(router): use forwarded model_id for native Azure container IDs (#27921) 2026-05-20 12:32:34 -07:00
scheduler.py
setup_wizard.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
timeout.py docs: add class docstring to _LoopWrapper (#27870) 2026-05-13 13:54:00 -07:00
utils.py fix(deepseek): use native /anthropic/v1/messages endpoint and sanitize tools (#28200) 2026-05-18 18:14:13 -07:00