Secure your FastMCP server with Azure/Microsoft Entra OAuth
New in version:Â 2.12.0
This guide shows you how to secure your FastMCP server using Azure OAuth (Microsoft Entra ID). Since Azure doesnât support Dynamic Client Registration, this integration uses the OAuth Proxy pattern to bridge Azureâs traditional OAuth with MCPâs authentication requirements.
http://localhost:8000
)Navigate to App registrations
Configure Your Application
/auth/callback
(e.g., http://localhost:8000/auth/callback
)/auth/callback
, but you can customize it using the redirect_path
parameter. For local development, Azure allows http://localhost
URLs. For production, you must use HTTPS./auth/azure/callback
), make sure to set the same path in both your Azure App registration and the redirect_path
parameter when configuring the AzureProvider.Create Client Secret
Note Your Credentials
835f09b6-0f0f-40cc-85cb-f32c5829a149
08541b6e-646d-43de-a0eb-834e6713d6d5
AzureProvider
, which handles Azureâs OAuth flow automatically:
tenant_id
parameter is REQUIRED. Azure no longer supports using âcommonâ for new applications due to security requirements. You must use one of:08541b6e-646d-43de-a0eb-834e6713d6d5
)FASTMCP_SERVER_AUTH=AZURE
. Learn more about registered providers.AZURE
to use the registered AzureProvider with default configuration.835f09b6-0f0f-40cc-85cb-f32c5829a149
).env
file: