CoinGecko MCP Server: Crypto Prices and Market Data
Access CoinGecko's MCP server for real-time crypto prices and market data across 200+ blockchains and 8M+ tokens.
npx -y @packages/mcp-serverOverview
The CoinGecko MCP Server exposes CoinGecko’s market data to model-driven agents and developer tools via the Model Context Protocol (MCP). It provides programmatic access to real-time prices, market caps, liquidity and other market data for millions of tokens across 200+ blockchains, making it straightforward for agents to fetch, analyze and act on crypto price information.
This server is designed for two common deployment patterns: run locally or launch as a remote HTTP-backed MCP server. It runs in “Code Mode”, where agents can execute TypeScript code against a sandboxed CoinGecko TypeScript SDK and also query SDK documentation. This combination enables deterministic, repeatable operations (for example: compute portfolio value, fetch historical series, validate price feeds) without giving agents unrestricted network or filesystem access.
Features
- Real-time price and market data for 8M+ tokens across 200+ blockchains
- Code Mode: sandboxed TypeScript SDK execution for deterministic agent actions
- Documentation search tool to help agents discover SDK APIs and examples
- Works locally via npx or integrated with MCP-compatible clients (Cursor, VS Code, Claude, etc.)
- Can be run as a remote HTTP MCP server with header-based API key authorization
- Secure sandbox: no arbitrary web or filesystem access during code execution
Installation / Configuration
Requirements: Node 18+ (for npx invocation) and your CoinGecko API keys (pro/demo) if you need paid endpoints or rate-limited features.
Direct invocation (quick start)
# or "demo" / "production" depending on setup
# Run the MCP server via npx
Example MCP client configuration (local or embedded client)
Run as a remote HTTP MCP server
# launch server with HTTP transport on port 3000
Client-side remote configuration example (server at http://localhost:3000)
Authorization headers (when using remote HTTP transport)
| HTTP Header | Client option key | Purpose / security |
|---|---|---|
| x-cg-pro-api-key | proAPIKey | Pro API key (pro endpoints) |
| x-cg-demo-api-key | demoAPIKey | Demo API key (demo endpoints) |
Integration tips
- Cursor, VS Code and other MCP-compatible clients let you add this server to their UI; supply the same environment variables in the client-specific mcp.json or settings.
- For headless or CI usage, include API keys as environment variables and avoid exposing secrets in public repositories.
Available Tools / Resources
This MCP server implements the Code Mode pattern and exposes two primary tools to agents:
- Documentation Search Tool: query API and SDK docs so agents can discover available functions, parameter shapes and examples.
- Code Execution Tool (TypeScript Sandbox): agents can submit TypeScript code that uses the bundled CoinGecko TypeScript SDK. Code runs in an isolated sandbox (no external HTTP, no filesystem); whatever the code prints or returns becomes the tool response.
Sandbox constraints:
- No arbitrary network access
- No filesystem read/write
- Deterministic execution environment (useful for model-driven reasoning)
GitHub repository
- https://github.com/coingecko/coingecko-typescript/tree/main/packages/mcp-server
Example TypeScript snippet (agent sandbox)
This is an illustrative example of the sort of TypeScript code an agent would execute inside the sandbox to fetch a token price. Exact SDK method names may vary in the SDK version bundled with the server.
// Example executed inside the sandbox provided by the MCP server
;