Skip to main content
Glama
ddukbg

GitHub Enterprise MCP Server

get-user

Retrieve user details from GitHub Enterprise by providing the username, enabling integration with GitHub API features via the MCP server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYesUsername of the user to retrieve

Implementation Reference

  • MCP tool registration for 'get-user', including inline Zod input schema and the handler function that retrieves user details using the UserManagement helper and formats the response.
    server.tool( "get-user", { username: z.string().describe("Username of the user to retrieve") }, async ({ username }) => { try { const user = await context.users.getUser(context.client, { username }); return { content: [ { type: "text", text: `User details for '${username}':\n\n${JSON.stringify(user, null, 2)}` } ] }; } catch (error: any) { console.error('Error getting user details:', error); return { content: [ { type: "text", text: `An error occurred while retrieving user details: ${error.message}` } ], isError: true }; } } );
  • Core helper function getUser in UserManagement class that performs the actual GitHub API call to retrieve user information from /users/{username} endpoint.
    async getUser(client: any, params: GetUserParams): Promise<User> { try { const { baseUrl, token } = client; const { username } = params; if (!username) { throw new Error('Username is required'); } const url = `${baseUrl}/users/${username}`; const response = await axios.get(url, { headers: { Authorization: `token ${token}`, Accept: 'application/vnd.github.v3+json' } }); return response.data; } catch (error: any) { if (error.response?.status === 404) { throw new Error(`User '${params.username}' not found`); } throw new Error(`Failed to get user: ${error.message}`); } }
  • TypeScript interface GetUserParams defining the input parameters (username) for the getUser helper function.
    export interface GetUserParams { /** * Username of the user to retrieve */ username: string; }
  • TypeScript interface User defining the output type returned by getUser, including user details like login, id, name, email, etc.
    export interface User { login: string; id: number; node_id: string; avatar_url: string; gravatar_id: string; url: string; html_url: string; followers_url: string; following_url: string; gists_url: string; starred_url: string; subscriptions_url: string; organizations_url: string; repos_url: string; events_url: string; received_events_url: string; type: string; site_admin: boolean; name?: string; company?: string; blog?: string; location?: string; email?: string; hireable?: boolean; bio?: string; twitter_username?: string; public_repos?: number; public_gists?: number; followers?: number; following?: number; created_at?: string; updated_at?: string; suspended?: boolean; private_gists?: number; total_private_repos?: number; owned_private_repos?: number; disk_usage?: number; collaborators?: number; two_factor_authentication?: boolean; plan?: { name: string; space: number; private_repos: number; collaborators: number; }; }

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/ddukbg/github-enterprise-mcp'

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