github strategy to authenticate users with their GitHub accounts. This is a preset of the generic OAuth flow with GitHub’s endpoints pre-configured.
Creating a GitHub OAuth App
- Go to your GitHub account Settings > Developer settings
- Select OAuth Apps > New OAuth App
- Fill in the application details:
- Application name: Choose a descriptive name (e.g., “My MCP Server”)
- Homepage URL: Your server’s homepage URL (e.g.,
https://my-mcp.example.com) - Authorization callback URL:
- For production:
https://your-domain.com/oauth/provider-callback - For local development:
http://localhost:3000/oauth/provider-callback
- For production:
- Click Register application
- On the next page, click Generate a new client secret
- Copy the Client ID and Client Secret
Environment Setup
Preset Values
| Setting | Default |
|---|---|
| Accounts URL | https://github.com |
| Authorization URL | https://github.com/login/oauth/authorize |
| Token URL | https://github.com/login/oauth/access_token |
| Default scopes | read:user |
Available Scopes
GitHub OAuth scopes you may need:| Scope | Description |
|---|---|
read:user | Read user profile information |
user:email | Read user email addresses |
read:org | Read organization membership |
repo | Full control of private and public repositories |
repo:status | Commit status access |
workflow | Update GitHub Actions workflow files |
Example: GitHub API Access
Tool Context
WhenAUTH_STRATEGY=github, successful authentication populates the tool context with:
context.providerToken— the GitHub access tokencontext.resolvedHeaders—{ Authorization: "Bearer <github-access-token>" }context.provider— provider info object withaccessToken,refreshToken(if granted),expiresAt,scopescontext.authStrategy—"github"