From bc25802a287788e2bbc4c967fafb4a5c22d7e46b Mon Sep 17 00:00:00 2001 From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com> Date: Mon, 1 Sep 2025 16:44:50 -0400 Subject: [PATCH] Update documentation around scopes for google (#1703) --- docs/integrations/google.mdx | 9 ++++++--- src/fastmcp/server/auth/oauth_proxy.py | 4 +--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/integrations/google.mdx b/docs/integrations/google.mdx index c3ff3cc7b..ba65406e0 100644 --- a/docs/integrations/google.mdx +++ b/docs/integrations/google.mdx @@ -77,7 +77,10 @@ auth_provider = GoogleProvider( client_id="123456789.apps.googleusercontent.com", # Your Google OAuth Client ID client_secret="GOCSPX-abc123...", # Your Google OAuth Client Secret base_url="http://localhost:8000", # Must match your OAuth configuration - required_scopes=["openid", "email", "profile"], # Request user information + required_scopes=[ # Request user information + "openid", + "https://www.googleapis.com/auth/userinfo.email", + ], # redirect_path="/auth/callback" # Default value, customize if needed ) @@ -179,7 +182,7 @@ Redirect path configured in your Google OAuth Client -Comma-, space-, or JSON-separated list of required Google scopes (e.g., `openid,profile` or `["openid","profile"]`) +Comma-, space-, or JSON-separated list of required Google scopes (e.g., `"openid,https://www.googleapis.com/auth/userinfo.email"` or `["openid", "https://www.googleapis.com/auth/userinfo.email"]`) @@ -196,7 +199,7 @@ FASTMCP_SERVER_AUTH=GOOGLE FASTMCP_SERVER_AUTH_GOOGLE_CLIENT_ID=123456789.apps.googleusercontent.com FASTMCP_SERVER_AUTH_GOOGLE_CLIENT_SECRET=GOCSPX-abc123... FASTMCP_SERVER_AUTH_GOOGLE_BASE_URL=https://your-server.com -FASTMCP_SERVER_AUTH_GOOGLE_REQUIRED_SCOPES=openid,email,profile +FASTMCP_SERVER_AUTH_GOOGLE_REQUIRED_SCOPES=openid,https://www.googleapis.com/auth/userinfo.email ``` With environment variables set, your server code simplifies to: diff --git a/src/fastmcp/server/auth/oauth_proxy.py b/src/fastmcp/server/auth/oauth_proxy.py index 14a6e9fd0..15a52e7e1 100644 --- a/src/fastmcp/server/auth/oauth_proxy.py +++ b/src/fastmcp/server/auth/oauth_proxy.py @@ -259,9 +259,7 @@ class OAuthProxy(OAuthProvider): redirect_path: Redirect path configured in upstream OAuth app (defaults to "/auth/callback") issuer_url: Issuer URL for OAuth metadata (defaults to base_url) service_documentation_url: Optional service documentation URL - resource_server_url: Path of the FastMCP server. If None, FastMCP will - attempt to overwrite this with the correct path to the server - e.g. {base_url}/mcp + resource_server_url: Path of the FastMCP server. allowed_client_redirect_uris: List of allowed redirect URI patterns for MCP clients. Patterns support wildcards (e.g., "http://localhost:*", "https://*.example.com/*"). If None (default), only localhost redirect URIs are allowed.