Skip to main content
Glama
api.ts1.85 kB
import axios from 'axios'; export default class GitHubClient { public token: string; public baseUrl: string; public timeout: number; constructor(token: string) { this.token = token; this.baseUrl = 'https://api.github.com'; this.timeout = 600000; // 10 minutes timeout } private getHeaders(token: string) { return { Authorization: `token ${token}`, Accept: 'application/vnd.github.v3+json', }; } protected async get<T>(endpoint: string, params: Record<string, any> = {}, token: string): Promise<T> { const response = await axios.get(`${this.baseUrl}/${endpoint}`, { headers: this.getHeaders(token), params, timeout: this.timeout, }); return response.data; } protected async post<T>(endpoint: string, data: Record<string, any>, token: string): Promise<T> { const response = await axios.post(`${this.baseUrl}/${endpoint}`, data, { headers: this.getHeaders(token), timeout: this.timeout, }); return response.data; } protected async patch<T>(endpoint: string, data: Record<string, any>, token: string): Promise<T> { const response = await axios.patch(`${this.baseUrl}/${endpoint}`, data, { headers: this.getHeaders(token), timeout: this.timeout, }); return response.data; } protected async put<T>(endpoint: string, data: Record<string, any>, token: string): Promise<T> { const response = await axios.put(`${this.baseUrl}/${endpoint}`, data, { headers: this.getHeaders(token), timeout: this.timeout, }); return response.data; } async getUserInfo(token: string) { return this.get('user', {}, token); } }

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/JesusMaster/github-see-mcp-server'

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