Skip to content

fix: fix OAuth flow request object handling #1174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2025

Conversation

clareliguori
Copy link
Contributor

@clareliguori clareliguori commented Jul 19, 2025

Motivation and Context

Fixes #1173

How Has This Been Tested?

New unit test fails before change and succeeds after

Example unit test failure before the change, highlighting the request handling bug:

       # Final request should be the original request with auth header
        final_request = await auth_flow.asend(token_response)
        assert final_request.headers["Authorization"] == "Bearer new_access_token"
        assert final_request.method == "GET"
>       assert str(final_request.url) == "https://api.example.com/mcp"
E       AssertionError: assert 'https://auth...zation-server' == 'https://api.example.com/mcp'
E         
E         - https://api.example.com/mcp
E         + https://auth.example.com/.well-known/oauth-authorization-server

tests/client/test_auth.py:581: AssertionError

Breaking Changes

No

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@clareliguori clareliguori changed the title DRAFT: fix for OAuth request bug fix: fix OAuth flow request handling Jul 19, 2025
@clareliguori clareliguori marked this pull request as ready for review July 19, 2025 04:53
@clareliguori clareliguori requested review from a team as code owners July 19, 2025 04:53
@clareliguori clareliguori requested review from pcarleton and ihrpr July 19, 2025 04:53
@clareliguori clareliguori changed the title fix: fix OAuth flow request handling fix: fix OAuth flow request object handling Jul 19, 2025
@ihrpr ihrpr added this to the auth milestone Jul 21, 2025
Copy link
Contributor

@ihrpr ihrpr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for the fix!

@ihrpr ihrpr merged commit 6a84a2f into modelcontextprotocol:main Jul 21, 2025
10 checks passed
@clareliguori clareliguori deleted the oauth-request-bug branch July 21, 2025 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Response parsing errors after OAuth flow
2 participants