Skip to main content
Glama
ddukbg

GitHub Enterprise MCP Server

list-repositories

Lists repositories from GitHub Enterprise, filtering by owner, type, and sorting options to organize and access project data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesUser or organization name
isOrgNoWhether it's an organization (true: organization, false: user)
typeNoRepository type filterall
sortNoSort criteriafull_name
pageNoPage number
perPageNoItems per page

Implementation Reference

  • Handler function that executes the list-repositories tool: validates owner, calls appropriate RepositoryAPI method based on isOrg, formats repos with formatRepository, returns JSON string or error.
    }, async ({ owner, isOrg, type, sort, page, perPage }) => { try { // owner 매개변수 검증 if (!owner || typeof owner !== 'string' || owner.trim() === '') { return { content: [ { type: "text", text: "오류: 사용자 또는 조직 이름(owner)은 필수 항목입니다." } ], isError: true }; } let repositories; if (isOrg) { repositories = await context.repository.listOrganizationRepositories(owner, type, sort, page, perPage); } else { repositories = await context.repository.listRepositories(owner, type, sort, page, perPage); } // 저장소가 없는 경우 if (!repositories || repositories.length === 0) { return { content: [ { type: "text", text: `${isOrg ? '조직' : '사용자'} '${owner}'의 저장소를 찾을 수 없습니다.` } ] }; } // 저장소 정보 형식화 const formattedRepos = repositories.map(formatRepository); return { content: [ { type: "text", text: `${isOrg ? '조직' : '사용자'} '${owner}'의 저장소 목록 (${repositories.length}개):\n\n${JSON.stringify(formattedRepos, null, 2)}` } ] }; } catch (error) { console.error('저장소 목록 조회 오류:', error); return { content: [ { type: "text", text: `저장소 목록 조회 중 오류가 발생했습니다: ${error.message}` } ], isError: true }; } });
  • Zod schema defining input parameters for the list-repositories tool.
    owner: z.string().describe("사용자 또는 조직 이름"), isOrg: z.boolean().default(false).describe("조직인지 여부 (true: 조직, false: 사용자)"), type: z.enum(['all', 'owner', 'member', 'public', 'private', 'forks', 'sources']).default('all').describe("저장소 유형 필터"), sort: z.enum(['created', 'updated', 'pushed', 'full_name']).default('full_name').describe("정렬 기준"), page: z.number().default(1).describe("페이지 번호"), perPage: z.number().default(30).describe("페이지당 항목 수")
  • Registration of the list-repositories tool on the MCP server using server.tool() with schema and handler.
    server.tool("list-repositories", { owner: z.string().describe("사용자 또는 조직 이름"), isOrg: z.boolean().default(false).describe("조직인지 여부 (true: 조직, false: 사용자)"), type: z.enum(['all', 'owner', 'member', 'public', 'private', 'forks', 'sources']).default('all').describe("저장소 유형 필터"), sort: z.enum(['created', 'updated', 'pushed', 'full_name']).default('full_name').describe("정렬 기준"), page: z.number().default(1).describe("페이지 번호"), perPage: z.number().default(30).describe("페이지당 항목 수") }, async ({ owner, isOrg, type, sort, page, perPage }) => { try { // owner 매개변수 검증 if (!owner || typeof owner !== 'string' || owner.trim() === '') { return { content: [ { type: "text", text: "오류: 사용자 또는 조직 이름(owner)은 필수 항목입니다." } ], isError: true }; } let repositories; if (isOrg) { repositories = await context.repository.listOrganizationRepositories(owner, type, sort, page, perPage); } else { repositories = await context.repository.listRepositories(owner, type, sort, page, perPage); } // 저장소가 없는 경우 if (!repositories || repositories.length === 0) { return { content: [ { type: "text", text: `${isOrg ? '조직' : '사용자'} '${owner}'의 저장소를 찾을 수 없습니다.` } ] }; } // 저장소 정보 형식화 const formattedRepos = repositories.map(formatRepository); return { content: [ { type: "text", text: `${isOrg ? '조직' : '사용자'} '${owner}'의 저장소 목록 (${repositories.length}개):\n\n${JSON.stringify(formattedRepos, null, 2)}` } ] }; } catch (error) { console.error('저장소 목록 조회 오류:', error); return { content: [ { type: "text", text: `저장소 목록 조회 중 오류가 발생했습니다: ${error.message}` } ], isError: true }; } });
  • Helper function to format raw repository data into user-friendly structure used by the tool handler.
    function formatRepository(repo) { return { id: repo.id, name: repo.name, full_name: repo.full_name, private: repo.private, description: repo.description || '설명 없음', html_url: repo.html_url, created_at: repo.created_at, updated_at: repo.updated_at, pushed_at: repo.pushed_at, language: repo.language, default_branch: repo.default_branch, stargazers_count: repo.stargazers_count, forks_count: repo.forks_count, watchers_count: repo.watchers_count, open_issues_count: repo.open_issues_count, license: repo.license ? repo.license.name : null, owner: { login: repo.owner.login, id: repo.owner.id, avatar_url: repo.owner.avatar_url, html_url: repo.owner.html_url, type: repo.owner.type } };
  • RepositoryAPI method for listing user repositories, called when isOrg=false.
    async listRepositories(owner, type = 'all', sort = 'full_name', page = 1, perPage = 30) { return this.client.get(`users/${owner}/repos`, { params: { type, sort, page, per_page: perPage } });
  • RepositoryAPI method for listing organization repositories, called when isOrg=true.
    async listOrganizationRepositories(org, type = 'all', sort = 'full_name', page = 1, perPage = 30) { return this.client.get(`orgs/${org}/repos`, { params: { type, sort, page, per_page: perPage } });

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