BaseQL MCP Server
Enables agents to query Base blockchain data using natural language by providing contract addresses, SQL templates, and direct access to Coinbase's SQL API for realtime on-chain analytics including DeFi, NFTs, and wallet activity.
README
🟦 BaseQL MCP Server 🟦

all Base chain data at your agent's fingertips 🔥
about
the SQL API from Coinbase Developer Platform (CDP) indexes all Base chain data across blocks, events, tranfers, transactions, and encoded logs, and lets you (or your agent) submit SQL queries against that rich dataset
this is incredibly powerful because you don't need blockchain data infrastructure like indexers anymore; you simply call SQL API and get hyper-fresh data (<500ms to tip of chain) at blazing-fast latencies (<200ms)
BUT agents need some help to use this powerful tool
the BaseQL MCP Server gives an agent all the info and tools it needs to call SQL API independently, enabling the user to fetch relevant Base chain data using natural language 🎉
what does BaseQL MCP Server include?
agents using BaseQL get:
- common Base contract addresses (USDC, WETH, AERO, other common ERC20s, popular NFTs, etc.)
- accurate SQL API schema context (correct column names, common mistakes)
- pre-built query templates (whale tracking, NFT analytics, gas analysis)
- ENS/Basename resolution (forward and reverse lookup)
- direct SQL execution via CDP SQL API
- built-in best practices (time filtering, performance optimization)
how agents use this
here's an example of what this unlocks for agents:
user: "whow me USDC whale transfers in the last hour"
↓
agent set up with BaseQL MCP:
1. get_contract("USDC") → 0x833589fcd...
2. get_query_template("whale_transfers") → SQL template
3. fills in parameters
4. run_sql_query(sql) → calls CDP SQL API, which returns Base data to the agent
5. agent formats the data into natural language, and responds to the user
quickstart
installation
npm install -g baseql-mcp
use with Claude Desktop
edit your Claude Desktop config:
Mac: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"baseql": {
"command": "npx",
"args": ["baseql-mcp"],
"env": {
"CDP_API_KEY_ID": "your-key-id",
"CDP_API_KEY_SECRET": "your-secret",
"CDP_WALLET_SECRET": "your-wallet-secret"
}
}
}
}
restart Claude Desktop and ask: "what's the USDC contract address on Base?"
use with ChatGPT
note: with ChatGPT you need to input your MCP Server's URL, so you'll need to deploy it first (e.g. to Vercel)
-
enable developer mode in ChatGPT:
- open ChatGPT settings → apps & connectors → advanced settings
- enable developer mode (you should also have this enabled in your soul)
-
add MCP server:
- now go back to apps & connectors
- click create top-right
- fill in the MCP server details:
- name: BaseQL
- URL: your deployed URL e.g.
https://your-baseql-mcp.vercel.app - description: Base data powerrrrr
- click save
-
test:
- start new chat in ChatGPT
- ask something like: "how many USDC transfers happened on Base in the last hour?"
- chatGPT uses your BaseQL MCP to fetch the data & respond
local development
# clone this repo
git clone https://github.com/jnix2007/baseql-mcp
cd baseql-mcp
# install dependencies
npm install
# configure
cp .env.example .env
# edit .env with your CDP credentials you get from portal.cdp.coinbase.com
# run it
npm run dev
test via HTTP:
# list available tools
curl http://localhost:4000/tools
# query USDC transfers
curl -X POST http://localhost:4000/call \
-H "Content-Type: application/json" \
-d '{"tool":"run_sql_query","params":{"sql":"SELECT COUNT(*) as count FROM base.transfers WHERE token_address = '\''0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'\'' AND block_timestamp > NOW() - INTERVAL 1 HOUR"}}'
tools included
1. get_schema
get complete Base SQL table schemas with correct column names and best practices
example:
{
"tool": "get_schema"
}
returns:
- all table schemas (base.transfers, base.transactions, base.events, base.blocks)
- critical rules (always filter by time!)
- common mistakes (column name corrections)
2. get_contract
get Base contract addresses by symbol
example:
{
"tool": "get_contract",
"params": {
"symbol": "USDC",
"network": "mainnet" // or "sepolia"
}
}
supports:
- 46 tokens (USDC, WETH, AERO, DEGEN, TYBG, JESSE, etc.)
- 8 NFT collections (Basenames, Based Fellas, Base Punks, Base Gods, etc.)
- Infrastructure (Bridges, EAS, Coinbase Verifications)
- Base mainnet only
3. get_query_template
get pre-built SQL query templates
example:
{
"tool": "get_query_template",
"params": {
"templateKey": "whale_transfers"
}
}
available templates:
whale_transfers- large token movementstrending_tokens- tokens with sudden activitywallet_activity- complete wallet historygas_analysis- gas spending patternsnft_mints- NFT minting activitycoinbase_verified_users- addresses associated with Coinbase accounts (i.e. that have KYC'd at some point)basename_registrations- new .base.eth names- and a bunch more
4. run_sql_query
execute actual SQL queries against Base blockchain
example:
{
"tool": "run_sql_query",
"params": {
"sql": "SELECT COUNT(*) FROM base.transfers WHERE token_address = '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913' AND block_timestamp > NOW() - INTERVAL 1 HOUR"
}
}
returns: realtime Base data (<500ms from tip of chain)
5. resolve_name
convert ENS/Basename to address
example:
{
"tool": "resolve_name",
"params": {
"name": "jnix.base.eth"
}
}
6. get_name_for_address
reverse ENS lookup (address → name)
7. get_names_for_addresses
batch reverse lookup for multiple addresses
use cases for BaseQL MCP Server
DeFi analytics
"show me top AERO holders"
"what's Uniswap V3 trading volume today?"
"find wallets bridging >$100k"
NFT tracking
"recent Basename registrations"
"who owns the most Based Fellas?"
"find NFT whale collectors"
market intel
"find tokens with sudden activity surge"
"track smart money moves"
"what are whales buying?"
architecture
AI agent 🤖
↓
BaseQL MCP Server 💻
↓
CDP SQL API ⚡ → Base chain 🟦
BaseQL provides:
- context (contracts, schemas, templates)
- execution (runs queries via CDP)
- intelligence (best practices, optimization)
configuration
environment variables
# required for SQL queries
CDP_API_KEY_ID=your-api-key-id
CDP_API_KEY_SECRET=your-api-key-secret
# optional for local dev
PORT=4000
# optional for monetization via x402
CDP_WALLET_SECRET=your-wallet-secret
ENABLE_PAYMENTS=false
QUERY_PRICE=0.001
get CDP API credentials from CDP Portal
modes
stdio mode (for Claude Desktop):
- uncomment stdio transport in server.ts
- uses stdin/stdout
HTTP mode (for testing/custom agents):
- comment out stdio transport
- runs on PORT (default 4000)
why BaseQL MCP Server is dope
accurate schema
learned the hard way that Base SQL tables have inconsistent column names:
base.transfers→token_address,block_timestampbase.events→address,block_timestampbase.transactions→from_address,timestamp(NOT block_timestamp)
BaseQL documents all these gotchas
guardrails
queries without time filters can scan 100GB+ and fail; BaseQL teaches agents to always filter by time first
curated context
repo of common contract addresses
realtime data
CDP SQL API is < 500ms from tip of chain, so BaseQL queries get near-instant Base data
examples
find USDC whales
# 1. get USDC address
get_contract({ symbol: "USDC" })
# 2. get template
get_query_template({ templateKey: "whale_transfers" })
# 3. run query
run_sql_query({
sql: "SELECT from_address, value FROM base.transfers
WHERE token_address = '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'
AND value > 1000000000000
AND block_timestamp > NOW() - INTERVAL 24 HOUR
LIMIT 20"
})
track Basename registrations
run_sql_query({
sql: "SELECT to_address, block_timestamp FROM base.transfers
WHERE token_address = '0x03c4738ee98ae44591e1a4a4f3cab6641d95dd9a'
AND from_address = '0x0000000000000000000000000000000000000000'
AND block_timestamp > NOW() - INTERVAL 7 DAY
LIMIT 50"
})
license
MIT
links
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。