Skip to main content
Glama
client.ts2.38 kB
import axios, { AxiosInstance, AxiosRequestConfig } from 'axios'; // include .js for runtime ESM resolution import { config } from '../config/config.js'; export class SimplicateClient { private readonly axiosInstance: AxiosInstance; constructor() { this.axiosInstance = axios.create({ baseURL: config.simplicate.baseUrl, headers: { 'Content-Type': 'application/json', 'Authentication-Key': config.simplicate.apiKey, 'Authentication-Secret': config.simplicate.apiSecret, }, }); } /** * Generic GET request to Simplicate API */ async get<T = any>(endpoint: string, params?: Record<string, any>): Promise<T> { try { const response = await this.axiosInstance.get<T>(endpoint, { params }); return response.data; } catch (error) { this.handleError(error, `GET ${endpoint}`); throw error; } } /** * Generic POST request to Simplicate API */ async post<T = any>(endpoint: string, data?: any): Promise<T> { try { const response = await this.axiosInstance.post<T>(endpoint, data); return response.data; } catch (error) { this.handleError(error, `POST ${endpoint}`); throw error; } } /** * Generic PUT request to Simplicate API */ async put<T = any>(endpoint: string, data?: any): Promise<T> { try { const response = await this.axiosInstance.put<T>(endpoint, data); return response.data; } catch (error) { this.handleError(error, `PUT ${endpoint}`); throw error; } } /** * Generic DELETE request to Simplicate API */ async delete<T = any>(endpoint: string): Promise<T> { try { const response = await this.axiosInstance.delete<T>(endpoint); return response.data; } catch (error) { this.handleError(error, `DELETE ${endpoint}`); throw error; } } /** * Error handler for API requests */ private handleError(error: any, operation: string): void { if (axios.isAxiosError(error)) { const status = error.response?.status; const message = error.response?.data?.message || error.message; console.error(`Simplicate API Error [${operation}]:`, { status, message, data: error.response?.data, }); } else { console.error(`Unexpected error [${operation}]:`, error); } } }

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/daanno/simplicate-mcp'

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