Skip to content

Authenticating error with OAuth2.1 using FastMCP with AzureProvider #783

Closed

Description

@MartinGadd

Describe the bug
Authentication

To Reproduce
Steps to reproduce the behavior:

  1. Setup a custom MCP Server using FastMCP v2.12.0 and OAuth2.1 provider AzureProvider

  2. Connect to server using streamable https

  3. 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

  1. jlowin commented on Oct 20, 2025

    @jlowin

    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?

  2. MartinGadd commented on Oct 23, 2025

    @MartinGadd
    Author

    I have it working sucessfully with FastMCP v2.12.5 with persisitent storage and MCP Inspector v0.17.2 now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    authIssues and PRs related to authorizationbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions