Skip to content

Auth Discussion - Support Azure Auth Server #685

@2underscores

Description

@2underscores

Had to make 4 adjustments to inspector to get the debug OAuth flow to work with an MCP server using Azure authorisation server (AS). Changes were:

  1. Inspector client not following Oauth standards/MCP spec - Not checking all common /.well-known AS metadata endpoints
  2. Inspector client not following MCP spec - Mandating DCR without static client ID fallback
  3. Azure AS not following OAuth spec - PKCE supported but not advertised in metadata
  4. Azure AS behaviour - Not a spec break, but it doesn't support resource param and fails if it is provided.

Main question

1 & 2 are issues in inspector and should be changed (PRs already raised). For 3 & 4 should MCP Inspector make some minor changes to support MCP servers using Azure as AS, or not?

Details on 4 Issues

1. AS Metadata Endpoints

Inspector only checks /.well-known/openid-configuration and not the other, common /.well-known/openid-configuration. This is somewhat OAuth standards (RFC8414 ~=acks openid should be supported) and against MCP spec discovery section. Closed my PR (#651) as upstream fix in core MCP auth library addressing this - modelcontextprotocol/typescript-sdk#652

2. No pre-registered Client alternative to DCR

MCP spec has DCR support as a "should", but MCP inspector implementation makes it a "must". Inspector already has concept of user provided client ID, it just wasn't used in debug flow. Easy fix, and more details in PR - #684. Issue already raised with #683

3. Azure AS not advertise PKCE

Azure AS supports PKCE, but it's metadata payload does not include a code_challenge_methods_supported field at all. RFC8414 is explicit - "If omitted, the authorization server does not support PKCE". This is on Azure, but unlikely to change. It's a known issue, and the metadata doc cannot be manually changed AFAIK.

Azure bypass for this (& # 4) is at these commits on my fork. Not PR-ing (yet) as discussion is about whether this client should flex the rules to support one of the largest AS providers.

4. Azure use scope param, not resource param

Nothing in OAuth mandates use of RFC 8707's resource params. Azure v2 endpoints do not accept resource params (They don't silently drop as this PR suspected all AS would, but rather throw error “AADSTS901002: The ‘resource’ request parameter is not supported.). MCP does mandate RFC 8707 - "MCP clients MUST implement Resource Indicators".

Azure v2 uses scopes instead. If anyone knows more about this would love some pointers, but AFAIK Azure v1 introduces resources, RFC 8707 is based of Azure's pattern, then Azure bailed on them in favour of scopes. What.

An example of how to remove resource is here (no Azure conditionals, just me confirming that removing them does fix the flow) - these commits on my fork.

Summary

Azure AS does not advertise RFC 8414's code_challenge_methods_supported in metadata properly, or support RFC 8707's resource params (which MCP spec mandates). This means, if RFC 8414 and MCP spec is strictly followed, Azure AD cannot be used as the AS for MCP servers. They are a large AS provider and these issues have been there a long time, so i suspect clients typically just support Azure's quirks with bypasses. Should MCP inspector add bypasses for these issues for compatibility with Azure, based on assumption that's what many other clients will do?

Metadata

Metadata

Assignees

No one assigned

    Labels

    authIssues and PRs related to authentication and/or authorizationp3-lowLow priority - can be addressed when time permitsspec complianceLabel for issues and PRs that are related to adding or fixing support for a specific spec feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions