Skip to content

[Auth] Fails to Use JWT Token, Enters Infinite OAuth LoopΒ #633

@Grebyn35

Description

@Grebyn35

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    authIssues and PRs related to authorizationbugSomething isn't workingp1-highHigh priority - should be addressed soonwaiting on submitterWaiting for the submitter to provide more info

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions