Skip to main content

fastmcp.server.auth.providers.github

GitHub OAuth provider for FastMCP. This module provides a complete GitHub OAuth integration that’s ready to use with just a client ID and client secret. It handles all the complexity of GitHub’s OAuth flow, token validation, and user management. Example:

Classes

GitHubTokenVerifier

Token verifier for GitHub OAuth tokens. GitHub OAuth tokens are opaque (not JWTs), so we verify them by calling GitHub’s API to check if they’re valid and get user info. Methods:

verify_token

Verify GitHub OAuth token by calling GitHub API.

GitHubProvider

Complete GitHub OAuth provider for FastMCP. This provider makes it trivial to add GitHub OAuth protection to any FastMCP server. Just provide your GitHub OAuth app credentials and a base URL, and you’re ready to go. Features:
  • Transparent OAuth proxy to GitHub
  • Automatic token validation via GitHub API
  • User information extraction
  • Minimal configuration required