loading…
Search for a command to run...
loading…
A comprehensive cryptocurrency market-data MCP server with 49 tools across six data sources, enabling LLMs to answer market questions via natural language.
A comprehensive cryptocurrency market-data MCP server with 49 tools across six data sources, enabling LLMs to answer market questions via natural language.
English · 中文
A comprehensive cryptocurrency market-data MCP server. Six data sources, 49 tools, 8 prompt templates, 3 resources — wired together so an LLM can answer almost any "what's the market doing?" question with a single call.
Most crypto MCP servers are thin wrappers around a single API and hit a wall the moment a user asks anything that requires combining sources. coin-mcp is built around a different premise: a strong AI assistant needs complementary data sources behind one consistent contract.
| Source | Strength | What it covers here |
|---|---|---|
| CoinGecko | Aggregated, volume-weighted | Price, market cap, history, NFTs, categories, treasuries, trending, search |
| CCXT | Real-time, per-exchange | Tickers, order books, recent trades, OHLCV, funding rates across 100+ exchanges |
| DefiLlama | DeFi-native, free | Protocol/chain TVL, stablecoins, yield pools, DEX volume, fees & revenue |
| DexScreener | DEX-side, long-tail tokens | Pairs, liquidity, prices for tokens too small/new for CoinGecko |
| Alternative.me | Sentiment | Crypto Fear & Greed Index |
| Local TA | Offline compute | RSI, MACD, Bollinger, EMA/SMA, ATR, ADX, Stochastic, OBV |
Plus a tiered HTTP cache that keeps you safely under CoinGecko's free-tier rate limit, and a multi-transport runtime (stdio / SSE / streamable-HTTP).
A non-exhaustive sample of questions a connected LLM can resolve in 1–3 tool calls:
get_pricecompare_pricesget_market_chart + compute_indicatorsget_consolidated_orderbookcompare_funding_rateslist_protocols(chain="Solana")list_yield_poolsget_fear_greed_indexhealth_checkget_companies_holdingspython3 --version to check)pip + a virtualenvuv install (one line, all platforms):
curl -LsSf https://astral.sh/uv/install.sh | sh # macOS / Linux
# powershell -c "irm https://astral.sh/uv/install.ps1 | iex" # Windows PowerShell
git clone https://github.com/ymylive/coin-mcp.git
cd coin-mcp
uv sync # creates .venv, installs from uv.lock
uv run coin-mcp # starts the server on stdio
uv sync reads pyproject.toml + uv.lock and installs everything (mcp, httpx, ccxt) into a project-local .venv/. No system pollution.
git clone https://github.com/ymylive/coin-mcp.git
cd coin-mcp
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e . # editable install, deps resolved fresh
coin-mcp # starts the server on stdio
uv tool install git+https://github.com/ymylive/coin-mcp.git
coin-mcp # available on PATH
This puts the coin-mcp console script on your PATH globally without cluttering any project directory. Best for "I just want to point Claude Desktop at it."
If you want to run the test suite or hack on the code:
uv sync --extra dev # adds pytest + pytest-asyncio
uv run pytest # 29 tests, all should pass
A 5-second sanity check that all tools registered correctly:
uv run python -c "
import asyncio, server
async def main():
tools = await server.mcp.list_tools()
prompts = await server.mcp.list_prompts()
resources = await server.mcp.list_resources()
print(f'{len(tools)} tools / {len(prompts)} prompts / {len(resources)} resources')
asyncio.run(main())
"
# Expected: 49 tools / 8 prompts / 3 resources
CLI help is also one command away:
uv run coin-mcp --help
| Symptom | Likely cause / fix |
|---|---|
python3: command not found |
Python 3.10+ not installed. Install via python.org or uv python install 3.12. |
ModuleNotFoundError: mcp |
You're not running inside the project venv. Use uv run … or activate .venv/bin/activate. |
Service unavailable from a restricted location (Binance) |
Geographic block — not a bug. Use OKX, Kraken, Bybit, etc. instead via the exchange_id param. |
HTTP 429 from CoinGecko |
Rate-limited. The cache layer mitigates this; consider setting COINGECKO_API_KEY for higher limits. |
uv: command not found |
Install uv first (see Prerequisites) or use the pip path (Option 2). |
┌──────────────────────────────┐
│ LLM / MCP client │
│ Claude · Cursor · custom │
└──────────────┬───────────────┘
│ JSON-RPC over stdio / SSE / HTTP
┌──────────────▼───────────────┐
│ FastMCP server │
│ 49 tools · 8 prompts · 3 │
│ resources · multi-transport│
└──────────────┬───────────────┘
│
┌──────────────────────┼──────────────────────┐
│ │ │
┌────────▼─────────┐ ┌────────▼────────┐ ┌────────▼────────┐
│ HTTP layer │ │ CCXT runtime │ │ Local compute │
│ httpx + tiered │ │ Bounded LRU │ │ Indicators │
│ TTL LRU cache │ │ + per-id RLock │ │ (no I/O) │
│ + auth-aware key │ │ + pre-warm │ │ │
└────────┬─────────┘ └────────┬────────┘ └─────────────────┘
│ │
┌────────────┼──────────────┐ │
▼ ▼ ▼ ▼
CoinGecko DefiLlama DexScreener 100+ exchanges
(Binance, OKX, Coinbase,
Kraken, Bybit, …)
Key design choices:
{"error": "..."} envelope contract. Every HTTP-backed tool returns either upstream JSON or an error envelope. The cache never caches errors. The LLM never raises.load_markets(). Concurrent CCXT calls don't race the lazy markets table.| Tool | What it does |
|---|---|
get_price |
Current spot price for one or more coins, multi-currency |
get_coin_details |
Full coin metadata: description, links, scores, market data, dev/community stats |
get_market_chart |
Historical price / market cap / volume time series |
get_aggregated_ohlc |
Aggregated OHLC candlesticks across all venues |
get_coin_tickers |
Exchange tickers for a coin, sorted by trust score / volume |
search |
Universal search across coins, exchanges, categories, NFTs |
list_top_coins |
Top coins with full market data, sortable + paginated |
get_trending |
Trending coins / NFTs / categories (last-24h searches) |
get_top_gainers_losers |
Biggest 24h movers (Pro endpoint; falls back to list_top_coins) |
get_global_market |
Total market cap, BTC/ETH dominance, # of active assets |
get_global_defi |
Global DeFi market cap and DeFi-to-ETH ratio |
list_categories |
All coin categories with aggregated market data |
list_exchanges_directory |
Centralized exchanges directory ranked by trust score |
get_exchange_info |
Single-exchange detail: description, links, tickers |
list_derivatives_exchanges |
Derivatives venues by open interest / volume |
list_nfts |
NFT collections sortable by floor / cap / volume |
get_nft_collection |
Single NFT collection detail |
get_companies_holdings |
Public companies holding BTC or ETH |
| Tool | What it does |
|---|---|
list_supported_exchanges |
All 111 CCXT-supported exchange IDs |
get_exchange_markets |
All markets/symbols on a specific exchange |
get_exchange_ticker |
Real-time bid/ask/last/24h on one exchange |
get_orderbook |
Level-2 order book snapshot |
get_recent_trades |
Recent public trades (the tape) |
get_exchange_ohlcv |
OHLCV candles, 1m granularity, per-exchange volume |
get_funding_rate |
Current perpetual-futures funding rate |
| Tool | What it does |
|---|---|
get_funding_rate_history |
Time-series funding rates for a perp |
get_open_interest |
Current open interest with fetch_open_interest_history fallback |
compare_funding_rates |
Cross-exchange funding-rate snapshot with max/min/spread |
| Tool | What it does |
|---|---|
list_protocols |
All DeFi protocols ranked by TVL, sortable, chain-filterable |
get_protocol_tvl |
Single protocol detail with trimmed TVL history |
list_chains_tvl |
TVL per chain |
get_chain_tvl_history |
Historical TVL for a chain (or total DeFi) |
list_stablecoins |
Top stablecoins by mcap with chain breakdown |
list_yield_pools |
Yield pools filtered by TVL / project / chain / symbol |
list_dex_volumes |
DEX 24h volume rankings |
list_fees_revenue |
Protocols ranked by fees or revenue |
get_token_dex_price |
DefiLlama oracle price for chain:address tokens |
| Tool | What it does |
|---|---|
dex_search |
Search pairs across all chains by token name/symbol/address |
get_dex_token_pairs |
All pairs for a token contract address |
get_dex_pair |
Single pair detail by chain + pair address |
list_latest_dex_tokens |
Newly profiled DexScreener tokens |
list_top_boosted_tokens |
Currently top-boosted (paid promotion) tokens |
| Tool | What it does |
|---|---|
health_check |
Parallel-ping every data source with latency |
compare_prices |
Same coin's price across CG + multiple CEX + DEX with spread |
get_consolidated_orderbook |
Merged L2 across many exchanges, attributed per-level |
| Tool | What it does |
|---|---|
get_fear_greed_index |
Crypto Fear & Greed Index (0 = extreme fear, 100 = extreme greed) |
| Tool | What it does |
|---|---|
compute_indicators |
RSI, MACD, Bollinger, EMA, SMA, ATR, ADX, Stochastic, OBV — pure-Python on supplied OHLCV |
| Tool | What it does |
|---|---|
cache_stats |
Cache entries, hits, misses, hit rate, per-pattern breakdown |
clear_cache |
Drop the in-process HTTP cache |
Prompts are parameterized workflows the user can pick from a UI; they expand into ready-made multi-step instructions the LLM executes using tools.
| Prompt | What it does |
|---|---|
analyze_coin |
Full coin briefing: identity, price, charts, where it trades |
compare_coins |
Side-by-side comparison across N coins |
technical_analysis |
Fetch OHLCV + run full indicator bundle, summarize trend/momentum/volatility |
scan_funding_arbitrage |
Funding rates across N exchanges, surface spread |
market_overview |
Macro briefing: cap, dominance, sentiment, trending, top movers |
defi_health_check |
TVL by chain + per-protocol view + stablecoin landscape |
find_token_dex |
Search → fall back to DexScreener for new/long-tail tokens |
yield_hunter |
Filter yield pools by TVL / chain / asset, sort by 30-day avg APY |
Static reference data the client can attach to the LLM's context:
coin-mcp://exchanges/ccxt — JSON list of all CCXT-supported exchange IDscoin-mcp://coins/popular-ids — markdown table mapping common ticker symbols to CoinGecko IDscoin-mcp://chains/dex-supported — markdown list of chain IDs DexScreener acceptsAll env vars are optional.
| Variable | Default | Effect |
|---|---|---|
COINGECKO_API_KEY |
(unset) | When set, the server uses the Pro endpoint and authenticates requests. Pro keys (prefixed CG-) send x-cg-pro-api-key; otherwise Demo (x-cg-demo-api-key). |
A .env.example is provided. Copy to .env and edit if you have a key.
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"coin-mcp": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/coin-mcp",
"run",
"coin-mcp"
],
"env": {
"COINGECKO_API_KEY": "your-optional-key"
}
}
}
}
Restart Claude Desktop. The 49 tools, 8 prompts and 3 resources will appear.
Cursor's MCP support uses the same JSON shape. Place the snippet in your Cursor settings under mcp.servers. For remote use, run the server with --transport sse or --transport streamable-http and point Cursor at the URL.
Any MCP-compatible client works. The server speaks the standard MCP JSON-RPC over your transport of choice.
# stdio (default, for local IDE / Claude Desktop integration)
coin-mcp
# Server-Sent Events
coin-mcp --transport sse --host 127.0.0.1 --port 8000
# Streamable HTTP (for hosted / remote use)
coin-mcp --transport streamable-http --host 127.0.0.1 --port 8000
# Public bind (with no auth) — REQUIRES explicit flag and prints a stderr WARNING
coin-mcp --transport streamable-http --host 0.0.0.0 --port 8000 --allow-public
There is no built-in authentication. If you bind to a non-loopback host, put a reverse proxy with auth in front (Caddy, nginx, Traefik, Cloudflare Access, etc.) or restrict via firewall. The --allow-public flag is a deliberate footgun guard.
A tiered TTL cache sits transparently behind every HTTP call so the LLM can fan out without burning your CoinGecko quota.
| Endpoint pattern | TTL |
|---|---|
/simple/price |
10 s |
/coins/markets |
60 s |
/market_chart, /ohlc |
60 s |
/tickers |
30 s |
/search/trending |
60 s |
/search |
5 min |
/global |
60 s |
/coins/{id} (details) |
2 min |
/coins/categories |
5 min |
/exchanges/{id} |
10 min |
/exchanges (list) |
30 min |
/derivatives/exchanges |
10 min |
/nfts/{id} |
5 min |
/nfts/list |
30 min |
/companies/public_treasury |
30 min |
api.alternative.me |
10 min |
| default | 30 s |
LRU-bounded at 2,000 entries. Cache key includes the URL, sorted query params, and a sha-256 digest of any auth header values — so two clients with different keys never share a cache entry. Errors are never cached. Hits return a deep copy so callers can mutate without poisoning. Inspect at runtime via the cache_stats MCP tool.
coin-mcp is data-only — there is no transaction signing, no private-key handling, no on-chain writes. The threat surface is therefore narrow but worth being honest about:
{"error": "invalid <kind>"} without making the HTTP call.compute_indicators row cap at 5,000 (MAX_OHLCV_ROWS) prevents memory blowups from prompt-injected upstream data.--allow-public and emit a stderr WARNING when the flag is given.If you find a security issue, please open an issue rather than a PR for non-trivial cases.
coin-mcp/
├── server.py # Entrypoint — wires modules together
├── pyproject.toml
├── README.md
├── .env.example
├── .gitignore
├── coin_mcp/
│ ├── core.py # FastMCP instance, helpers, instructions block
│ ├── coingecko.py # 18 CoinGecko tools
│ ├── ccxt_tools.py # 7 CCXT tools
│ ├── derivatives.py # 3 funding/OI tools
│ ├── defillama.py # 9 DefiLlama tools
│ ├── dexscreener.py # 5 DexScreener tools
│ ├── aggregate.py # 3 cross-source tools
│ ├── sentiment.py # 1 Fear & Greed tool
│ ├── indicators.py # 1 local-compute tool
│ ├── cache.py # 2 cache-introspection tools + the cache itself
│ ├── prompts.py # 8 workflow templates
│ ├── resources.py # 3 static-reference resources
│ └── transport.py # CLI for stdio / SSE / streamable-HTTP
└── tests/
├── conftest.py # Autouse cache-clear + mcp_server fixture
├── test_registry.py # Tool count / instructions / prompt-ref sanity
├── test_cache_routing.py # TTL routing table + no-shadowing
├── test_indicators.py # Wilder RSI textbook vector, 5-col fallback, DoS cap
├── test_http_envelope.py # is_error truthy semantics + error not cached
└── test_validators.py # Path-injection rejection (CG/DexScreener)
uv sync --extra dev
uv run pytest
# 29 passed
The high-ROI tests cover:
instructions table (LLM discoverability)/coins/markets vs /coins/{id} vs /market_chart)compute_indicators rejects > 5,000 rowsis_error truthy semanticsTracked but not yet built:
If you have a specific data source you want integrated, open an issue with the API spec.
MIT — see LICENSE for the full text.
This project stands on shoulders.
And all the prior MCP-server projects whose design choices we studied: doggybee/mcp-server-ccxt for the tiered cache pattern, QuantGeekDev/coincap-mcp for showing prompts matter, heurist-network/heurist-mesh-mcp-server for multi-transport precedent, the official CoinGecko MCP for dynamic tool discovery as an idea worth pursuing later.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"coin-mcp": {
"command": "npx",
"args": []
}
}
}