Configuration
Prerequisites
Before you begin, you will need:- A GitHub Account with access to create OAuth Apps
- Your FastMCP server’s URL (can be localhost for development, e.g.,
http://localhost:8000)
Step 1: Create a GitHub OAuth App
Create an OAuth App in your GitHub settings to get the credentials needed for authentication:Navigate to OAuth Apps
Go to Settings → Developer settings → OAuth Apps in your GitHub account, or visit github.com/settings/developers.Click “New OAuth App” to create a new application.
Configure Your OAuth App
Fill in the application details:
- Application name: Choose a name users will recognize (e.g., “My FastMCP Server”)
- Homepage URL: Your application’s homepage or documentation URL
- Authorization callback URL: Your server URL +
/auth/callback(e.g.,http://localhost:8000/auth/callback)
Step 2: FastMCP Configuration
Create your FastMCP server using theGitHubProvider, which handles GitHub’s OAuth quirks automatically:
server.py
Testing
Running the Server
Start your FastMCP server with HTTP transport to enable OAuth flows:Testing with a Client
Create a test client that authenticates with your GitHub-protected server:test_client.py
- Your browser will open to GitHub’s authorization page
- After you authorize the app, you’ll be redirected back
- The client receives the token and can make authenticated requests
The client caches tokens locally, so you won’t need to re-authenticate for subsequent runs unless the token expires or you explicitly clear the cache.
Production Configuration
For production deployments with persistent token management across server restarts, configurejwt_signing_key and client_storage:
server.py
Parameters (
jwt_signing_key and client_storage) work together to ensure tokens and client registrations survive server restarts. Wrap your storage in FernetEncryptionWrapper to encrypt sensitive OAuth tokens at rest - without it, tokens are stored in plaintext. Store secrets in environment variables and use a persistent storage backend like Redis for distributed deployments.For complete details on these parameters, see the OAuth Proxy documentation.
