Skip to content

refactor: make oauth discovery reactive#1052

Open
DaleSeo wants to merge 1 commit into
mainfrom
refactor/reactive-oauth-discovery
Open

refactor: make oauth discovery reactive#1052
DaleSeo wants to merge 1 commit into
mainfrom
refactor/reactive-oauth-discovery

Conversation

@DaleSeo

@DaleSeo DaleSeo commented Jul 24, 2026

Copy link
Copy Markdown
Member

Fixes #1048 at its root cause.

Motivation and Context

The POST probe, introduced in #960 to pass the client conformance suite, sends a synthetic JSON-RPC initialize request during discovery. Servers that accept it create sessions that are never cleaned up. Investigating the fix exposed a deeper structural issue.

  • The MCP spec defines discovery through the 401 response and its WWW-Authenticate header on the client's real request. Well-known URIs are the fallback.
  • Servers that return 404 or 405 for a session-less GET are still spec-compliant. In particular, the spec allows 405 for endpoints without SSE.
  • The TypeScript and Python SDKs do not use a probe. Their auth layers react to the 401 from the application's real request, so they do not have this problem.

This PR fixes the underlying issue instead of patching the probe by removing initialize POST probe entirely.

How Has This Been Tested?

Added tests

Breaking Changes

None

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

@github-actions github-actions Bot added T-core Core library changes T-examples Example code changes T-transport Transport layer changes labels Jul 24, 2026
@DaleSeo
DaleSeo force-pushed the refactor/reactive-oauth-discovery branch from 7d653d9 to 26b0a00 Compare July 24, 2026 22:56
@DaleSeo
DaleSeo marked this pull request as ready for review July 24, 2026 23:15
@DaleSeo
DaleSeo requested a review from a team as a code owner July 24, 2026 23:15
@DaleSeo
DaleSeo force-pushed the refactor/reactive-oauth-discovery branch from 26b0a00 to 1b06076 Compare July 24, 2026 23:56
@github-actions github-actions Bot added the T-service Service layer changes label Jul 24, 2026
@DaleSeo
DaleSeo force-pushed the refactor/reactive-oauth-discovery branch from 1b06076 to 3a18ab9 Compare July 25, 2026 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-examples Example code changes T-service Service layer changes T-transport Transport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OAuth discovery initialize POST probe can create server sessions that are never DELETEd

1 participant