BerriAI/litellm · error · HTTPException

API key does not have access to this toolset.

Error message

API key does not have access to this toolset.

What it means

Grant guard on GET /v1/mcp/toolset/{toolset_id}: the caller's key is non-admin and its object_permission.mcp_toolsets list either does not exist or does not contain the requested toolset_id, so the key may only reach toolsets explicitly granted to it.

Source

Thrown at litellm/proxy/management_endpoints/mcp_management_endpoints.py:2892

            return []
        return await list_mcp_toolsets(prisma_client, toolset_ids=raw_toolsets)

    @router.get(
        "/toolset/{toolset_id}",
        description="Get a specific MCP toolset by ID",
    )
    @management_endpoint_wrapper
    async def fetch_mcp_toolset(
        toolset_id: str,
        user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
    ):
        prisma_client: Final = get_prisma_client_or_throw("Database not connected. Connect a database to your proxy")
        # Non-admin keys may only fetch toolsets they've been explicitly granted.
        if not _user_has_admin_view(user_api_key_dict):
            op: Final = user_api_key_dict.object_permission
            granted: Final = getattr(op, "mcp_toolsets", None) if op else None
            if granted is None or toolset_id not in granted:
                raise HTTPException(
                    status_code=status.HTTP_403_FORBIDDEN,
                    detail={"error": "API key does not have access to this toolset."},
                )
        toolset: Final = await get_mcp_toolset(prisma_client, toolset_id)
        if toolset is None:
            raise HTTPException(
                status_code=status.HTTP_404_NOT_FOUND,
                detail={"error": f"Toolset '{toolset_id}' not found."},
            )
        return toolset

    @router.put(
        "/toolset",
        description="Update an existing MCP toolset (admin only)",
    )
    @management_endpoint_wrapper
    async def edit_mcp_toolset(
        payload: UpdateMCPToolsetRequest,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use an API key that has been granted access to this toolset, or a PROXY_ADMIN key.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/mcp_management_endpoints.py:2892 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/07c1c27a73274564. Report an issue: GitHub.