refactor: replace auth provider registry with ImportString (#1710)

This commit is contained in:
Jeremiah Lowin 2025-09-02 08:31:52 -04:00 committed by GitHub
commit deff09fe07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 276 additions and 326 deletions

View file

@ -137,20 +137,24 @@ The client caches tokens locally, so you won't need to re-authenticate for subse
## Environment Variables
For production deployments, use environment variables instead of hardcoding credentials.
<VersionBadge version="2.12.1" />
<Info>
To use the registered GitHub provider, you must set `FASTMCP_SERVER_AUTH=GITHUB`. Learn more about [registered providers](/servers/auth/authentication#registered-providers).
</Info>
For production deployments, use environment variables instead of hardcoding credentials.
### Provider Selection
<ParamField path="FASTMCP_SERVER_AUTH" default="Not set" required>
Set to `GITHUB` to use the registered GitHubProvider with default configuration.
Setting this environment variable allows the GitHub provider to be used automatically without explicitly instantiating it in code.
<Card>
<ParamField path="FASTMCP_SERVER_AUTH" default="Not set">
Set to `fastmcp.server.auth.providers.github.GitHubProvider` to use GitHub authentication.
</ParamField>
</Card>
### GitHub-Specific Configuration
These environment variables provide default values for the GitHub provider, whether it's instantiated manually or configured via `FASTMCP_SERVER_AUTH`.
<Card>
<ParamField path="FASTMCP_SERVER_AUTH_GITHUB_CLIENT_ID" required>
Your GitHub OAuth App Client ID (e.g., `Ov23liAbcDefGhiJkLmN`)
@ -179,8 +183,8 @@ HTTP request timeout for GitHub API calls
Example `.env` file:
```bash
# Use the registered GitHub provider
FASTMCP_SERVER_AUTH=GITHUB
# Use the GitHub provider
FASTMCP_SERVER_AUTH=fastmcp.server.auth.providers.github.GitHubProvider
# GitHub OAuth credentials
FASTMCP_SERVER_AUTH_GITHUB_CLIENT_ID=Ov23liAbcDefGhiJkLmN