mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-27 01:22:18 +00:00
fix(mcp): forward user_fields on temp records and dedupe normalization
Pass through payload.user_fields when building the temporary MCP server record so session-cached servers retain their admin-declared fields. Replace the bespoke list/string/instance handling in _build_user_fields_status with the shared coerce_user_fields helper.
This commit is contained in:
parent
cbb13bf53c
commit
3851d8ae88
1 changed files with 2 additions and 12 deletions
|
|
@ -670,6 +670,7 @@ if MCP_AVAILABLE:
|
|||
registration_url=payload.registration_url,
|
||||
allow_all_keys=payload.allow_all_keys,
|
||||
available_on_public_internet=payload.available_on_public_internet,
|
||||
user_fields=payload.user_fields,
|
||||
)
|
||||
|
||||
def get_prisma_client_or_throw(message: str):
|
||||
|
|
@ -2159,19 +2160,8 @@ if MCP_AVAILABLE:
|
|||
(None when no row exists yet). ``missing_field_keys`` enumerates only
|
||||
the ``required`` fields the user has yet to fill in.
|
||||
"""
|
||||
raw_fields = getattr(server, "user_fields", None) or []
|
||||
if isinstance(raw_fields, str):
|
||||
try:
|
||||
raw_fields = json.loads(raw_fields)
|
||||
except (ValueError, TypeError):
|
||||
raw_fields = []
|
||||
user_fields: List[MCPUserField] = []
|
||||
for entry in raw_fields:
|
||||
if isinstance(entry, MCPUserField):
|
||||
user_fields.append(entry)
|
||||
continue
|
||||
if not isinstance(entry, dict):
|
||||
continue
|
||||
for entry in coerce_user_fields(server):
|
||||
try:
|
||||
user_fields.append(MCPUserField(**entry))
|
||||
except Exception: # noqa: BLE001 — drop malformed entries silently
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue