Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix: link new object_permission_id back to team on first MCP server create

yuneng-jiang6c06e6dc80fd
diff --git a/litellm/proxy/management_endpoints/mcp_management_endpoints.py b/litellm/proxy/management_endpoints/mcp_management_endpoints.py
index 3400f90f489..522a533d43f 100644
--- a/litellm/proxy/management_endpoints/mcp_management_endpoints.py
+++ b/litellm/proxy/management_endpoints/mcp_management_endpoints.py
@@ -1358,7 +1358,7 @@ if MCP_AVAILABLE:
set(existing_mcp_servers + [new_mcp_server.server_id])
)
- await handle_update_object_permission_common(
+ new_permission_id = await handle_update_object_permission_common(
data_json={
"object_permission": {
"mcp_servers": updated_mcp_servers,
@@ -1367,6 +1367,13 @@ if MCP_AVAILABLE:
existing_object_permission_id=existing_permission_id,
prisma_client=prisma_client,
)
+
+ # If the team had no object_permission_id, link the new one
+ if existing_permission_id is None and new_permission_id is not None:
+ await prisma_client.db.litellm_teamtable.update(
+ where={"team_id": manager_team_id},
+ data={"object_permission_id": new_permission_id},
+ )
except Exception as e:
verbose_proxy_logger.exception(f"Error creating mcp server: {str(e)}")
raise HTTPException(