60e0ffc959
Upgrade checks / Notify on failure (push) Has been cancelled
Upgrade checks / Close issue on success (push) Has been cancelled
Schema Crash Test / Real-world schema crash test (232K schemas) (push) Has been cancelled
Run static analysis / static_analysis (push) Has been cancelled
Tests / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Tests / Tests with lowest-direct dependencies (push) Has been cancelled
Tests / MCP conformance tests (push) Has been cancelled
Tests / Integration tests (push) Has been cancelled
Tests / Package install smoke (push) Has been cancelled
Upgrade checks / Static analysis (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Upgrade checks / Integration tests (push) Has been cancelled
Update MCPServerConfig Schema / update-config-schema (push) Has been cancelled
Update SDK Documentation / update-sdk-docs (push) Has been cancelled
1.3 KiB
1.3 KiB
Azure (Microsoft Entra) OAuth Example
This example demonstrates how to use the Azure OAuth provider with FastMCP servers.
Setup
1. Azure App Registration
- Go to Azure Portal → App registrations
- Click "New registration" and configure:
- Name: Your app name
- Supported account types: Choose based on your needs
- Redirect URI:
http://127.0.0.1:8000/auth/callback(Web platform)
- After creation, go to "Certificates & secrets" → "New client secret"
- Note these values from the Overview page:
- Application (client) ID
- Directory (tenant) ID
2. Environment Variables
Create a .env file:
# Required
AZURE_CLIENT_ID=your-application-client-id
AZURE_CLIENT_SECRET=your-client-secret-value
AZURE_TENANT_ID=your-tenant-id # From Azure Portal Overview page
3. Run the Example
Start the server:
uv run python server.py
Test with client:
uv run python client.py
Tenant Configuration
The tenant_id parameter is required and controls which accounts can authenticate:
- Your tenant ID: Single organization (most common)
organizations: Any work/school accountconsumers: Personal Microsoft accounts only