Skip to content

GitHubProvider constructor missing allowed_client_redirect_uris #1658

Description

@bin-ario

Description

The current implementation of GithubProvider (src/fastmcp/server/auth/providers/github.py) doesn't allow passing allowed_client_redirect_uris, which is required for mcp clients, e.g., https://claude.ai/api/mcp/auth_callback for Claude Desktop and cursor://anysphere.cursor-retrieval/oauth/user-getgather-books/callback for Cursor

Example Code

diff --git a/src/fastmcp/server/auth/providers/github.py b/src/fastmcp/server/auth/providers/github.py
index 4f3fcc8..1d6809f 100644
--- a/src/fastmcp/server/auth/providers/github.py
+++ b/src/fastmcp/server/auth/providers/github.py
@@ -51,6 +51,7 @@ class GitHubProviderSettings(BaseSettings):
     redirect_path: str | None = None
     required_scopes: list[str] | None = None
     timeout_seconds: int | None = None
+    allowed_client_redirect_uris: list[str] | None = None
 
     @field_validator("required_scopes", mode="before")
     @classmethod
@@ -201,6 +202,7 @@ class GitHubProvider(OAuthProxy):
         redirect_path: str | NotSetT = NotSet,
         required_scopes: list[str] | None | NotSetT = NotSet,
         timeout_seconds: int | NotSetT = NotSet,
+        allowed_client_redirect_uris: list[str] | None | NotSetT = NotSet,
     ):
         """Initialize GitHub OAuth provider.
 
@@ -222,6 +224,7 @@ class GitHubProvider(OAuthProxy):
                     "redirect_path": redirect_path,
                     "required_scopes": required_scopes,
                     "timeout_seconds": timeout_seconds,
+                    "allowed_client_redirect_uris": allowed_client_redirect_uris,
                 }.items()
                 if v is not NotSet
             }
@@ -264,6 +267,7 @@ class GitHubProvider(OAuthProxy):
             base_url=base_url_final,
             redirect_path=redirect_path_final,
             issuer_url=base_url_final,  # We act as the issuer for client registration
+            allowed_client_redirect_uris=settings.allowed_client_redirect_uris,
         )
 
         logger.info(

Version Information

FastMCP version:                        0.0.1.dev2040+1afde31
MCP version:                                           1.12.4
Python version:                                       3.12.10
Platform:                        macOS-15.6.1-arm64-arm-64bit
FastMCP root path: /Users/bin/dev/fastmcp_github-auth-fix/src

Metadata

Metadata

Assignees

No one assigned

    Labels

    authRelated to authentication (Bearer, JWT, OAuth, WorkOS) for client or server.enhancementImprovement to existing functionality. For issues and smaller PR improvements.serverRelated to FastMCP server implementation or server-side functionality.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions