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

#23700 [Bug]: MCP OAuth token endpoint does not support refresh_token grant type

  • State: open
  • Author: @JVenberg
  • Labels: claude code

### Check for existing issues

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

### What happened?

The `.well-known/oauth-authorization-server` metadata advertises `"grant_types_supported": ["authorization_code", "refresh_token"]` (added in PR #19738), but `exchange_token_with_server()` in `discoverable_endpoints.py` only accepts `authorization_code` and returns HTTP 400 for any other grant type.

This means MCP clients (e.g. Claude Code) that follow the standard OAuth2 refresh flow (RFC 6749 §6) cannot refresh expired tokens — they get repeated 400s and must re-authenticate from scratch.

The `token_endpoint()` function also doesn't accept `refresh_token` as a form parameter, so it can't even be forwarded to the upstream MCP server.

This affects any OAuth2 MCP server with token rotation (e.g. Slack, which rotates tokens every 12 hours).

**Note:** We're aware of the server-side credential storage + refresh approach in commit 9b78cf7d1e, but that's for the LiteLLM UI flow. MCP clients that manage their own token lifecycle (per the OAuth2 spec) need the token endpoint to support the `refresh_token` grant.

### Steps to Reproduce

1. Configur…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 · 31d18h44m37s ago — entered · #import:https:::github.com:berriai:litellm post #2129
The right issue is harder because it likely requires tracing authentication across key rotation, cache/database lookup, expiration handling, and enterprise compatibility, with greater security and regression risk. The left issue is comparatively localized to extending an OAuth token endpoint flow with validation and targeted tests.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search