Skip to main content
Glama
heyzgj

CoinMarketCap Universal MCP Server

by heyzgj
exchange.ts1.72 kB
import { API_ENDPOINTS, CACHE_TTL, DEFAULT_PARAMS } from '../config/constants'; import { ExchangeListingsParams, ExchangeListingsResponse } from '../types/api'; import { BaseApiService } from './base'; /** * Service for accessing exchange data from CoinMarketCap */ export class ExchangeService extends BaseApiService { /** * Gets the latest exchange listings * @param params Query parameters * @returns Exchange listings */ async getListings(params: ExchangeListingsParams = {}): Promise<ExchangeListingsResponse> { const actualParams = { limit: params.limit || DEFAULT_PARAMS.LIMIT, ...params }; return this.get<ExchangeListingsResponse>( API_ENDPOINTS.EXCHANGE_LISTINGS, actualParams, CACHE_TTL.MEDIUM ); } /** * Gets detailed metadata for specified exchanges * @param id Comma-separated exchange IDs (e.g. "1,2") * @param slug Comma-separated exchange slugs (e.g. "binance,coinbase") * @returns Exchange metadata */ async getInfo(id?: string, slug?: string) { if (!id && !slug) { throw new Error('Either id or slug parameter is required'); } const params: Record<string, any> = {}; if (id) params.id = id; if (slug) params.slug = slug; return this.get( API_ENDPOINTS.EXCHANGE_INFO, params, CACHE_TTL.LONG ); } /** * Gets a map of all exchanges * @param limit Number of exchanges to return * @param start Starting point for pagination * @returns Exchange map */ async getMap(limit = DEFAULT_PARAMS.LIMIT, start = 1) { return this.get( API_ENDPOINTS.EXCHANGE_MAP, { limit, start }, CACHE_TTL.VERY_LONG ); } }

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/heyzgj/mcp-feargreedindex'

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