Skip to content

fix: preserve OAuth authorization endpoint query params#2819

Closed
Zhang-986 wants to merge 1 commit into
modelcontextprotocol:mainfrom
Zhang-986:codex/oauth-auth-endpoint-query
Closed

fix: preserve OAuth authorization endpoint query params#2819
Zhang-986 wants to merge 1 commit into
modelcontextprotocol:mainfrom
Zhang-986:codex/oauth-auth-endpoint-query

Conversation

@Zhang-986

Copy link
Copy Markdown

Summary

  • preserve existing query parameters on OAuth authorization endpoints when building the redirect URL
  • append SDK-generated authorization request parameters with proper URL query encoding
  • add a regression test for authorization endpoints such as /authorize?prompt=select_account

Fixes #2776.

Tests

  • uv run --frozen pytest tests/client/test_auth.py -k authorization_endpoint_query_params_are_preserved (fails before the fix, passes after)
  • uv run --frozen pytest tests/client/test_auth.py
  • uv run --frozen ruff check src/mcp/client/auth/oauth2.py tests/client/test_auth.py
  • uv run --frozen pyright src/mcp/client/auth/oauth2.py tests/client/test_auth.py
  • git diff --check

@Kludex

Kludex commented Jun 25, 2026

Copy link
Copy Markdown
Member

You've opened a duplicated pull request, please search opened PRs before creating new ones. Duplicated from #2779.

@Kludex Kludex closed this Jun 25, 2026
@modelcontextprotocol modelcontextprotocol locked as resolved and limited conversation to collaborators Jun 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OAuth handler doesn't support redirect URLs with params

2 participants