Skip to main content
Glama
Nikhil-Patil-RI

Github-Oauth MCP Server

get_user_profile

Retrieve authenticated GitHub user profile data to access account information and verify identity for authorized API interactions.

Instructions

Fetch the authenticated user's GitHub profile.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_user_profile' tool. It checks for an access token, makes a request to the GitHub /user endpoint, and returns a formatted string with the user's profile details including username, name, email, repos, followers, etc.
    @mcp.tool() async def get_user_profile() -> str: """Fetch the authenticated user's GitHub profile.""" global access_token if not access_token: return "You are not authorized. Please authorize first." url = f"{GITHUB_API_BASE}/user" headers = { "Authorization": f"Bearer {access_token}", "User-Agent": USER_AGENT, } data = await make_request(url, headers) if not data: return "Unable to fetch user profile." return ( f"Username: {data.get('login', 'N/A')}\n" f"Name: {data.get('name', 'N/A')}\n" f"Email: {data.get('email', 'N/A')}\n" f"Public Repositories: {data.get('public_repos', 'N/A')}\n" f"Followers: {data.get('followers', 'N/A')}\n" f"Following: {data.get('following', 'N/A')}\n" f"Profile URL: {data.get('html_url', 'N/A')}" )
  • Helper utility function used by get_user_profile (and others) to perform authenticated HTTP GET requests to the GitHub API.
    async def make_request(url: str, headers: dict[str, str], params: dict[str, str] = None) -> Optional[dict[str, Any]]: """Make an HTTP GET request with error handling.""" async with httpx.AsyncClient() as client: try: response = await client.get(url, headers=headers, params=params, timeout=30.0) response.raise_for_status() return response.json() except Exception as e: print(f"Request failed: {e}") return None

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Nikhil-Patil-RI/MCP-Github-Oauth'

If you have feedback or need assistance with the MCP directory API, please join our Discord server