mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-10 00:22:03 +00:00
fix: handle missing 'env' attribute in MCP server Prisma model (#12560)
- Use getattr() with default value when accessing mcp_server.env - Prevents AttributeError when Prisma doesn't include the field - Fixes startup error: 'LiteLLM_MCPServerTable' object has no attribute 'env' The issue occurs when Prisma fetches records and doesn't include null/undefined fields in the returned object.
This commit is contained in:
@@ -160,7 +160,9 @@ class MCPServerManager:
|
||||
_mcp_info: MCPInfo = mcp_server.mcp_info or {}
|
||||
|
||||
# Use helper to deserialize environment dictionary
|
||||
env_dict = _deserialize_env_dict(mcp_server.env)
|
||||
# Safely access env field which may not exist on Prisma model objects
|
||||
env_data = getattr(mcp_server, 'env', None)
|
||||
env_dict = _deserialize_env_dict(env_data)
|
||||
|
||||
new_server = MCPServer(
|
||||
server_id=mcp_server.server_id,
|
||||
|
||||
Reference in New Issue
Block a user