Secure your FastMCP server with Google OAuth
New in version: 2.12.0
This guide shows you how to secure your FastMCP server using Google OAuth. Since Google doesn’t support Dynamic Client Registration, this integration uses the OAuth Proxy pattern to bridge Google’s traditional OAuth with MCP’s authentication requirements.
http://localhost:8000
)Navigate to OAuth Consent Screen
Create OAuth 2.0 Client ID
http://localhost:8000
)/auth/callback
(e.g., http://localhost:8000/auth/callback
)/auth/callback
, but you can customize it using the redirect_path
parameter. For local development, Google allows http://localhost
URLs with various ports. For production, you must use HTTPS./auth/google/callback
), make sure to set the same path in both your Google OAuth Client settings and the redirect_path
parameter when configuring the GoogleProvider.Save Your Credentials
.apps.googleusercontent.com
GOCSPX-
GoogleProvider
, which handles Google’s OAuth flow automatically:
FASTMCP_SERVER_AUTH=GOOGLE
. Learn more about registered providers.GOOGLE
to use the registered GoogleProvider with default configuration.123456789.apps.googleusercontent.com
)GOCSPX-abc123...
)openid
).env
file: