Skip to content

OAuth issuer validation incorrectly uses MCP endpoint as expected issuer #3734

Description

@ddrozdovich

Summary

Mux fails OAuth authentication against GitLab MCP and Jira MCP servers because it validates the OAuth issuer against the MCP endpoint URL instead of the OAuth Authorization Server issuer.

This results in errors similar to:

OAuth authorization server metadata issuer https://gitlab.example.com
does not match expected issuer https://gitlab.example.com/api/v4/mcp

The OAuth metadata returned by GitLab is correct according to RFC 8414.

The failure appears to originate from Mux's OAuth discovery flow.


Environment

  • Mux: latest main
  • GitLab MCP
  • Jira MCP
  • OAuth Authorization Server Metadata (RFC 8414)

Reproduction

Configure an MCP server:

https://gitlab.example.com/api/v4/mcp

During OAuth authentication Mux reports:

OAuth authorization server metadata issuer https://gitlab.example.com
does not match expected issuer https://gitlab.example.com/api/v4/mcp

GitLab Metadata

GitLab exposes the following OAuth metadata:

{
  "issuer": "https://gitlab.example.com",
  "authorization_endpoint": "https://gitlab.example.com/oauth/authorize",
  "token_endpoint": "https://gitlab.example.com/oauth/token"
}

which is exactly what GitLab should expose.

The OAuth Authorization Server is

https://gitlab.example.com

while the MCP Protected Resource is

https://gitlab.example.com/api/v4/mcp

These are intentionally different resources.


Expected behaviour

Mux should discover the Authorization Server from the MCP Protected Resource metadata and validate against

metadata.issuer

using the Authorization Server URL.

Expected issuer:

https://gitlab.example.com

Actual behaviour

Mux appears to derive the expected issuer from the MCP endpoint:

expectedIssuer =
https://gitlab.example.com/api/v4/mcp

instead of

https://gitlab.example.com

Result:

issuer=https://gitlab.example.com
!=
expectedIssuer=https://gitlab.example.com/api/v4/mcp

which causes authentication to fail.


Affected servers

Confirmed:

  • GitLab MCP
  • Jira MCP

Likely any MCP server where

Authorization Server URL
≠
Protected Resource URL

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions