Skip to main content
Glama
client.ts1.25 kB
import { graphql } from "@octokit/graphql" import { repositoryQuery } from "./queries" import type { RepositoryData, RepositoryQueryResult } from "./types" import { getRepository, prepareRepositoryData } from "./utils" export const createGithubClient = (token: string) => { const client = graphql.defaults({ headers: { authorization: `token ${token}` }, }) return { async queryRepository(repository: string): Promise<RepositoryData | null> { const repo = getRepository(repository) console.info("[client.ts] [createGithubClient] [queryRepository] repo", repo, repository) try { if (!repo?.owner || !repo?.name) { throw new Error('Invalid repository format. Expected owner/name') } const { repository: result } = await client<{ repository: RepositoryQueryResult }>( repositoryQuery, { owner: repo.owner, name: repo.name, } ) console.info("[client.ts] [createGithubClient] [queryRepository] repository", JSON.stringify(result)) return prepareRepositoryData(result) } catch (error) { console.error(`Failed to fetch repository ${repo?.name}:`, error) return null } }, } }

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/metacode0602/open-mcp'

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