Repository navigation
Authenticating error with OAuth2.1 using FastMCP with AzureProvider #783
Description
Describe the bug
Authentication
To Reproduce
Steps to reproduce the behavior:
-
Setup a custom MCP Server using FastMCP v2.12.0 and OAuth2.1 provider AzureProvider
-
Connect to server using streamable https
-
custom MCP server responds
{"error":"invalid_request","error_description":"Client ID 'c15ef69f-da57-4c0d-b9c7-0e4fbd514432' not found","state":"d1dac54a632f24111bc728e23e55df4d51db0de9fb33bdcda2850f18d5828896"}
Expected behavior
Login should work using a modal from MS Entra
Logs
Fast MCP log when not working:
INFO: 10.104.28.3:35126 - "POST /mcp HTTP/1.1" 401 Unauthorized INFO: 10.104.28.3:35126 - "OPTIONS /.well-known/oauth-protected-resource/mcp HTTP/1.1" 404 Not Found INFO: 10.104.28.3:35126 - "GET /.well-known/oauth-protected-resource/mcp HTTP/1.1" 404 Not Found INFO: 10.104.28.3:35126 - "GET /authorize?response_type=code&client_id=*****&code_challenge=****&code_challenge_method=S256&redirect_uri=http%3A%2F%2Flocalhost%3A6274%2Foauth%2Fcallback&resource=***** HTTP/1.1" 400 Bad Request
Fast MCP log when working:
INFO: 10.104.28.3:55890 - "POST /mcp HTTP/1.1" 401 Unauthorized INFO: 10.104.28.3:55898 - "OPTIONS /.well-known/oauth-protected-resource/mcp HTTP/1.1" 404 Not Found INFO: 10.104.28.3:55898 - "GET /.well-known/oauth-protected-resource/mcp HTTP/1.1" 404 Not Found INFO: 10.104.28.3:55898 - "OPTIONS /.well-known/oauth-protected-resource HTTP/1.1" 200 OK INFO: 10.104.28.3:55898 - "OPTIONS /.well-known/oauth-authorization-server/mcp HTTP/1.1" 404 Not Found INFO: 10.104.28.3:55898 - "GET /.well-known/oauth-authorization-server/mcp HTTP/1.1" 404 Not Found INFO: 10.104.28.3:55898 - "OPTIONS /.well-known/oauth-authorization-server HTTP/1.1" 200 OK INFO: 10.104.28.3:55898 - "OPTIONS /register HTTP/1.1" 200 OK INFO: 10.104.28.3:55898 - "POST /register HTTP/1.1" 201 Created INFO: 10.104.30.8:36726 - "GET /authorize?response_type=code&client_id=********&code_challenge=*******&code_challenge_method=S256&redirect_uri=******&resource=***** HTTP/1.1" 302 Found INFO: 10.104.28.3:40022 - "GET /auth/callback?code=*******&session_state=********** HTTP/1.1" 302 Found INFO: 10.104.28.3:40022 - "OPTIONS /.well-known/oauth-protected-resource/mcp HTTP/1.1" 404 Not Found INFO: 10.104.28.3:40022 - "GET /.well-known/oauth-protected-resource/mcp HTTP/1.1" 404 Not Found INFO: 10.104.28.3:40022 - "OPTIONS /.well-known/oauth-authorization-server/mcp HTTP/1.1" 404 Not Found INFO: 10.104.28.3:40022 - "GET /.well-known/oauth-authorization-server/mcp HTTP/1.1" 404 Not Found INFO: 10.104.28.3:40022 - "POST /token HTTP/1.1" 200 OK INFO: 10.104.28.3:40022 - "POST /mcp HTTP/1.1" 200 OK INFO: 10.104.28.3:40022 - "POST /mcp HTTP/1.1" 202 Accepted INFO: 10.104.30.8:41192 - "GET /mcp HTTP/1.1" 200 OK
Additional context
Login is working properly when running modelcontextprotocol/inspector v.0.16.1
Activity
jlowin commentedon Oct 20, 2025
The Azure provider is significantly enhanced in FastMCP 2.13.0 (currently rc); moreover
{"error":"invalid_request","error_description":"Client ID 'c15ef69f-da57-4c0d-b9c7-0e4fbd514432' not found","state":"d1dac54a632f24111bc728e23e55df4d51db0de9fb33bdcda2850f18d5828896"}is frequently the result of a FastMCP server that successfully registered a client and was subsequently restarted but has no persistent storage. In this case I suspect this is more of a FastMCP issue than an Inspector issuer - could you try to connect with a FastMCP client and if that fails, open an issue on the fastmcp repo?MartinGadd commentedon Oct 23, 2025
I have it working sucessfully with FastMCP v2.12.5 with persisitent storage and MCP Inspector v0.17.2 now.