Cryo MCP Server
クライオMCP🧊
Cryoブロックチェーン データ抽出ツール用のモデル完了プロトコル (MCP) サーバー。
Cryo MCP を使用すると、MCP プロトコルを実装する API サーバーを介して Cryo の強力なブロックチェーン データ抽出機能にアクセスできるため、MCP 対応のクライアントからブロックチェーン データを簡単に照会できます。
LLM ユーザー向け: SQL クエリ ワークフロー ガイド
この MCP サーバーを使用してブロックチェーン データに対して SQL クエリを実行する場合は、次のワークフローに従います。
query_datasetを使用してデータをダウンロードします。result = query_dataset( dataset="blocks", # or "transactions", "logs", etc. blocks="15000000:15001000", # or use blocks_from_latest=100 output_format="parquet" # important: use parquet for SQL ) files = result.get("files", []) # Get the returned file pathsget_sql_table_schemaを使用してスキーマを探索します。# Check what columns are available in the file schema = get_sql_table_schema(files[0]) # Now you can see all columns, data types, and sample dataquery_sqlでSQL を実行します。# Option 1: Simple table reference (DuckDB will match the table name to file) sql_result = query_sql( query="SELECT block_number, timestamp, gas_used FROM blocks", files=files # Pass the files from step 1 ) # Option 2: Using read_parquet() with explicit file path sql_result = query_sql( query=f"SELECT block_number, timestamp, gas_used FROM read_parquet('{files[0]}')", files=files # Pass the files from step 1 )
あるいは、 query_blockchain_sqlと組み合わせたアプローチを使用します。
# Option 1: Simple table reference
result = query_blockchain_sql(
sql_query="SELECT * FROM blocks",
dataset="blocks",
blocks_from_latest=100
)
# Option 2: Using read_parquet()
result = query_blockchain_sql(
sql_query="SELECT * FROM read_parquet('/path/to/file.parquet')", # Path doesn't matter
dataset="blocks",
blocks_from_latest=100
)完全な動作例については、 examples/sql_workflow_example.pyを参照してください。
Related MCP server: EVM MCP Server
特徴
完全なCryoデータセットアクセス:APIサーバーを介して任意のCryoデータセットをクエリします
MCP統合:MCPクライアントとシームレスに連携
柔軟なクエリオプション: すべての主要なCryoフィルタリングと出力オプションをサポート
ブロック範囲オプション: 特定のブロック、最新のブロック、または相対範囲を照会します
契約フィルタリング: 契約アドレスでデータをフィルタリング
最新ブロックアクセス:最新のイーサリアムブロックデータに簡単にアクセスできます
複数の出力形式: JSON、CSV、Parquet をサポート
スキーマ情報: 詳細なデータセットスキーマとサンプルデータを取得します
SQLクエリ:ダウンロードしたブロックチェーンデータに対して直接SQLクエリを実行します。
インストール(オプション)
uvxを使用してツールを直接実行する場合、これは必要ありません。
# install with UV (recommended)
uv tool install cryo-mcp要件
Python 3.8以上
紫外線
Cryoの稼働中の設備
Ethereum RPCエンドポイントへのアクセス
DuckDB(SQLクエリ機能用)
クイックスタート
クロードコードでの使用
対話型プロンプトを表示するには
claude mcp add実行します。実行するコマンドとして
uvxと入力します。引数として
cryo-mcp --rpc-url <ETH_RPC_URL> [--data-dir <DATA_DIR>]を入力します。あるいは、代わりに
ETH_RPC_URLとCRYO_DATA_DIR環境変数として指定します。
claudeの新しいインスタンスは、RPC エンドポイントにアクセスし、指定されたディレクトリにデータを保存するように構成されたとおりに cryo にアクセスできるようになっています。
利用可能なツール
Cryo MCP は次の MCP ツールを公開します。
list_datasets()
利用可能なすべての Cryo データセットのリストを返します。
例:
client.list_datasets()query_dataset()
さまざまなフィルタリング オプションを使用して Cryo データセットをクエリします。
パラメータ:
dataset(str): クエリするデータセットの名前 (例: 'blocks'、'transactions'、'logs')blocks(文字列、オプション): ブロック範囲の指定(例:'1000:1010')start_block(int, オプション): 開始ブロック番号(blocks の代替)end_block(int, オプション): 終了ブロック番号 (blocks の代替)use_latest(bool, オプション): Trueの場合、最新のブロックを照会しますblocks_from_latest(int, オプション): 最新から含めるブロックの数contract(文字列、オプション): フィルタリングする契約アドレスoutput_format(str, オプション): 出力形式 ('json', 'csv', 'parquet')include_columns(リスト、オプション): デフォルトと一緒に含める列exclude_columns(リスト、オプション): デフォルトから除外する列
例:
# Get transactions from blocks 15M to 15.01M
client.query_dataset('transactions', blocks='15M:15.01M')
# Get logs for a specific contract from the latest 100 blocks
client.query_dataset('logs', blocks_from_latest=100, contract='0x1234...')
# Get just the latest block
client.query_dataset('blocks', use_latest=True)lookup_dataset()
スキーマやサンプル データなど、特定のデータセットに関する詳細情報を取得します。
パラメータ:
name(str): 検索するデータセットの名前sample_start_block(int, オプション): サンプルデータの開始ブロックsample_end_block(int, オプション): サンプルデータの終了ブロックuse_latest_sample(bool, オプション): サンプルに最新のブロックを使用するsample_blocks_from_latest(int, オプション): サンプルの最新からのブロック数
例:
client.lookup_dataset('logs')get_latest_ethereum_block()
最新の Ethereum ブロックに関する情報を返します。
例:
client.get_latest_ethereum_block()SQLクエリツール
Cryo MCP には、ブロックチェーン データに対して SQL クエリを実行するためのツールがいくつか含まれています。
query_sql()
ダウンロードしたブロックチェーン データに対して SQL クエリを実行します。
パラメータ:
query(str): 実行するSQLクエリfiles(リスト, オプション): クエリ対象の parquet ファイルパスのリスト。指定しない場合は、データディレクトリ内のすべてのファイルが使用されます。include_schema(bool, オプション): 結果にスキーマ情報を含めるかどうか
例:
# Run against all available files
client.query_sql("SELECT * FROM read_parquet('/path/to/blocks.parquet') LIMIT 10")
# Run against specific files
client.query_sql(
"SELECT * FROM read_parquet('/path/to/blocks.parquet') LIMIT 10",
files=['/path/to/blocks.parquet']
)query_blockchain_sql()
SQL を使用してブロックチェーン データをクエリし、必要なデータを自動的にダウンロードします。
パラメータ:
sql_query(str): 実行するSQLクエリdataset(文字列、オプション): クエリするデータセット(例:'blocks'、'transactions')blocks(文字列、オプション): ブロック範囲の指定start_block(int, オプション): 開始ブロック番号end_block(int, オプション): 終了ブロック番号use_latest(bool, オプション): Trueの場合、最新のブロックを照会しますblocks_from_latest(int, オプション): 含める最新のブロックの前のブロック数contract(文字列、オプション): フィルタリングする契約アドレスforce_refresh(bool, オプション): 新しいデータが存在する場合でも強制的にダウンロードするinclude_schema(bool, オプション): 結果にスキーマ情報を含める
例:
# Automatically downloads blocks data if needed, then runs the SQL query
client.query_blockchain_sql(
sql_query="SELECT block_number, gas_used, timestamp FROM blocks ORDER BY gas_used DESC LIMIT 10",
dataset="blocks",
blocks_from_latest=100
)list_available_sql_tables()
SQL でクエリできる利用可能なすべてのテーブルを一覧表示します。
例:
client.list_available_sql_tables()get_sql_table_schema()
特定の parquet ファイルのスキーマを取得します。
パラメータ:
file_path(str): parquetファイルへのパス
例:
client.get_sql_table_schema("/path/to/blocks.parquet")get_sql_examples()
さまざまなブロックチェーン データセットの SQL クエリの例を取得します。
例:
client.get_sql_examples()設定オプション
Cryo MCP サーバーを起動するときに、次のコマンドライン オプションを使用できます。
--rpc-url URL: Ethereum RPC URL (ETH_RPC_URL 環境変数を上書きします)--data-dir PATH: ダウンロードしたデータを保存するディレクトリ (CRYO_DATA_DIR 環境変数を上書きします。デフォルトは ~/.cryo-mcp/data/ です)
環境変数
ETH_RPC_URL: コマンドラインで指定されていない場合に使用するデフォルトの Ethereum RPC URLCRYO_DATA_DIR: コマンドラインで指定されていない場合にダウンロードしたデータを保存するデフォルトのディレクトリ
高度な使用法
ブロックチェーンデータに対するSQLクエリ
Cryo MCP を使用すると、SQL の柔軟性と Cryo のデータ抽出機能を組み合わせて、ブロックチェーン データに対して強力な SQL クエリを実行できます。
2段階のSQLクエリフロー
データの抽出とクエリを 2 つの別々のステップに分割できます。
# Step 1: Download data and get file paths
download_result = client.query_dataset(
dataset="transactions",
blocks_from_latest=1000,
output_format="parquet"
)
# Step 2: Use the file paths to run SQL queries
file_paths = download_result.get("files", [])
client.query_sql(
query=f"""
SELECT
to_address as contract_address,
COUNT(*) as tx_count,
SUM(gas_used) as total_gas,
AVG(gas_used) as avg_gas
FROM read_parquet('{file_paths[0]}')
WHERE to_address IS NOT NULL
GROUP BY to_address
ORDER BY total_gas DESC
LIMIT 20
""",
files=file_paths
)複合SQLクエリフロー
便宜上、両方のステップを処理する結合関数を使用することもできます。
# Get top gas-consuming contracts
client.query_blockchain_sql(
sql_query="""
SELECT
to_address as contract_address,
COUNT(*) as tx_count,
SUM(gas_used) as total_gas,
AVG(gas_used) as avg_gas
FROM read_parquet('/path/to/transactions.parquet')
WHERE to_address IS NOT NULL
GROUP BY to_address
ORDER BY total_gas DESC
LIMIT 20
""",
dataset="transactions",
blocks_from_latest=1000
)
# Find blocks with the most transactions
client.query_blockchain_sql(
sql_query="""
SELECT
block_number,
COUNT(*) as tx_count
FROM read_parquet('/path/to/transactions.parquet')
GROUP BY block_number
ORDER BY tx_count DESC
LIMIT 10
""",
dataset="transactions",
blocks="15M:16M"
)
# Analyze event logs by topic
client.query_blockchain_sql(
sql_query="""
SELECT
topic0,
COUNT(*) as event_count
FROM read_parquet('/path/to/logs.parquet')
GROUP BY topic0
ORDER BY event_count DESC
LIMIT 20
""",
dataset="logs",
blocks_from_latest=100
)注:SQLクエリの場合、DuckDBで最適なパフォーマンスを確保するには、データをダウンロードする際に必ずoutput_format="parquet"を使用してください。query_blockchain_sql query_blockchain_sql使用する場合は、 read_parquet()関数を使用してSQL内でファイルパスを直接参照する必要があります。
ブロック範囲によるクエリ
Cryo MCP は、Cryo のブロック仕様構文の全範囲をサポートします。
# Using block numbers
client.query_dataset('transactions', blocks='15000000:15001000')
# Using K/M notation
client.query_dataset('logs', blocks='15M:15.01M')
# Using offsets from latest
client.query_dataset('blocks', blocks_from_latest=100)契約フィルタリング
契約アドレス別にログやその他のデータをフィルタリングします。
# Get all logs for USDC contract
client.query_dataset('logs',
blocks='16M:16.1M',
contract='0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48')列の選択
必要な列のみを含めます。
# Get just block numbers and timestamps
client.query_dataset('blocks',
blocks='16M:16.1M',
include_columns=['number', 'timestamp'])発達
プロジェクト構造
cryo-mcp/
├── cryo_mcp/ # Main package directory
│ ├── __init__.py # Package initialization
│ ├── server.py # Main MCP server implementation
│ ├── sql.py # SQL query functionality
├── tests/ # Test directory
│ ├── test_*.py # Test files
├── pyproject.toml # Project configuration
├── README.md # Project documentationテストを実行する
uv run pytest
ライセンス
マサチューセッツ工科大学
クレジット
Available Tools
10 toolsget_latest_ethereum_blockB
Get information about the latest Ethereum block
Returns:
Information about the latest block including block number
Inputs: no named parameters.
get_sql_examplesA
Get example SQL queries for different blockchain datasets with DuckDB
SQL WORKFLOW TIPS:
1. First download data: result = query_dataset('dataset_name', blocks='...', output_format='parquet')
2. Inspect schema: schema = get_sql_table_schema(result['files'][0])
3. Run SQL: query_sql("SELECT * FROM read_parquet('/path/to/file.parquet')", files=result['files'])
OR use the combined approach:
- query_blockchain_sql(sql_query="SELECT * FROM read_parquet('...')", dataset='blocks', blocks='...')
Returns:
Dictionary of example queries categorized by dataset type and workflow patterns
Inputs: no named parameters.
get_sql_table_schemaA
Get the schema and sample data for a specific parquet file
WORKFLOW NOTE: Use this function to explore the structure of parquet files
before writing SQL queries against them. This will show you:
1. All available columns and their data types
2. Sample data from the file
3. Total row count
Usage example:
1. Get list of files: files = list_available_sql_tables()
2. For a specific file: schema = get_sql_table_schema(files[0]['path'])
3. Use columns in your SQL: query_sql("SELECT column1, column2 FROM read_parquet('/path/to/file.parquet')")
Args:
file_path: Path to the parquet file (from list_available_sql_tables or query_dataset)
Returns:
Table schema information including columns, data types, and sample data
Inputs: file_path (required).
get_transaction_by_hashC
Get detailed information about a transaction by its hash
Args:
tx_hash: The transaction hash to look up
Returns:
Detailed information about the transaction
Inputs: tx_hash (required).
list_available_sql_tablesA
List all available parquet files that can be queried with SQL
USAGE NOTES:
- This function lists parquet files that have already been downloaded
- Each file can be queried using read_parquet('/path/to/file.parquet') in your SQL
- For each file, this returns the file path, dataset type, and other metadata
- Use these file paths in your SQL queries with query_sql()
Returns:
List of available files and their metadata
Inputs: no named parameters.
list_datasetsB
Return a list of all available cryo datasets
Inputs: no named parameters.
lookup_datasetA
Look up a specific dataset and return detailed information about it. IMPORTANT: Always use this
function before querying a new dataset to understand its required parameters and schema.
The returned information includes:
1. Required parameters for the dataset (IMPORTANT for datasets like 'balances' that need an address)
2. Schema details showing available columns and data types
3. Example queries for the dataset
When the dataset requires specific parameters like 'address' (for 'balances'),
ALWAYS use the 'contract' parameter in query_dataset() to pass these values.
Example:
For 'balances' dataset, lookup_dataset('balances') will show it requires an 'address' parameter.
You should then query it using:
query_dataset('balances', blocks='1000:1010', contract='0x1234...')
Args:
name: The name of the dataset to look up
sample_start_block: Optional start block for sample data (integer)
sample_end_block: Optional end block for sample data (integer)
use_latest_sample: If True, use the latest block for sample data
sample_blocks_from_latest: Number of blocks before the latest to include in sample
Returns:
Detailed information about the dataset including schema and available fields
Inputs: name (required), sample_blocks_from_latest, sample_end_block, sample_start_block, +1 more.
query_blockchain_sqlA
Download blockchain data and run SQL query in a single step
CONVENIENCE FUNCTION: This combines query_dataset and query_sql into one call.
You can write SQL queries using either approach:
1. Simple table references: "SELECT * FROM blocks LIMIT 10"
2. Explicit read_parquet: "SELECT * FROM read_parquet('/path/to/file.parquet') LIMIT 10"
DATASET-SPECIFIC PARAMETERS:
For datasets that require specific address parameters (like 'balances', 'erc20_transfers', etc.),
ALWAYS use the 'contract' parameter to pass ANY Ethereum address. For example:
- For 'balances' dataset: Use contract parameter for the address you want balances for
query_blockchain_sql(
sql_query="SELECT * FROM balances",
dataset="balances",
blocks='1000:1010',
contract='0x123...' # Address you want balances for
)
Examples:
```
# Using simple table name
query_blockchain_sql(
sql_query="SELECT * FROM blocks LIMIT 10",
dataset="blocks",
blocks_from_latest=100
)
# Using read_parquet() (the path will be automatically replaced)
query_blockchain_sql(
sql_query="SELECT * FROM read_parquet('/any/path.parquet') LIMIT 10",
dataset="blocks",
blocks_from_latest=100
)
```
ALTERNATIVE WORKFLOW (more control):
If you need more control, you can separate the steps:
1. Download data: result = query_dataset('blocks', blocks_from_latest=100, output_format='parquet')
2. Inspect schema: schema = get_sql_table_schema(result['files'][0])
3. Run SQL query: query_sql("SELECT * FROM blocks", files=result['files'])
Args:
sql_query: SQL query to execute - using table names or read_parquet()
dataset: The specific dataset to query (e.g., 'transactions', 'logs', 'balances')
If None, will be extracted from the SQL query
blocks: Block range specification as a string (e.g., '1000:1010')
start_block: Start block number (alternative to blocks)
end_block: End block number (alternative to blocks)
use_latest: If True, query the latest block
blocks_from_latest: Number of blocks before the latest to include
contract: Contract address to filter by - IMPORTANT: Use this parameter for ALL address-based filtering
regardless of the parameter name in the native cryo command (address, contract, etc.)
force_refresh: Force download of new data even if it exists
include_schema: Include schema information in the result
Returns:
SQL query results and metadata
Inputs: sql_query (required), blocks, blocks_from_latest, contract, +6 more.
query_datasetA
Download blockchain data and return the file paths where the data is stored.
IMPORTANT WORKFLOW NOTE: When running SQL queries, use this function first to download
data, then use the returned file paths with query_sql() to execute SQL on those files.
Example workflow for SQL:
1. First download data: result = query_dataset('transactions', blocks='1000:1010', output_format='parquet')
2. Get file paths: files = result.get('files', [])
3. Run SQL query: query_sql("SELECT * FROM read_parquet('/path/to/file.parquet')", files=files)
DATASET-SPECIFIC PARAMETERS:
For datasets that require specific address parameters (like 'balances', 'erc20_transfers', etc.),
ALWAYS use the 'contract' parameter to pass ANY Ethereum address. For example:
- For 'balances' dataset: Use contract parameter for the address you want balances for
query_dataset('balances', blocks='1000:1010', contract='0x123...')
- For 'logs' or 'erc20_transfers': Use contract parameter for contract address
query_dataset('logs', blocks='1000:1010', contract='0x123...')
To check what parameters a dataset requires, always use lookup_dataset() first:
lookup_dataset('balances') # Will show required parameters
Args:
dataset: The name of the dataset to query (e.g., 'logs', 'transactions', 'balances')
blocks: Block range specification as a string (e.g., '1000:1010')
start_block: Start block number as integer (alternative to blocks)
end_block: End block number as integer (alternative to blocks)
use_latest: If True, query the latest block
blocks_from_latest: Number of blocks before the latest to include (e.g., 10 = latest-10 to latest)
contract: Contract address to filter by - IMPORTANT: Use this parameter for ALL address-based filtering
regardless of the parameter name in the native cryo command (address, contract, etc.)
output_format: Output format (json, csv, parquet) - use 'parquet' for SQL queries
include_columns: Columns to include alongside the defaults
exclude_columns: Columns to exclude from the defaults
Returns:
Dictionary containing file paths where the downloaded data is stored
Inputs: dataset (required), blocks, blocks_from_latest, contract, +6 more.
query_sqlA
Run a SQL query against downloaded blockchain data files
IMPORTANT WORKFLOW: This function should be used after calling query_dataset
to download data. Use the file paths returned by query_dataset as input to this function.
Workflow steps:
1. Download data: result = query_dataset('transactions', blocks='1000:1010', output_format='parquet')
2. Get file paths: files = result.get('files', [])
3. Execute SQL using either:
- Direct table references: query_sql("SELECT * FROM transactions", files=files)
- Or read_parquet(): query_sql("SELECT * FROM read_parquet('/path/to/file.parquet')", files=files)
To see the schema of a file, use get_sql_table_schema(file_path) before writing your query.
DuckDB supports both approaches:
1. Direct table references (simpler): "SELECT * FROM blocks"
2. read_parquet function (explicit): "SELECT * FROM read_parquet('/path/to/file.parquet')"
Args:
query: SQL query to execute - can use simple table names or read_parquet()
files: List of parquet file paths to query (typically from query_dataset results)
include_schema: Whether to include schema information in the result
Returns:
Query results and metadata
Inputs: query (required), files, include_schema.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Most tools have distinct purposes, but there is some overlap between query_blockchain_sql and the combination of query_dataset + query_sql. The descriptions clarify that query_blockchain_sql is a convenience function combining the two, which helps reduce confusion, but agents might still need to decide between the separate or combined approach.
All tool names follow a consistent verb_noun pattern with snake_case, such as get_latest_ethereum_block, list_available_sql_tables, and query_dataset. This consistency makes the tool set predictable and easy to navigate for agents.
With 10 tools, the server is well-scoped for its purpose of blockchain data querying and SQL analysis. Each tool serves a clear role, from data retrieval (e.g., get_transaction_by_hash) to dataset exploration (e.g., lookup_dataset) and SQL execution (e.g., query_sql), without feeling bloated or sparse.
The tool set provides comprehensive coverage for blockchain data workflows, including data fetching (get_latest_ethereum_block, get_transaction_by_hash), dataset discovery (list_datasets, lookup_dataset), data download (query_dataset), SQL querying (query_sql, query_blockchain_sql), and schema inspection (get_sql_table_schema, list_available_sql_tables). There are no obvious gaps, and the tools support full CRUD-like operations for the domain.
Maintenance
Related MCP Connectors
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
Read-only MCP server for The Quiet Protocol's engines, benchmarks, proof, and business data.
MCP server connecting AI agents to non-custodial staking data across 130+ networks.
Token-free MCP server for structured RevoGrid Core, Pro, and Enterprise knowledge retrieval.
Related MCP Servers
- AlicenseDqualityDmaintenanceA Model Context Protocol server that gives LLMs the ability to interact with Ethereum networks, manage wallets, query blockchain data, and execute smart contract operations through a standardized interface.5414MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables AI agents to interact with 30+ Ethereum-compatible blockchain networks, providing services like token transfers, contract interactions, and ENS resolution through a unified interface.2896 npm380MIT
- AlicenseBqualityDmaintenanceAn MCP server that provides access to Etherscan blockchain data APIs, allowing users to query Ethereum blockchain information through natural language.618MIT
- AlicenseNot gradedqualityBmaintenanceAn MCP server that bridges AI models with Ethereum blockchains via all JSON-RPC calls, enabling natural language queries for block numbers, balances, transactions, and smart contract data.21MIT