litellm/docs/my-website
Krish Dholakia e00c181f0c
Mcp user permissions (#21462)
* feat(schema.prisma): add object permissions for end users

allows controlling if end user can call specific mcp servers

* feat: cleanup for customer_endpoints support of object permission id

* fix: cleanup str

* feat(customers/): enforce end user can only call allowed mcps - if configured

* docs: document customer/end user object permission usage

* feat: enforce end user permissions on MCP tool calls

This commit implements end user permission enforcement for MCP servers:

1. Always add server prefixes to MCP tool names
   - Removed conditional logic that only added prefixes when multiple servers existed
   - Now always adds server prefix for consistent tool naming across all scenarios
   - Updated 5 locations in server.py (list_tools, get_prompts, get_resources,
     get_resource_templates, get_prompt)

2. Created MCP End User Permission Guardrail Hook
   - New guardrail hook: litellm/proxy/guardrails/guardrail_hooks/mcp_end_user_permission.py
   - Runs on post_call to validate tool calls in LLM responses
   - Extracts MCP server name from tool names (splits on first '-')
   - Checks if end_user_id has permissions for the MCP server
   - Raises GuardrailRaisedException if end user lacks permission
   - Supports both streaming and non-streaming responses

3. Added comprehensive tests
   - Test file: tests/test_litellm/proxy/guardrails/guardrail_hooks/test_mcp_end_user_permission.py
   - Tests cover: authorized/unauthorized tools, non-MCP tools, no end_user scenarios
   - Tests permission checking logic and exception raising

The hook integrates with the existing MCPRequestHandler._get_allowed_mcp_servers_for_end_user
to fetch end user permissions and enforce access control at the response level.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* refactor: remove redundant add_prefix variable assignments

Simplified the code by removing intermediate `add_prefix` variable
assignments and passing `True` directly to function calls since
we now always add server prefixes.

Changes:
- Removed `add_prefix = True` variable assignments in 5 locations
- Changed `add_prefix=add_prefix` to `add_prefix=True` in function calls
- Added inline comments to clarify the behavior

This makes the code more concise and clearer in intent.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* feat(auth_utils.py): support safety_identifier as a valid way of passing the end user id for responses api

* feat(llms): ensure 'tools' is correctly updated for responses api

* fix: fix greptile feedback

* feat: transformation.py

proper responses api tool handling for guardrail translation layer

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-18 18:53:59 -08:00
..
blog Merge pull request #21485 from BerriAI/litellm_fix_Note 2026-02-18 22:55:01 +05:30
docs Mcp user permissions (#21462) 2026-02-18 18:53:59 -08:00
img fix: prompt registry 2026-02-18 00:34:54 +05:30
release_notes fix: prompt registry 2026-02-18 00:34:54 +05:30
src fix: prompt registry 2026-02-18 00:34:54 +05:30
static fix: prompt registry 2026-02-18 00:34:54 +05:30
.gitignore Inkeep searchbar and chat added to the Docs (#12030) 2025-06-26 10:13:42 -07:00
.trivyignore security fix 2025-11-14 18:43:41 -08:00
babel.config.js updating docs 2023-08-12 11:30:32 -07:00
Dockerfile fix docs warning (#7419) 2024-12-25 16:42:14 -08:00
docusaurus.config.js fix 2025-12-20 15:21:00 +05:30
index.md fix keys 2023-08-17 16:13:52 -07:00
package-lock.json fix: prompt registry 2026-02-18 00:34:54 +05:30
package.json fix: prompt registry 2026-02-18 00:34:54 +05:30
README.md updating docs 2023-08-12 11:30:32 -07:00
sidebars.js Merge pull request #21464 from BerriAI/litellm_sanitise_anthropic_mesages_2 2026-02-18 18:39:11 +05:30

Website

This website is built using Docusaurus 2, a modern static website generator.

Installation

$ yarn

Local Development

$ yarn start

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

Build

$ yarn build

This command generates static content into the build directory and can be served using any static contents hosting service.

Deployment

Using SSH:

$ USE_SSH=true yarn deploy

Not using SSH:

$ GIT_USER=<Your GitHub username> yarn deploy

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the gh-pages branch.