Skip to main content
Glama
ddukbg

GitHub Enterprise MCP Server

list-user-orgs

Retrieve a list of organizations associated with a specific GitHub Enterprise user using their username, with options for pagination and results per page.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number for pagination
per_pageNoNumber of results per page (max 100)
usernameYesUsername of the user whose organizations to list

Implementation Reference

  • MCP tool registration, input schema (zod), and handler function for 'list-user-orgs'. Calls UserManagement.listUserOrganizations and formats the response as text content.
    "list-user-orgs", { username: z.string().describe("Username of the user whose organizations to list"), per_page: z.number().optional().describe("Number of results per page (max 100)"), page: z.number().optional().describe("Page number for pagination") }, async ({ username, per_page, page }) => { try { const orgs = await context.users.listUserOrganizations(context.client, { username, per_page, page }); return { content: [ { type: "text", text: `Organizations for user '${username}':\n\n${JSON.stringify(orgs, null, 2)}` } ] }; } catch (error: any) { console.error('Error listing user organizations:', error); return { content: [ { type: "text", text: `An error occurred while listing user organizations: ${error.message}` } ], isError: true }; } } );
  • Helper function in UserManagement class that performs the actual GitHub API call to retrieve the list of organizations for a given user.
    async listUserOrganizations(client: any, params: ListUserOrgsParams): Promise<Organization[]> { try { const { baseUrl, token } = client; const { username, per_page, page } = params; if (!username) { throw new Error('Username is required'); } const queryParams = new URLSearchParams(); if (per_page) { queryParams.append('per_page', per_page.toString()); } if (page) { queryParams.append('page', page.toString()); } const queryString = queryParams.toString() ? `?${queryParams.toString()}` : ''; const url = `${baseUrl}/users/${username}/orgs${queryString}`; 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 list user organizations: ${error.message}`); } }
  • TypeScript interface defining the input parameters for listing user organizations: username (required), per_page and page (optional). Matches the zod schema in the handler.
    export interface ListUserOrgsParams { /** * Username of the user whose organizations to list */ username: string; /** * Optional number of results per page (max 100) */ per_page?: number; /** * Optional page number for pagination */ page?: 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