-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
MCP Tool Inspector enters an infinite OAuth loop by repeatedly requesting new authorization codes instead of using the JWT token it successfully receives. This behavior prevents the client from completing the OAuth flow and accessing the MCP server.
Steps to reproduce the behavior:
Open MCP Tool Inspector and attempt to connect to an MCP server that requires OAuth authentication.
Follow the OAuth flow to authorize the client:
MCP Tool Inspector requests an authorization code from /api/oauth/authorize.
The server redirects to the callback URL with the authorization code.
MCP Tool Inspector exchanges the authorization code for a JWT token at /api/oauth/token.
Observe that instead of using the JWT token, MCP Tool Inspector requests a new authorization code, entering an infinite loop.
After receiving a JWT token from the /api/oauth/token endpoint, MCP Tool Inspector should use this token to authenticate requests to the MCP server, completing the OAuth flow successfully.
Redirecting to: http://localhost:6274/oauth/callback?code=ac_...
OAuth Token Exchange Request: { grant_type: 'authorization_code', ... }
Generated JWT token: eyJhbGciOiJIUzI1NiIs...
GET /api/oauth/authorize?response_type=code&client_id=...
The issue is specific to MCP Tool Inspector. Other clients like Cursor and Claude Desktop complete the OAuth flow successfully.
Enhanced logging indicates that MCP Tool Inspector receives the JWT token but does not use it, instead requesting a new authorization code.
The problem appears to be a client-side implementation bug in MCP Tool Inspector's handling of the OAuth flow.