mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-25 01:02:15 +00:00
log MCP OAuth discovery diagnostics for unmatched paths and non-transport upstream errors
This commit is contained in:
parent
b80a91ffc5
commit
457b21f213
2 changed files with 22 additions and 2 deletions
|
|
@ -50,6 +50,11 @@ def _parse_mcp_server_names_from_path(path: str) -> Optional[List[str]]:
|
|||
m = re.match(r"^/([^/,?#]+)/mcp", path)
|
||||
if m:
|
||||
return [m.group(1)]
|
||||
verbose_logger.debug(
|
||||
"MCP cold-start: path %r does not match /mcp/{name} or /{name}/mcp; "
|
||||
"passthrough 401 bypass will not activate",
|
||||
path,
|
||||
)
|
||||
return None
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -794,14 +794,29 @@ async def fetch_upstream_oauth_protected_resource(
|
|||
candidate,
|
||||
headers={"Accept": "application/json"},
|
||||
)
|
||||
except Exception as exc: # network / connect errors
|
||||
except Exception as exc:
|
||||
if is_network_error(exc):
|
||||
network_errors.append(exc)
|
||||
else:
|
||||
verbose_logger.warning(
|
||||
"MCP OAuth metadata fetch for %s raised non-transport "
|
||||
"%s: %s — treating as no metadata for this candidate",
|
||||
candidate,
|
||||
type(exc).__name__,
|
||||
exc,
|
||||
)
|
||||
continue
|
||||
if response.status_code == 200:
|
||||
try:
|
||||
payload = response.json()
|
||||
except Exception:
|
||||
except Exception as exc:
|
||||
verbose_logger.warning(
|
||||
"MCP OAuth metadata at %s returned 200 but JSON "
|
||||
"decode failed (%s: %s) — treating as no metadata",
|
||||
candidate,
|
||||
type(exc).__name__,
|
||||
exc,
|
||||
)
|
||||
continue
|
||||
if isinstance(payload, dict):
|
||||
now = time.time()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue