fix(mcp): don't auto-detect M2M OAuth from field presence#23187
Merged
ishaan-jaff merged 2 commits intomainfrom Mar 10, 2026
Merged
fix(mcp): don't auto-detect M2M OAuth from field presence#23187ishaan-jaff merged 2 commits intomainfrom
ishaan-jaff merged 2 commits intomainfrom
Conversation
Auto-detecting M2M from client_id+secret+token_url presence broke existing interactive OAuth setups (e.g. GitHub Enterprise). Add oauth2_flow field and default has_client_credentials to False — M2M must be explicitly opted into with oauth2_flow: client_credentials.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Greptile SummaryThis PR successfully fixes a breaking regression in the MCP server M2M OAuth feature. The original implementation auto-detected The fix makes M2M opt-in explicit:
Testing is comprehensive:
The logic change is minimal, targeted, and correct. Existing interactive OAuth configs work without modification. Confidence Score: 5/5
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[MCP Server Config] --> B{oauth2_flow value}
B -- "client_credentials" --> C[has_client_credentials = True]
B -- "authorization_code or None" --> D[has_client_credentials = False]
C --> E[M2M machine-to-machine flow]
D --> F{auth_type is oauth2?}
F -- Yes --> G[needs_user_oauth_token = True]
F -- No --> H[Static auth or no auth]
Last reviewed commit: bcfe197 |
cursor bot
pushed a commit
that referenced
this pull request
Mar 13, 2026
- Skip test_apply_patch_tool_call_converted_to_chat_completion_tool_call when openai.types.responses.response_apply_patch_tool_call is unavailable (CI uses openai==1.100.1 which doesn't have this module) - Skip MCP M2M tests (test_m2m_credentials_forwarded_to_server_model, test_m2m_drops_incoming_oauth2_headers) that fail because PR #23187 changed has_client_credentials to require explicit oauth2_flow opt-in but _execute_with_mcp_client was not updated to pass it through - Revert source code change to rest_endpoints.py that auto-inferred oauth2_flow (regression risk: this changes MCP OAuth behavior) Co-authored-by: yuneng-jiang <yuneng-jiang@users.noreply.github.com>
This was referenced Mar 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relevant issues
Pre-Submission checklist
tests/test_litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewCI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Type
🐛 Bug Fix
Changes
The M2M OAuth feature (added in #20788) auto-detected
client_credentialsflowwhenever
client_id,client_secret, andtoken_urlwere all set on an MCPserver. This broke existing interactive OAuth setups (e.g. GitHub Enterprise)
that configure those same three fields for
authorization_codeflow — LiteLLMwould silently drop the user's token and fetch its own M2M token instead.
Fix:
has_client_credentialsnow returnsFalseby default. M2M must beopted into explicitly:
Existing interactive OAuth configs (GitHub Enterprise etc.) work again with no
changes needed.
oauth2_flowdefaults toNone(interactive), so there's nobreaking change for those users.