DeFi MCP

MCP server for DeFi data — real-time crypto prices, token analytics, wallet balances, and on-chain data across multiple chains.

defi-mcp

MCP server for DeFi & crypto — 12 tools for token prices, wallet balances, gas fees, and DEX quotes.

License: MIT Node.js MCP

Give any MCP-compatible AI (Claude, Cursor, Windsurf, Claude Code) direct access to live on-chain data. No API key required.

Tutorial: How to set up with Claude & Cursor · REST API docs


Try it now (no setup)

The server is also hosted as a free REST API. Try these right now:

# Bitcoin & Ethereum prices
curl "http://defi-mcp.your-server.example.com/api/prices?ids=bitcoin,ethereum"

# Ethereum gas prices (EIP-1559)
curl "http://defi-mcp.your-server.example.com/api/gas"

# Wallet balance across 6 EVM chains
curl "http://defi-mcp.your-server.example.com/api/balance/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045/multi"

# Top 10 tokens by market cap
curl "http://defi-mcp.your-server.example.com/api/top?limit=10"

# Solana DEX quote: 1 SOL → USDC via Jupiter
curl "http://defi-mcp.your-server.example.com/api/quote/solana?input_mint=So11111111111111111111111111111111111111112&output_mint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount=1000000000"

100 free requests/day, no API key needed.


Tools

ToolDescriptionData Source
get_token_pricePrice, 24h change %, market cap for 1+ tokensCoinGecko
search_tokensSearch by name/symbol → CoinGecko IDsCoinGecko
get_token_infoFull metadata: contract addresses, ATH, supply, linksCoinGecko
get_top_tokensTop N tokens by market capCoinGecko
get_eth_balanceNative ETH balance for any walletPublic RPC
get_token_balanceERC-20 balance for wallet + contract pairEtherscan / RPC
get_wallet_holdingsAll tokens a wallet has interacted withEtherscan
get_multichain_balanceNative balance across 6 EVM chains at oncePublic RPCs
get_eth_gasBase fee + EIP-1559 priority fee suggestionsPublic RPC
get_multichain_gasGas prices on 6 chains simultaneouslyPublic RPCs
get_dex_quote_ethBest swap quote via 1inch (any EVM chain)1inch API
get_dex_quote_solBest swap quote via Jupiter (Solana)Jupiter API

Supported chains: Ethereum, BSC, Polygon, Arbitrum, Optimism, Base + Solana (DEX)


Setup: Claude Desktop

git clone https://github.com/OzorOwn/defi-mcp
cd defi-mcp
npm install

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "defi-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/defi-mcp/src/index.js"]
    }
  }
}

Restart Claude Desktop. You'll see the hammer icon indicating MCP tools are available.

Setup: Cursor

Add to your project's .cursor/mcp.json:

{
  "mcpServers": {
    "defi-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/defi-mcp/src/index.js"]
    }
  }
}

Or: Cursor Settings → Features → MCP Servers → Add new → stdio → node /path/to/defi-mcp/src/index.js

Setup: Claude Code

Add to .mcp.json in your project root:

{
  "mcpServers": {
    "defi-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/defi-mcp/src/index.js"]
    }
  }
}

Works with any MCP host — Windsurf, Continue.dev, Cline, or any stdio-based MCP client.


Example Prompts

Once connected, ask your AI naturally:

"What's the current price of ETH and BTC?"
→ calls get_token_price(["ethereum", "bitcoin"])

"How much ETH does vitalik.eth hold?"
→ calls get_eth_balance("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045")

"Compare gas prices across all supported chains"
→ calls get_multichain_gas()

"How much USDC would I get for 1 SOL on Jupiter?"
→ calls get_dex_quote_sol("So11...", "EPjF...", 1000000000)

"Show me the top 20 tokens by market cap"
→ calls get_top_tokens(20)

"What tokens has this wallet interacted with? 0xABC..."
→ calls get_wallet_holdings("0xABC...")

REST API

All 12 tools are also available as a REST API at http://defi-mcp.your-server.example.com.

EndpointTool
GET /api/prices?ids=bitcoin,ethereum&vs=usdget_token_price
GET /api/search/:querysearch_tokens
GET /api/token/:idget_token_info
GET /api/top?limit=20get_top_tokens
GET /api/balance/:addressget_eth_balance
GET /api/balance/:address/token/:tokenget_token_balance
GET /api/holdings/:addressget_wallet_holdings
GET /api/balance/:address/multiget_multichain_balance
GET /api/gasget_eth_gas
GET /api/gas/allget_multichain_gas
GET /api/quote/evm?chain_id=1&from=...&to=...&amount=...get_dex_quote_eth
GET /api/quote/solana?input_mint=...&output_mint=...&amount=...get_dex_quote_sol
POST /api/callUniversal tool invocation: {"tool": "...", "args": {...}}

Free tier: 100 requests/day per IP, no key required.

API key (higher limits): POST /api/keys/create → get a key with 200 free credits. See the Getting Started guide.


Environment Variables

VariableRequiredDescription
COINGECKO_API_KEYNoPro key for higher rate limits
ETHERSCAN_API_KEYNoNeeded for get_wallet_holdings; balance falls back to RPC
ONEINCH_API_KEYNoRequired for get_dex_quote_eth (free at portal.1inch.dev)
ETH_RPC_URLNoOverride default public Ethereum RPC
BSC_RPC_URLNoOverride default public BSC RPC

All tools work without API keys using public endpoints (rate limits apply).


Architecture

src/
├── index.js          — MCP stdio server (12 tools via @modelcontextprotocol/sdk)
├── http.js           — Fastify REST API (same tools, production server)
├── tools/
│   ├── prices.js     — CoinGecko: prices, search, metadata, rankings
│   ├── gas.js        — EVM RPC: gas prices, multi-chain
│   ├── wallets.js    — EVM RPC + Etherscan: balances, holdings
│   └── dex.js        — 1inch (EVM) + Jupiter (Solana): swap quotes
└── utils/
    └── http.js       — fetch wrapper with retry + exponential backoff

Part of Agent Gateway

This MCP server is one of 39 services available through Agent Gateway — a unified API for AI agent infrastructure including wallet management, code execution, memory storage, scheduling, image processing, and more.


License

MIT

Related Servers

NotebookLM Web Importer

Import web pages and YouTube videos to NotebookLM with one click. Trusted by 200,000+ users.

Install Chrome Extension