{"record":{"id":"07c1c27a73274564","repo":"BerriAI/litellm","slug":"api-key-does-not-have-access-to-this-toolset","errorCode":null,"errorMessage":"API key does not have access to this toolset.","messagePattern":"API key does not have access to this toolset\\.","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"error","filePath":"litellm/proxy/management_endpoints/mcp_management_endpoints.py","lineNumber":2892,"sourceCode":"            return []\n        return await list_mcp_toolsets(prisma_client, toolset_ids=raw_toolsets)\n\n    @router.get(\n        \"/toolset/{toolset_id}\",\n        description=\"Get a specific MCP toolset by ID\",\n    )\n    @management_endpoint_wrapper\n    async def fetch_mcp_toolset(\n        toolset_id: str,\n        user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),\n    ):\n        prisma_client: Final = get_prisma_client_or_throw(\"Database not connected. Connect a database to your proxy\")\n        # Non-admin keys may only fetch toolsets they've been explicitly granted.\n        if not _user_has_admin_view(user_api_key_dict):\n            op: Final = user_api_key_dict.object_permission\n            granted: Final = getattr(op, \"mcp_toolsets\", None) if op else None\n            if granted is None or toolset_id not in granted:\n                raise HTTPException(\n                    status_code=status.HTTP_403_FORBIDDEN,\n                    detail={\"error\": \"API key does not have access to this toolset.\"},\n                )\n        toolset: Final = await get_mcp_toolset(prisma_client, toolset_id)\n        if toolset is None:\n            raise HTTPException(\n                status_code=status.HTTP_404_NOT_FOUND,\n                detail={\"error\": f\"Toolset '{toolset_id}' not found.\"},\n            )\n        return toolset\n\n    @router.put(\n        \"/toolset\",\n        description=\"Update an existing MCP toolset (admin only)\",\n    )\n    @management_endpoint_wrapper\n    async def edit_mcp_toolset(\n        payload: UpdateMCPToolsetRequest,","sourceCodeStart":2874,"sourceCodeEnd":2910,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/mcp_management_endpoints.py#L2874-L2910","documentation":"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.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/mcp_management_endpoints.py:2892 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use an API key that has been granted access to this toolset, or a PROXY_ADMIN key."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}