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
Description
The current implementation of
GithubProvider(src/fastmcp/server/auth/providers/github.py) doesn't allow passingallowed_client_redirect_uris, which is required for mcp clients, e.g.,https://claude.ai/api/mcp/auth_callbackfor Claude Desktop andcursor://anysphere.cursor-retrieval/oauth/user-getgather-books/callbackfor CursorExample Code
Version Information