An Azure service that provides a hybrid, multi-cloud management platform for APIs.
The behavior described matches current MCP client behavior when used with Microsoft Entra–protected resources and is effectively a client limitation: the clients don’t fully honor arbitrary authorization_servers paths from the protected resource metadata and instead probe well-known endpoints in a fixed way.
From the documented MCP server authorization flow with Microsoft Entra ID:
- The MCP client (VS Code / GitHub Copilot) sends an initialization request.
- The MCP server responds with an authorization error that includes a pointer to Protected Resource Metadata (PRM).
- The client fetches the PRM and uses it to identify the authorization server.
- The client then attempts to obtain Authorization Server Metadata (ASM) from a well-known endpoint on the authorization server.
- Because Microsoft Entra ID does not support ASM on the “expected” well-known endpoint, the client falls back to the OpenID Connect metadata endpoint and tries multiple patterns, including inserting the well-known segment before or after path information, until it finds the working location.
In other words, current MCP clients implement a hard-coded discovery strategy tailored to Microsoft Entra ID rather than a generic RFC 9728 / RFC 8414 implementation that strictly respects arbitrary path components in authorization_servers. The documentation explicitly notes that:
- The client first tries a well-known endpoint pattern that Entra does not support.
- It then falls back to the OpenID Connect metadata endpoint and adjusts the path ordering to match where Entra actually hosts it.
This is consistent with what is observed: the client effectively normalizes discovery against the base authority and then probes well-known endpoints, instead of using the full path from authorization_servers as a strict base URL.
Given the available information, the practical guidance is:
- Treat this as a client limitation rather than an APIM misconfiguration.
- Align the topology with what current MCP clients expect:
- Expose the protected resource metadata and authorization server metadata in a way that works when the client resolves well-known endpoints relative to the root authority (host) rather than a subpath.
- Avoid relying on non-root path prefixes in the
authorization_serversURL for discovery, because the clients may ignore or reorder that path.
- When integrating with Microsoft Entra ID, follow the documented pattern used by Azure App Service and Azure Functions MCP samples, which rely on:
- A PRM endpoint at
/.well-known/oauth-protected-resource. - Client-side logic that falls back to the OpenID Connect metadata endpoint hosted by Entra ID (with the well-known segment after path information) instead of a custom subpath on the resource server.
- A PRM endpoint at
There is no example in the provided material of a successful MCP configuration that uses a non-root authorization server prefix behind APIM; all documented flows assume discovery against the standard well-known locations associated with the Entra authority rather than a custom APIM subpath.
For a robust workaround with today’s clients, design the APIM surface so that:
- The PRM endpoint is reachable at the standard well-known location for the resource host.
- The
authorization_serversvalue points to an authority whose metadata is available at the standard OpenID Connect / OAuth well-known locations without requiring additional path prefixes.
References:
- Tutorial: Host an MCP server on Azure Functions (programming-language-powershell)
- Tutorial: Host an MCP server on Azure Functions (programming-language-python)
- Tutorial: Host an MCP server on Azure Functions (programming-language-typescript)
- Tutorial: Host an MCP server on Azure Functions (programming-language-javascript)
- Tutorial: Host an MCP server on Azure Functions (programming-language-csharp)
- Secure Model Context Protocol calls to Azure App Service from Visual Studio Code with Microsoft Entra authentication
- Troubleshoot MCP servers on Azure Container Apps