CO

CoinMarketCap API MCP Server for Market Data

Access CoinMarketCap cryptocurrency market data via the MCP server for real-time pricing, market caps, and historical insights.

Quick Install
npx -y @longmans/coin_api_mcp

Overview

This MCP (Model Context Protocol) server wraps the CoinMarketCap REST API and exposes a small, MCP-compatible toolset for retrieving cryptocurrency market data. It translates typical CoinMarketCap operations — current prices, market capitalization, historical OHLC, and listings — into concise MCP tools that LLM agents or other model-driven systems can call directly at runtime.

The server is designed for developers building agentic applications, chatbots, or analytics workflows that need live or recent cryptocurrency data. By providing a predictable manifest and a simple execute endpoint, the MCP server lets language models request market facts and charts without embedding API keys or dealing with low-level HTTP logic.

Features

  • MCP-compatible manifest that lists available market-data tools for LLMs
  • Tool execution endpoint that proxies requests to CoinMarketCap
  • Support for current price, market cap, coin lookup, and historical OHLC data
  • API-key driven configuration via environment variables
  • Docker and local Node.js run options for easy deployment
  • Minimal JSON interface for easy integration with agent frameworks

Installation / Configuration

Requirements:

  • Node.js 16+ (or use Docker)
  • A CoinMarketCap API key (https://coinmarketcap.com/api/)

Clone and install:

git clone https://github.com/longmans/coin_api_mcp.git
cd coin_api_mcp
npm install

Environment configuration (example .env):

COINMARKETCAP_API_KEY=your-coinmarketcap-key
PORT=3000
LOG_LEVEL=info

Start locally:

# start in foreground
npm start

# or run with Node directly
node server.js

Docker:

# build
docker build -t coin-api-mcp .

# run
docker run -e COINMARKETCAP_API_KEY=your-key -p 3000:3000 coin-api-mcp

Server will listen on the configured PORT (default 3000). The MCP manifest is available at /mcp/manifest and tool execution at /mcp/execute.

Available Tools

The server exposes a compact set of tools; each tool appears in the MCP manifest so LLM agents can discover usage and parameters.

Tool nameDescriptionParameters
get_priceCurrent price and 24h change for a symbol or slugsymbol (e.g., BTC), convert (USD, EUR)
get_market_capMarket capitalization and ranking for a coinsymbol or slug
get_listingsTop N coins by market caplimit (default 10), convert
get_ohlcHistorical OHLC candles for a coinsymbol/slug, start (ISO), end (ISO), interval (1m/1h/1d)
find_coinSearch coin metadata by queryquery (name or symbol)

Example manifest excerpt (available at /mcp/manifest):

{
  "tools": [
    {"name": "get_price", "description": "Current price for a coin"},
    {"name": "get_ohlc", "description": "Historical OHLC data"}
  ]
}

Execution endpoint:

  • POST /mcp/execute
  • Body:
{
  "tool": "get_price",
  "params": {"symbol": "BTC", "convert": "USD"}
}
  • Responds with JSON payload containing the requested data or an error object.

Use Cases

  1. LLM-based financial assistant

    • An assistant answering “What is the current price of ETH in USD and 24h change?” can call the get_price tool and render the structured reply to users, keeping the API key on the server.
  2. Trading signal enrichment

    • A signal-processing pipeline can request historical OHLC via get_ohlc to compute indicators (SMA, RSI) without directly handling CoinMarketCap API variants.
  3. Portfolio dashboard

    • A dashboard microservice periodically calls get_listings and get_market_cap to populate leaderboards and market-cap weighted indexes.
  4. Educational chatbot

    • A chatbot that explains cryptocurrency concepts can use find_coin to fetch canonical metadata (symbol, slug, launch date) and present consistent facts.

Concrete example — fetch BTC price with curl:

curl -X POST http://localhost:3000/mcp/execute \
  -H "Content-Type: application/json" \
  -d '{"tool":"get_price","params":{"symbol":"BTC","convert":"USD"}}'

Example response:

{
  "tool": "get_price",
  "result": {
    "symbol": "BTC",
    "price": 61234.12,
    "percent_change_24h": -2.4,
    "last_updated": "2026-04-10T12:00:00Z"
  }
}

Notes and Best Practices

  • Rate limits: CoinMarketCap imposes rate limits on API keys. Cache frequent queries or aggregate requests where possible.
  • Error handling: The execute endpoint returns structured errors (code, message). Agents should handle transient HTTP 5xx and retry with exponential backoff.
  • Security: Never expose your COINMARKETCAP_API_KEY to clients. The MCP server is the only component that should hold the key.
  • Timezones: Historical queries use ISO timestamps (UTC recommended) and the CoinMarketCap conversion parameter for fiat currencies.

For source, examples, and updates, see the project repository: https://github.com/longmans/coin_api_mcp

Tags:finance