authorize_github
Generate a GitHub OAuth authorization URL to securely authenticate users and enable access to GitHub repositories and services.
Instructions
Generate GitHub authorization URL for user authorization.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/github_oauth/server.py:38-53 (handler)The main handler function for the 'authorize_github' tool. It checks if already authorized, otherwise generates and returns the GitHub OAuth authorization URL for the user to visit.@mcp.tool() async def authorize_github() -> str: """Generate GitHub authorization URL for user authorization.""" global access_token if access_token: return "Already authorized with an access token." authorization_url = ( f"https://github.com/login/oauth/authorize?" f"client_id={CLIENT_ID}&redirect_uri={REDIRECT_URI}&scope=repo" ) return ( f"Please authorize the application by visiting this URL:\n\n{authorization_url}\n\n" "Once authorized, provide the code you receive." )