# Bitquery — how to use (mcp.ai)

Connect your Bitquery account and use 10 tools for analytics straight from your AI agent. Connect with your own API key. Bitquery provides historical and real-time indexed data for over 40 blockchains through GraphQL APIs, Websockets, SQL, and cloud providers.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_bitquery?ms=1787293680000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `bitquery_archive_database_query`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/bitquery`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/bitquery/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/bitquery/archive/database/query` — Query the Bitquery Archive Database (V1 API) for historical blockchain data. The Archive Database provides complete historical blockchain data across 40+ blockchains including Bitcoin, Ethereum, BSC, 
  - body: { query: string, variables?: object, operationName?: string }
- `POST https://api.mcp.ai/api/bitquery/combined/database/query` — Query Bitquery's Combined Database (v2 API) for blockchain data across 40+ networks. Use this tool to fetch real-time and historical blockchain data including: - Blocks, transactions, and events - Tok
  - body: { query: string, variables?: object, operationName?: string }
- `POST https://api.mcp.ai/api/bitquery/conditional/metrics` — Generate a Bitquery GraphQL metric snippet with conditional logic using the 'if:' attribute. This tool builds metric aggregation snippets (count, sum, avg, min, max) that can be embedded in Bitquery G
  - body: { if: object, alias?: string, field: string, operation: string, select_where?: object, distinct_field?: string }
- `POST https://api.mcp.ai/api/bitquery/database/selection` — Tool to select the database (archive, realtime, combined) to query at the top level of a GraphQL request. Use after determining whether you need live, historical, or combined blockchain data.
  - body: { dataset: string }
- `POST https://api.mcp.ai/api/bitquery/early/access/program/query` — Execute GraphQL queries against the Bitquery Early Access Program (EAP) Streaming API. This tool queries the EAP endpoint (streaming.bitquery.io/eap) for real-time blockchain data. The EAP provides ac
  - body: { query: string, variables?: object }
- `POST https://api.mcp.ai/api/bitquery/network/selection` — Tool to select the blockchain network for GraphQL queries. Use before constructing dataset or metric queries to ensure the correct chain is targeted.
  - body: { network: string }
- `POST https://api.mcp.ai/api/bitquery/options/query` — Tool to fetch GraphQL dataset options via schema introspection. Use when you need to discover root-level query fields and their arguments before building queries. Dataset and token availability varies
- `POST https://api.mcp.ai/api/bitquery/price/asymmetry/metric` — Tool to generate GraphQL PriceAsymmetry filter snippet. Use when you need to filter trades based on price asymmetry metric.
  - body: { ge?: number, gt?: number, le?: number, lt?: number }
- `POST https://api.mcp.ai/api/bitquery/realtime/database/query` — Query the Bitquery Streaming (V2) API for realtime blockchain data. This tool accesses the Bitquery Streaming API at streaming.bitquery.io/graphql which provides real-time blockchain data with minimal
  - body: { query: string, variables?: object, operationName?: string }
- `POST https://api.mcp.ai/api/bitquery/select/by/metric` — Tool to generate a GraphQL metric snippet filtering by its value using selectWhere. Use when you need to include only metrics meeting specific value conditions (e.g., only positive sums).
  - body: { of: string, alias?: string, operation: string, selectWhere: object }

## Example prompts
- "What can I do in Bitquery?"
- "Show me a summary of my Bitquery account"

## More
- Page: https://mcp.ai/bitquery
- Agent spec (llms.txt): https://mcp.ai/bitquery/llms.txt
- Postman collection: https://mcp.ai/bitquery/postman.json
