litellm/docs/my-website/docs
ishaan-berri 693ad49719
Litellm ishaan march23 - MCP Toolsets + GCP Caching fix (#25146) (#25155)
* Litellm ishaan march23 - MCP Toolsets + GCP Caching fix  (#25146)

* feat(mcp): MCP Toolsets — curated tool subsets from one or more MCP servers (#24335)

* feat(mcp): add LiteLLM_MCPToolsetTable and mcp_toolsets to ObjectPermissionTable

* feat(mcp): add prisma migration for MCPToolset table

* feat(mcp): add MCPToolset Python types

* feat(mcp): add toolset_db.py with CRUD helpers for MCPToolset

* feat(mcp): add toolset CRUD endpoints to mcp_management_endpoints

* fix(mcp): skip allow_all_keys servers when explicit mcp_servers permission is set (toolset scope fix)

* feat(mcp): add _apply_toolset_scope and toolset route handling in server.py

* fix(mcp): resolve toolset names in responses API before fetching tools

* feat(mcp): add mcp_toolsets field to LiteLLM_ObjectPermissionTable type

* feat(mcp): register LiteLLM_MCPToolsetTable in prisma client initialization

* feat(mcp): validate mcp_toolsets in key-vs-team permission check

* feat(mcp): register toolset routes in proxy_server.py

* feat(mcp): add MCPToolset and MCPToolsetTool TypeScript types

* feat(mcp): add fetchMCPToolsets, createMCPToolset, updateMCPToolset, deleteMCPToolset API functions

* feat(mcp): add useMCPToolsets React Query hook

* feat(mcp): add toolsets (purple) as third option type in MCPServerSelector

* feat(mcp): extract toolsets from combined MCP field in key form

* feat(mcp): extract toolsets from combined MCP field in team form

* feat(mcp): show toolsets section in MCPServerPermissions read view

* feat(mcp): pass mcp_toolsets through object_permissions_view

* feat(mcp): add MCPToolsetsTab component for creating and managing toolsets

* feat(mcp): add Toolsets tab to mcp_servers.tsx

* feat(mcp): pass mcpToolsets to playground chat and responses API calls

* feat(mcp): generate correct server_url for toolsets in playground API calls

* docs(mcp): add MCP Toolsets documentation

* docs(mcp): add mcp_toolsets to sidebar

* fix(mcp): replace x-mcp-toolset-id header with ContextVar to prevent client forgery

* fix(mcp): use ContextVar + StreamingResponse for toolset MCP routes (fixes SSE streaming)

* fix(mcp): cache toolset permission lookups to avoid per-request DB calls

* test(mcp): add tests for toolset scope enforcement, ContextVar isolation, and access control

* fix(mcp): cache toolset name lookups in MCPServerManager to avoid per-request DB calls

* fix(mcp): prevent body_iter deadlock + use cached toolset lookup in responses API

- _stream_mcp_asgi_response: add done callback to handler_task that puts
  the EOF sentinel on body_queue when the task exits, preventing body_iter
  from hanging forever if the handler raises after headers are sent.
- litellm_proxy_mcp_handler: replace raw get_mcp_toolset_by_name() DB call
  with global_mcp_server_manager.get_toolset_by_name_cached() so toolset
  resolution uses the 60s TTL cache added for this purpose instead of
  hitting the DB on every responses-API request.

* fix(mcp): toolset access control, asyncio fix, and real unit tests

- server.py: _apply_toolset_scope now enforces that non-admin keys must
  have the requested toolset_id in their mcp_toolsets grant list;
  admin keys always bypass the check.
- mcp_management_endpoints.py: three access-control fixes:
  * fetch_mcp_toolsets: non-admin keys with mcp_toolsets=None now
    return [] instead of all toolsets (only admins get 'all' when
    the field is absent)
  * fetch_mcp_toolset: non-admin keys that haven't been granted the
    requested toolset_id now get 403 instead of the full result
  * add_mcp_toolset: duplicate toolset_name now returns 409 Conflict
    instead of an opaque 500
- proxy_server.py: use asyncio.get_running_loop() instead of
  get_event_loop() inside an already-running coroutine (Python 3.10+).
- test_mcp_toolset_scope.py: replace four hollow tests that only
  asserted local variable properties with real tests that call the
  production fetch_mcp_toolsets() and handle_streamable_http_mcp()
  functions with mocked dependencies.

* fix(mcp): add mcp_toolsets to ObjectPermissionBase, fix multi-toolset overwrite, fix delete 404, allow standalone key toolsets

* fix(mcp): add auth check on toolset resolution in responses API; union mcp_servers in _merge_toolset_permissions

* fix(mcp): handle RecordNotFoundError in update_mcp_toolset; union direct servers with toolset servers

* fix(mcp): use _user_has_admin_view; deny None mcp_toolsets for non-admin; use direct RecordNotFoundError import; fix docstring

* fix(mcp): add @default(now()) to MCPToolsetTable.updated_at; fix test for non-admin toolset access

* fix: use UniqueViolationError import; guard _ensure_eof for error/cancel only

* fix(mcp): preserve mcp_access_groups in toolset scope, use shared Redis cache for toolset perms

- Remove mcp_access_groups=[] from _apply_toolset_scope (server.py) and the
  responses API toolset path (litellm_proxy_mcp_handler.py). A key's access-group
  grants remain valid even when the request is scoped to a single toolset; clearing
  them silently revoked legitimate entitlements.

- Switch resolve_toolset_tool_permissions and get_toolset_by_name_cached to use
  user_api_key_cache (Redis-backed DualCache in production) instead of per-instance
  in-memory dicts. Cache entries are now shared across workers, eliminating the
  per-worker stale-toolset-permission window flagged as a P1 by Greptile.

- Use union merge (set union of tool names per server) when applying toolset
  permissions in the responses API path so direct-server tool restrictions are not
  overwritten by toolset permissions.

* fix(mcp): return 404 when edit_mcp_toolset target does not exist

* fix(mcp): align mcp_toolsets default to None in LiteLLM_ObjectPermissionTable

* fix(mcp): admin toolset visibility, in-place tool name mutation, test helper coercion

* fix(mcp): treat None/[] team mcp_toolsets as no restriction in key validation

* fix(mcp): allow_all_keys backward compat, blocked_tools API write-path, efficient startup query

* fix(mcp): use _mcp_active_toolset_id ContextVar to detect toolset scope, avoiding DB-default false-positive

* fix(mcp): remove dead toolset cache stubs, log invalidation failures, align schema updated_at defaults

* fix(mcp): deserialise MCPToolset from Redis cache hit, replace fastapi import in test

* fix(mcp): evict name-cache on toolset mutation, 409 on rename conflict, warning-level list errors

* fix(redis): regenerate GCP IAM token per connection for async cluster (#24426)

* fix(redis): regenerate GCP IAM token per connection for async cluster clients

Async RedisCluster was generating the IAM token once at startup and
storing it as a static password. After the 1-hour GCP token TTL, any
new connection (including to newly-discovered cluster nodes) would fail
to authenticate.

Fix: introduce GCPIAMCredentialProvider that implements redis-py's
CredentialProvider protocol. It calls _generate_gcp_iam_access_token()
on every new connection, matching what the sync redis_connect_func
already does. async_redis.RedisCluster accepts a credential_provider
kwarg which is invoked per-connection.

* refactor(redis): move GCPIAMCredentialProvider to its own file

Extract GCPIAMCredentialProvider and _generate_gcp_iam_access_token
into litellm/_redis_credential_provider.py. _redis.py imports them
from there, keeping the public API unchanged.

* fix: address Greptile review issues

- GCPIAMCredentialProvider now inherits from redis.credentials.CredentialProvider
  so redis-py's async path calls get_credentials_async() properly
- move _redis_credential_provider import to top of _redis.py (PEP 8)
- remove dead else-branch that silently no-oped (gcp_service_account from
  redis_kwargs.get() was always None since it's popped by _get_redis_client_logic)
- remove mid-function 'from litellm import get_secret_str' inline import
- remove unused 'call' import from test_redis.py

* chore: retrigger CI/review

* chore: sync schema.prisma copies from root

* chore: sync schema.prisma copies from root

* fix(proxy_server): use bounded asyncio.Queue with maxsize to prevent unbounded growth

* fix(a2a/pydantic_ai): make api_base Optional to match base class signature

* fix(a2a/pydantic_ai): make api_base Optional in handler and guard against None

* fix(mcp): remove unused get_all_mcp_servers import

* fix(mcp): remove unused MCPToolset import

* refactor(mcp): extract toolset permission logic to reduce statement count below PLR0915 limit

* fix(tests): update reload_servers_from_database tests to mock prisma directly

---------

Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(toolset_db): lazy-import prisma to avoid ImportError when prisma not installed

* fix(tests): update UI tests for toolset tab and updated empty state text

* fix(tests): add get_mcp_server_by_name to fake_manager stub

---------

Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-04 16:23:21 -07:00
..
adding_provider feat(guardrails): team-based guardrail registration and approval workflow (#22459) 2026-03-02 22:06:49 -08:00
anthropic_unified Merge branch 'upstream/main' into HEAD 2026-03-13 22:56:08 -03:00
caching fix(ollama): thread api_base to get_model_info + graceful fallback (#21970) 2026-02-23 21:00:37 -08:00
completion Litellm fix update bedrock models (#24947) 2026-04-01 19:22:54 -07:00
contribute_integration docs(community.md): add new integration partner doc 2025-12-09 18:17:14 -08:00
contributing merge: resolve conflicts between main and litellm_oss_staging_03_11_2026 2026-03-12 09:38:31 -03:00
debugging fix: cleanup 2026-03-25 09:20:25 -07:00
embedding merge: resolve conflicts between main and litellm_oss_staging_03_11_2026 2026-03-12 09:38:31 -03:00
extras fix: prompt registry 2026-02-18 00:34:54 +05:30
guides docs: sidebar updates, letta resources links, Google GenAI SDK, cost tracking order 2026-03-18 04:28:06 +05:30
integrations docs: Learn page updates, card links, integrations, sidebar changes 2026-03-18 17:19:27 +05:30
langchain added tags to langchain 2025-09-10 00:32:26 -04:00
learn fix: fix azure audio test 2026-03-28 18:14:01 -07:00
observability docs: document new github + gitlab ci scripts 2026-03-25 20:17:10 -07:00
pass_through Development environment setup (#22432) 2026-02-28 14:50:06 -08:00
projects fix: prompt registry 2026-02-18 00:34:54 +05:30
provider_registration merge: resolve conflicts between main and litellm_oss_staging_03_11_2026 2026-03-12 09:38:31 -03:00
providers Litellm ishaan march30 (#24887) (#25151) 2026-04-04 14:44:07 -07:00
proxy Litellm ishaan april4 2 (#25150) 2026-04-04 23:09:42 +00:00
search feat(search): add Serper (serper.dev) as search provider (#23112) 2026-03-09 08:40:37 -07:00
secret_managers docs: document new github + gitlab ci scripts 2026-03-25 20:17:10 -07:00
troubleshoot docs: pip venv upgrade workflow (#23290) 2026-03-10 13:53:54 -07:00
tutorials Merge pull request #25032 from BerriAI/litellm_docs-default-team-params 2026-04-03 16:07:46 -07:00
vector_stores Add vector store support for ragflow 2025-12-03 15:29:47 +05:30
a2a.md Agents - add max budget + tpm/rpm limiting per agent AND per agent session (#22849) 2026-03-07 19:12:42 -08:00
a2a_agent_headers.md docs(agents): add A2A agent authentication headers guide 2026-03-05 15:11:18 +05:30
a2a_agent_permissions.md [Docs] A2a - Permission management (#17515) 2025-12-04 17:29:47 -08:00
a2a_cost_tracking.md fix: prompt registry 2026-02-18 00:34:54 +05:30
a2a_invoking_agents.md fix: prompt registry 2026-02-18 00:34:54 +05:30
a2a_iteration_budgets.md Agents - add max budget + tpm/rpm limiting per agent AND per agent session (#22849) 2026-03-07 19:12:42 -08:00
aiohttp_benchmarks.md
anthropic_count_tokens.md Litellm fix update bedrock models (#24947) 2026-04-01 19:22:54 -07:00
apply_guardrail.md merge: resolve conflicts between main and litellm_oss_staging_03_11_2026 2026-03-12 09:38:31 -03:00
assistants.md docs: improve Getting Started page and SDK documentation structure (#17614) 2025-12-08 13:05:50 -08:00
audio_transcription.md merge: resolve conflicts between main and litellm_oss_staging_03_11_2026 2026-03-12 09:38:31 -03:00
batches.md fix: prompt registry 2026-02-18 00:34:54 +05:30
bedrock_converse.md docs boto3 instructions 2025-10-16 16:34:56 -07:00
bedrock_invoke.md docs boto3 instructions 2025-10-16 16:34:56 -07:00
benchmarks.md fix(ollama): thread api_base to get_model_info + graceful fallback (#21970) 2026-02-23 21:00:37 -08:00
budget_manager.md
contact.md docs: update broken Slack invite links to support page (#16546) 2025-11-12 12:41:55 -08:00
container_files.md fix: prompt registry 2026-02-18 00:34:54 +05:30
containers.md [docs] add docs for containers files api + code interpreter on LiteLLM (#17749) 2025-12-09 18:11:28 -08:00
contributing.md fix(ollama): thread api_base to get_model_info + graceful fallback (#21970) 2026-02-23 21:00:37 -08:00
count_tokens.md merge: resolve conflicts between main and litellm_oss_staging_03_11_2026 2026-03-12 09:38:31 -03:00
data_retention.md fix: prompt registry 2026-02-18 00:34:54 +05:30
data_security.md fix: cleanup 2026-03-25 09:20:25 -07:00
default_code_snippet.md
enterprise.md docs: document new github + gitlab ci scripts 2026-03-25 20:17:10 -07:00
evals_api.md fix: prompt registry 2026-02-18 00:34:54 +05:30
exception_mapping.md Adds support for returning Azure Content Policy error information when exceptions from Azure OpenAI occur (#16231) 2025-11-08 16:04:36 -08:00
files_endpoints.md feat(anthropic): add Files API support for SDK 2026-03-11 12:45:19 -03:00
fine_tuning.md docs: document new github + gitlab ci scripts 2026-03-25 20:17:10 -07:00
generateContent.md fix: Metadata / Trace ID Missing in S3 Streaming Callbacks 2026-02-25 14:16:42 +05:30
image_edits.md merge: resolve conflicts between main and litellm_oss_staging_03_11_2026 2026-03-12 09:38:31 -03:00
image_generation.md merge: resolve conflicts between main and litellm_oss_staging_03_11_2026 2026-03-12 09:38:31 -03:00
image_variations.md
index.md Litellm fix update bedrock models (#24947) 2026-04-01 19:22:54 -07:00
interactions.md fix(ollama): thread api_base to get_model_info + graceful fallback (#21970) 2026-02-23 21:00:37 -08:00
load_test.md fix: prompt registry 2026-02-18 00:34:54 +05:30
load_test_advanced.md Enhance documentation and sidebar structure 2026-03-17 02:10:06 +05:30
load_test_rpm.md docs: usaged-based routing perf warnings (#14080) 2025-08-29 17:31:12 -07:00
load_test_sdk.md
mcp.md Litellm ishaan march30 (#24887) (#25151) 2026-04-04 14:44:07 -07:00
mcp_aws_sigv4.md Litellm ishaan march30 (#24887) (#25151) 2026-04-04 14:44:07 -07:00
mcp_control.md [Chore] update mcp documentation for header forwarding 2026-03-04 13:07:25 +05:30
mcp_cost.md [MCP Gateway] QA/Fixes - Ensure Team/Key level enforcement works for MCPs (#15305) 2025-10-07 17:34:48 -07:00
mcp_guardrail.md merge: resolve conflicts between main and litellm_oss_staging_03_11_2026 2026-03-12 09:38:31 -03:00
mcp_oauth.md fix: prompt registry 2026-02-18 00:34:54 +05:30
mcp_openapi.md feat(mcp): allow admins to override tool name and description per MCP server (#22828) 2026-03-04 17:58:05 -08:00
mcp_public_internet.md fix: prompt registry 2026-02-18 00:34:54 +05:30
mcp_semantic_filter.md fix: prompt registry 2026-02-18 00:34:54 +05:30
mcp_toolsets.md Litellm ishaan march23 - MCP Toolsets + GCP Caching fix (#25146) (#25155) 2026-04-04 16:23:21 -07:00
mcp_troubleshoot.md fix: prompt registry 2026-02-18 00:34:54 +05:30
mcp_usage.md [MCP Gateway] QA/Fixes - Ensure Team/Key level enforcement works for MCPs (#15305) 2025-10-07 17:34:48 -07:00
mcp_zero_trust.md docs(mcp_zero_trust): add MCP zero trust auth guide (#23918) 2026-03-17 17:45:16 -07:00
migration.md fix: cleanup 2026-03-25 09:20:25 -07:00
migration_policy.md
moderation.md docs(moderation.md): fix moderation quick start docs 2025-11-07 16:25:08 -08:00
ocr.md Enable local file support for OCR (#22133) 2026-02-27 10:50:02 -08:00
oidc.md Litellm fix update bedrock models (#24947) 2026-04-01 19:22:54 -07:00
old_guardrails.md Use the -d flag in docs instead of -D (#12179) 2025-06-30 15:25:42 -07:00
projects.md
prompt_management.md Add support for prompt management for responses 2026-03-18 15:48:31 +05:30
proxy_api.md Corrected docs updates sept 2025 (#14916) 2025-09-25 15:49:19 -07:00
proxy_auth.md fix: prompt registry 2026-02-18 00:34:54 +05:30
proxy_server.md docs: remove phone numbers from readme and docs 2026-03-25 12:40:40 -07:00
rag_ingest.md fix: prompt registry 2026-02-18 00:34:54 +05:30
rag_query.md fix: prompt registry 2026-02-18 00:34:54 +05:30
realtime.md Announce April Townhall (#25021) 2026-04-02 14:10:49 -07:00
reasoning_content.md docs(reasoning_content.md): update guide 2026-03-23 17:23:14 -07:00
rerank.md feat: Add IBM watsonx.ai rerank support (#21303) 2026-02-16 20:12:16 -08:00
response_api.md Merge pull request #24110 from BerriAI/Sameerlite/model-level-affinity 2026-03-20 18:05:46 +05:30
response_api_compact.md fix: prompt registry 2026-02-18 00:34:54 +05:30
router_architecture.md
routing.md Merge pull request #24611 from Sameerlite/Sameerlite/order-fallback2 2026-03-27 20:15:30 +05:30
rules.md
scheduler.md docs: usaged-based routing perf warnings (#14080) 2025-08-29 17:31:12 -07:00
sdk_custom_pricing.md
secret.md docs: document new github + gitlab ci scripts 2026-03-25 20:17:10 -07:00
set_keys.md
skills.md [Docs] Claude Skills API (#17052) 2025-11-24 15:32:03 -08:00
text_completion.md Guardrails - Responses API, Image Gen, Text completions, Audio transcriptions, Audio Speech, Rerank, Anthropic Messages API support via the unified apply_guardrails function (#15706) 2025-10-25 13:38:57 -07:00
text_to_speech.md fix: prompt registry 2026-02-18 00:34:54 +05:30
traffic_mirroring.md fix: prompt registry 2026-02-18 00:34:54 +05:30
troubleshoot.md docs: remove phone numbers from readme and docs 2026-03-25 12:40:40 -07:00
vector_store_files.md fix docs 2025-11-15 16:58:47 -08:00
vertex_batch_passthrough.md Enhance documentation and sidebar structure 2026-03-17 02:10:06 +05:30
videos.md Add new videos docs 2026-03-16 17:57:14 +05:30
wildcard_routing.md