BerriAI/litellm · error · HTTPException

Key is not in a team. MCP toolsets cannot be assigned to per

Error message

Key is not in a team. MCP toolsets cannot be assigned to personal keys by non-admin callers. Disallowed toolsets: {sorted(requested_toolsets)}.

What it means

HTTPException(403) from _validate_requested_toolsets: a non-admin caller tried to assign mcp_toolsets to a personal (teamless) key. Toolset-based MCP scoping is only defined for team keys or when a proxy admin makes the assignment; the message lists the requested toolsets.

Source

Thrown at litellm/proxy/management_helpers/object_permission_utils.py:667


def _validate_requested_toolsets(
    requested_toolsets: set[str],
    team_obj: Optional["LiteLLM_TeamTableCachedObj"],
    is_proxy_admin: bool,
) -> None:
    """
    Validate mcp_toolsets requested on a key.

    Non-admin callers cannot assign toolsets to a personal (no team) key. Team
    keys must request a subset of the team's own toolset allowlist.
    """
    if not requested_toolsets:
        return
    if team_obj is None:
        if is_proxy_admin:
            return
        raise HTTPException(
            status_code=status.HTTP_403_FORBIDDEN,
            detail={
                "error": (
                    "Key is not in a team. MCP toolsets cannot be assigned to "
                    "personal keys by non-admin callers. Disallowed toolsets: "
                    f"{sorted(requested_toolsets)}."
                )
            },
        )
    team_op: Final = team_obj.object_permission
    team_mcp_toolsets: Final = team_op.mcp_toolsets if team_op is not None else None
    if not team_mcp_toolsets:
        return
    disallowed_toolsets: Final = requested_toolsets - set(team_mcp_toolsets)
    if not disallowed_toolsets:
        return
    raise HTTPException(
        status_code=status.HTTP_403_FORBIDDEN,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Assign the key to a team first, remove the requested toolsets, or call as a proxy admin.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/management_helpers/object_permission_utils.py:667 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/23eae872309aedb1. Report an issue: GitHub.