{"record":{"id":"0d90a9e9866b3262","repo":"BerriAI/litellm","slug":"mcp-server-is-already-active","errorCode":null,"errorMessage":"MCP server is already active.","messagePattern":"MCP server is already active\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/management_endpoints/mcp_management_endpoints.py","lineNumber":1354,"sourceCode":"        \"\"\"\n        Admin approves a pending or previously-rejected MCP server — sets approval_status=active and loads it into the runtime registry.\n        \"\"\"\n        if LitellmUserRoles.PROXY_ADMIN != user_api_key_dict.user_role:\n            raise HTTPException(\n                status_code=status.HTTP_403_FORBIDDEN,\n                detail={\"error\": \"Admin access required to approve MCP server submissions.\"},\n            )\n\n        prisma_client: Final = get_prisma_client_or_throw(\"Database not connected. Connect a database to your proxy\")\n\n        existing: Final = await get_mcp_server(prisma_client, server_id)\n        if existing 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        if existing.approval_status == MCPApprovalStatus.active:\n            raise HTTPException(\n                status_code=status.HTTP_400_BAD_REQUEST,\n                detail={\"error\": \"MCP server is already active.\"},\n            )\n\n        approved: Final = await approve_mcp_server(\n            prisma_client,\n            server_id,\n            touched_by=user_api_key_dict.user_id or LITELLM_PROXY_ADMIN_NAME,\n        )\n        await global_mcp_server_manager.invalidate_byom_submitted_servers_cache(approved.submitted_by)\n        await global_mcp_server_manager.reload_servers_from_database()\n\n        return _redact_mcp_credentials(approved)\n\n    @router.put(\n        \"/server/{server_id}/reject\",\n        description=\"Reject a pending MCP server submission (admin only). Mirrors PUT /guardrails/{id}/reject.\",\n        dependencies=[Depends(user_api_key_auth)],","sourceCodeStart":1336,"sourceCodeEnd":1372,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/mcp_management_endpoints.py#L1336-L1372","documentation":"State guard in the approve flow: the targeted MCP server's approval_status is already 'active', so a second approval would be a no-op re-registration. Only pending or previously-rejected servers may be approved; firing on idempotent duplicate approves.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/mcp_management_endpoints.py:1354 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["No action needed; the server is already active.","Verify the current server status via the info endpoint before approving."],"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"}