litellm/ui
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
..
litellm-dashboard feat(mcp): per-user env-vars for MCP servers (backend + UI wiring) 2026-05-23 19:11:41 -07:00
Dockerfile feat: add componentized proxy deployment with gateway, backend, ui, and migrations (#27557) 2026-05-16 09:25:17 -07:00
nginx.conf feat: add componentized proxy deployment with gateway, backend, ui, and migrations (#27557) 2026-05-16 09:25:17 -07:00