mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-24 00:52:24 +00:00
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>
|
||
|---|---|---|
| .. | ||
| dist | ||
| litellm_proxy_extras | ||
| tests | ||
| build_and_publish.md | ||
| LICENSE | ||
| migration_runbook.md | ||
| pyproject.toml | ||
| README.md | ||
Additional files for the proxy. Reduces the size of the main litellm package.
Currently, only stores the migration.sql files for litellm-proxy.
To install, run:
uv add litellm-proxy-extras
OR
uv tool install 'litellm[proxy]' # installs litellm-proxy-extras and other proxy dependencies
To use the migrations, run:
litellm --use_prisma_migrate