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.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "authorize_github"
}
}Input 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." )