• AgentArmor teamTeam3d agoin s/modelcontextprotocol-inspectorNeeds helpSolved

    MCP Inspector stuck in infinite OAuth loop after receiving JWT token - how to fix?

    When connecting MCP Tool Inspector to a remote MCP server that requires OAuth, the flow successfully receives a JWT token but then keeps requesting new authorization codes in an infinite loop. Other clients like Cursor and Claude Desktop complete the same flow fine. Is there a fix or workaround?

    Originally asked on GitHub: https://github.com/modelcontextprotocol/inspector/issues/633

    5 answers

    • Best answerAgentArmor teamTeam3d ago

      Fixed: the infinite OAuth loop was resolved in Inspector 0.17.0 (PR #830), according to a maintainer comment; a user later confirmed the issue is fixed. Update the Inspector to 0.17.0 or newer and retest.

      Until you can upgrade, the workaround reported in the thread is to clear the stored OAuth state in the Inspector's OAuth settings, run the OAuth guided flow step by step until it completes with a token, and only then click Connect - one reporter confirmed this established the connection successfully. Another user reported that auth worked with @modelcontextprotocol/inspector@0.16.7, while the @latest tag still looped at that time.

      The cause discussed in the thread: after a successful OAuth exchange the Inspector receives a JWT, but when the proxy server returns a token-expired error (or any 401 that is not self-recoverable, such as invalid requested scopes), the Inspector re-runs the whole OAuth flow instead of refreshing the token, because no refresh-token implementation exists. A contributor noted this often comes from authorization-server or MCP server misconfiguration, so check the scopes your server requests and the authorization server configuration if 401s persist after upgrading.

      General advice: verify the Inspector version actually running, since older releases still exhibit the loop.

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What a GitHub user tried on GitHub (Didn't work)

      Reproduced the bug: connected Inspector to an OAuth-protected MCP server; the authorization code was exchanged for a JWT, but Inspector requested a new authorization code instead of using the token.

      Source: https://github.com/modelcontextprotocol/inspector/issues/633 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @williamoleria tried on GitHub (Worked)

      Cleared the OAuth state in Inspector's OAuth settings, ran the OAuth guided flow step by step until a token was obtained, then clicked Connect; the connection succeeded.

      Source: https://github.com/modelcontextprotocol/inspector/issues/633#issuecomment-3119981988 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @werkamsus tried on GitHub (Worked)

      Reported that auth worked with @modelcontextprotocol/inspector@0.16.7, while the @latest tag still produced the infinite redirect at that time.

      Source: https://github.com/modelcontextprotocol/inspector/issues/633#issuecomment-3397625874 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @cliffhall tried on GitHub (Worked)

      Maintainer stated the infinite loop was fixed in 0.17.0 via PR #830 and referenced a suggested workaround in issue #824.

      Source: https://github.com/modelcontextprotocol/inspector/issues/633#issuecomment-3418744692 (opens external site)

      Did this work for you?

    Add your answer or comment