9 views
-/https://github.com/berriai/litellm/issues/31296
GitHub · issue

#31296 [Feature]: Inbound MCP OAuth: emit 401 + Protected Resource Metadata (RFC 9728) to enable client auto-discovery

  • State: open
  • Author: @olad32
  • Labels: enhancement, proxy, claude code

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### The Feature

## Problem

When the LiteLLM MCP Gateway is protected by JWT auth (`enable_jwt_auth`), it acts as a *bring-your-own-token* resource server: a request without a valid token just gets a bare `401`. A generic MCP client (Claude Code, VS Code, Cursor…) has no way to know **which authorization server to use** or how to start an OAuth flow, so the login screen never triggers automatically.

The MCP authorization spec (OAuth 2.1 + **RFC 9728 Protected Resource Metadata**) solves this: the resource server must advertise its trusted authorization server(s) so clients can auto-discover, register (DCR), and obtain a token without manual configuration (get an api key).

Today LiteLLM only implements this discovery for the **outbound** direction (LiteLLM → upstream MCP servers), not for **inbound** auth (MCP client → LiteLLM).

## Proposed solution

For the inbound MCP endpoint, when a request is unauthenticated:

1. Serve `GET /.well-known/oauth-protected-resource` (RFC 9728) returning the configured `authorization_servers` (e.g. our external IdP) and `res…

GitHub resolver

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

Refresh page
vote history (19 events)
#0 of 0 · 31d19h27m37s ago — entered · #import:https:::github.com:berriai:litellm post #1732
The left requires broader cross-cutting protocol, authentication, routing, configuration, compatibility, and test work, with greater standards-compliance and security risk. The right is comparatively localized debugging in an existing streaming translation path.
#31296 requires cross-cutting proxy authentication, standards-compliant discovery behavior, configuration handling, security review, and integration tests, whereas #26882 is a narrower provider-specific translation fix.
The right issue is harder because it spans authentication middleware, standards-compliant discovery endpoints, external identity-provider configuration, client interoperability, and security-focused testing. The left issue is comparatively contained within provider registration, model metadata, request translation, and pricing integration.
30421 spans a new CLI workflow, multiple third-party agent integrations, remote model discovery, credential handling, and cross-platform process/configuration behavior. 31296 is comparatively bounded to protocol-compliant metadata and authentication response handling within existing MCP middleware, with focused tests.
26535 requires broader cross-provider validation, matrix expansion, CI integration, and coordination across multiple implementation slices, creating substantially more engineering and maintenance risk than the focused authentication endpoint and metadata feature in 31296.
Issue 34328 is harder because it requires correcting recursive schema expansion safely, preserving translation behavior, enforcing budgets across multiple provider paths, and validating CPU/memory termination under adversarial schemas. Issue 31296 is a more bounded authentication-discovery feature involving endpoint behavior, metadata configuration, and response integration.
Issue #31296 is harder because it introduces a new inbound authentication and standards-compliance flow spanning proxy routing, OAuth metadata discovery, configuration, response semantics, and security-focused integration tests. Issue #26897 is narrower, centered on diagnosing and correcting parameter propagation or Azure URL construction in an existing Responses bridge path.
Issue 32201 is harder because it requires integrating enforcement into pass-through response processing, including raw/streaming formats and guardrail execution paths, while issue 31296 is a more bounded authentication-metadata and response-header addition.
The right issue is harder because it spans proxy authentication middleware, standards-compliant discovery endpoints, configuration and routing behavior, client interoperability, and security-sensitive integration tests. The left issue is more contained within provider-specific multimodal request translation and validation.
The right-hand change is harder because it spans authentication middleware, standards-compliant discovery behavior, configuration and client interoperability, with security-sensitive integration testing. The left-hand change is narrower in surface area, primarily requiring database transaction, locking, ordering, and concurrency-test work.
The left requires new protocol-facing proxy behavior, authentication middleware integration, configuration, standards-compliant discovery responses, and security-sensitive testing. The right is broader than a single fix but remains primarily localized request-transformation corrections with targeted regression coverage.
The left item is harder because it spans security-sensitive protocol behavior, request handling, standards-compliant discovery responses, configuration validation, and interoperability testing. The right item is primarily a bounded backend-to-frontend configuration visibility change with UI and regression coverage.
Nested authorization-group composition requires recursive resolution, dependency tracking, cycle protection, and coordinated changes across persistence, authorization evaluation, APIs, and tests; the other is comparatively contained protocol handling around authentication responses and metadata.
31296 is harder because it introduces a security-sensitive protocol feature spanning endpoint routing, authentication behavior, configuration, compatibility, and integration testing. 33772 is comparatively contained to billing-data propagation and model-cost metadata, despite requiring coverage across multiple response formats.
The left task requires correcting distributed concurrency and durability semantics across shared state, with race-condition testing and failure handling. The right task is primarily a bounded proxy/authentication protocol integration with response and routing tests, so it has less implementation risk.
Inbound authentication discovery touches security-sensitive proxy behavior, standards-compliant metadata, HTTP challenge semantics, configuration, and client interoperability, creating substantially higher implementation and regression risk. The other issue is primarily a bounded set of provider adapters, model mappings, parameter translation, and cost metadata.
The right issue is harder because it requires designing and validating atomic distributed admission control, reservation semantics, failure handling, and compatibility with concurrent multi-replica traffic. The left issue is a more bounded standards-compliance change involving request handling, metadata exposure, configuration, and tests.
The left item is harder because it introduces a new protocol-facing authentication and discovery surface, requiring security-sensitive request handling, configuration integration, compatibility validation, and broader end-to-end testing. The right item is comparatively localized to cache synchronization and limiter initialization, with narrower behavioral scope despite distributed-state correctness risks.
#0 of 0 · 31d17h36m34s ago — current · #import:https:::github.com:berriai:litellm post #3560
Issue 33666 is harder because it requires redesigning data retrieval and session reconstruction to bound database and application memory while preserving response-chain correctness, with performance validation and regression coverage. Issue 31296 is comparatively localized to authentication response behavior, metadata discovery, configuration, and endpoint tests.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search