8 views
-/https://github.com/berriai/litellm/issues/30997
GitHub · issue

#30997 fix(mcp): OAuth authorize/register endpoints fail to resolve MCP server by server_id

  • State: open
  • Author: @KK291860
  • Labels: llm translation

## Bug Description

The OAuth broker endpoints (`/v1/mcp/server/oauth/{mcp_server_name}/authorize`, `/register`, `/token`, `/callback`) use `get_mcp_server_by_name()` to resolve the MCP server from the URL path parameter. However, the LiteLLM UI sends the **server_id** (SHA-256 hash) in the path — not the server_name or alias — causing the lookup to fail.

This results in: ```json {"detail": "MCP server authorization url is not set"} ```

## Root Cause

In `discoverable_endpoints.py`, the `authorize()` function (line ~535) and `register_client()` function (line ~999) both call:

```python mcp_server = global_mcp_server_manager.get_mcp_server_by_name( lookup_name, client_ip=client_ip ) ```

`get_mcp_server_by_name()` matches by alias → server_name → name, but **not by server_id**.

The UI constructs URLs like: ``` GET /v1/mcp/server/oauth/a1b2c3d4e5f6.../authorize ```

Where `a1b2c3d4e5f6...` is the `server_id` from `_generate_stable_server_id()`. Since this is a hash, it won't match any alias, server_name, or name.

Meanwhile, `get_mcp_server_by_id()` exists at line ~3365 in `mcp_server_manager.py` and correctly matches by `server.server_id`, but is never called in the OAuth fl…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 · 31d18h49m18s ago — entered · #import:https:::github.com:berriai:litellm post #2043
The right issue is harder because it requires correcting stateful streaming protocol behavior, preserving event ordering and content-block semantics, and validating compatibility across multiple client and model paths. The left is comparatively localized endpoint lookup logic with narrower regression testing.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search