{"record":{"id":"059f65a7c7289d64","repo":"BerriAI/litellm","slug":"user-does-not-have-permission-to-access-mcp-server","errorCode":null,"errorMessage":"User does not have permission to access mcp server with id {server_id}. You can only manage mcp servers that you have access to.","messagePattern":"User does not have permission to access mcp server with id (.+?)\\. You can only manage mcp servers that you have access to\\.","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"error","filePath":"litellm/proxy/management_endpoints/mcp_management_endpoints.py","lineNumber":2303,"sourceCode":"        server = await get_mcp_server(prisma_client, server_id)\n        if server is None:\n            registry_server: Final = global_mcp_server_manager.get_mcp_server_by_id(server_id)\n            if registry_server is not None:\n                server = global_mcp_server_manager._build_mcp_server_table(registry_server)\n\n        if _user_has_admin_view(user_api_key_dict):\n            if server is None:\n                raise HTTPException(\n                    status_code=status.HTTP_404_NOT_FOUND,\n                    detail={\"error\": f\"MCP Server {server_id} not found\"},\n                )\n            return server\n\n        allowed_server_ids: Final[set[str]] = set()\n        for auth_context in await build_effective_auth_contexts(user_api_key_dict):\n            allowed_server_ids.update(await global_mcp_server_manager.get_allowed_mcp_servers(auth_context))\n        if server is None or server.server_id not in allowed_server_ids:\n            raise HTTPException(\n                status_code=status.HTTP_403_FORBIDDEN,\n                detail={\n                    \"error\": (\n                        f\"User does not have permission to access mcp server with id {server_id}. \"\n                        \"You can only manage mcp servers that you have access to.\"\n                    )\n                },\n            )\n        return server\n\n    def _compute_user_env_var_status(\n        *,\n        server: LiteLLM_MCPServerTable,\n        stored_values: dict[str, str],\n    ) -> MCPUserEnvVarsStatus:\n        \"\"\"Build a status object for one server given the user's stored values.\n\n        Stored credentials are write-only: the response reports only whether","sourceCodeStart":2285,"sourceCodeEnd":2321,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/mcp_management_endpoints.py#L2285-L2321","documentation":"Authorization guard in the per-user MCP state resolver: the server exists but is outside the caller's allowed-server set. Non-admins deliberately get 403 (not 404) so valid server ids cannot be enumerated; the same allowed-server resolution the gateway enforces on tool calls is applied here.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/mcp_management_endpoints.py:2303 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use an API key whose role is PROXY_ADMIN or that has been granted access to this MCP server.","Ask an admin to add your key/team to the server's allowed access list."],"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-14T00:17:10.932Z"}