Logo Cryo

Cryo

Cộng đồng
z80dev

A Python package for accessing Cryo datasets via Claude Code

Nhà phát hànhz80dev
Kho mãcryo-mcp
Ngôn ngữPython
Bản fork
11
Sao
91
Công cụ có sẵn
0
Phương thức truyền tảistdio
Danh mục
Giấy phépMIT
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    Cryo cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    91 sao và 11 bản fork từ kho mã được liên kết.

Cryo MCP 🧊

A Model Completion Protocol (MCP) server for the Cryo blockchain data extraction tool.

Cryo MCP allows you to access Cryo's powerful blockchain data extraction capabilities via an API server that implements the MCP protocol, making it easy to query blockchain data from any MCP-compatible client.

For LLM Users: SQL Query Workflow Guide

When using this MCP server to run SQL queries on blockchain data, follow this workflow:

  1. Download data with query_dataset:

    python
    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 paths
  2. Explore schema with get_sql_table_schema:

    python
    # 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 data
  3. Run SQL with query_sql:

    python
    # 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
    )

Alternatively, use the combined approach with query_blockchain_sql:

python
# 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
)

For a complete working example, see examples/sql_workflow_example.py.

Features

  • Full Cryo Dataset Access: Query any Cryo dataset through an API server
  • MCP Integration: Works seamlessly with MCP clients
  • Flexible Query Options: Support for all major Cryo filtering and output options
  • Block Range Options: Query specific blocks, latest block, or relative ranges
  • Contract Filtering: Filter data by contract address
  • Latest Block Access: Easy access to the latest Ethereum block data
  • Multiple Output Formats: JSON, CSV, and Parquet support
  • Schema Information: Get detailed dataset schemas and sample data
  • SQL Queries: Run SQL queries directly against downloaded blockchain data

Installation (Optional)

This is not required if you will run the tool with uvx directly.

bash
# install with UV (recommended)
uv tool install cryo-mcp

Requirements

  • Python 3.8+
  • uv
  • A working installation of Cryo
  • Access to an Ethereum RPC endpoint
  • DuckDB (for SQL query functionality)

Quick Start

Usage with Claude Code

  1. Run claude mcp add for an interactive prompt.
  2. Enter uvx as the command to run.
  3. Enter cryo-mcp --rpc-url <ETH_RPC_URL> [--data-dir <DATA_DIR>] as the args
  4. Alternatively, provide ETH_RPC_URL and CRYO_DATA_DIR as environment variables instead.

New instances of claude will now have access to cryo as configured to hit your RPC endpoint and store data in the specified directory.

Available Tools

Cryo MCP exposes the following MCP tools:

list_datasets()

Returns a list of all available Cryo datasets.

Example:

python
client.list_datasets()

query_dataset()

Query a Cryo dataset with various filtering options.

Parameters:

  • dataset (str): The name of the dataset to query (e.g., 'blocks', 'transactions', 'logs')
  • blocks (str, optional): Block range specification (e.g., '1000:1010')
  • start_block (int, optional): Start block number (alternative to blocks)
  • end_block (int, optional): End block number (alternative to blocks)
  • use_latest (bool, optional): If True, query the latest block
  • blocks_from_latest (int, optional): Number of blocks from latest to include
  • contract (str, optional): Contract address to filter by
  • output_format (str, optional): Output format ('json', 'csv', 'parquet')
  • include_columns (list, optional): Columns to include alongside defaults
  • exclude_columns (list, optional): Columns to exclude from defaults

Example:

python
# 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()

Get detailed information about a specific dataset, including schema and sample data.

Parameters:

  • name (str): The name of the dataset to look up
  • sample_start_block (int, optional): Start block for sample data
  • sample_end_block (int, optional): End block for sample data
  • use_latest_sample (bool, optional): Use latest block for sample
  • sample_blocks_from_latest (int, optional): Number of blocks from latest for sample

Example:

python
client.lookup_dataset('logs')

get_latest_ethereum_block()

Returns information about the latest Ethereum block.

Example:

python
client.get_latest_ethereum_block()

SQL Query Tools

Cryo MCP includes several tools for running SQL queries against blockchain data:

query_sql()

Run a SQL query against downloaded blockchain data.

Parameters:

  • query (str): SQL query to execute
  • files (list, optional): List of parquet file paths to query. If None, will use all files in the data directory.
  • include_schema (bool, optional): Whether to include schema information in the result

Example:

python
# 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()

Query blockchain data using SQL, automatically downloading any required data.

Parameters:

  • sql_query (str): SQL query to execute
  • dataset (str, optional): The dataset to query (e.g., 'blocks', 'transactions')
  • blocks (str, optional): Block range specification
  • start_block (int, optional): Start block number
  • end_block (int, optional): End block number
  • use_latest (bool, optional): If True, query the latest block
  • blocks_from_latest (int, optional): Number of blocks before the latest to include
  • contract (str, optional): Contract address to filter by
  • force_refresh (bool, optional): Force download of new data even if it exists
  • include_schema (bool, optional): Include schema information in the result

Example:

python
# 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()

List all available tables that can be queried with SQL.

Example:

python
client.list_available_sql_tables()

get_sql_table_schema()

Get the schema for a specific parquet file.

Parameters:

  • file_path (str): Path to the parquet file

Example:

python
client.get_sql_table_schema("/path/to/blocks.parquet")

get_sql_examples()

Get example SQL queries for different blockchain datasets.

Example:

python
client.get_sql_examples()

Configuration Options

When starting the Cryo MCP server, you can use these command-line options:

  • --rpc-url URL: Ethereum RPC URL (overrides ETH_RPC_URL environment variable)
  • --data-dir PATH: Directory to store downloaded data (overrides CRYO_DATA_DIR environment variable, defaults to ~/.cryo-mcp/data/)

Environment Variables

  • ETH_RPC_URL: Default Ethereum RPC URL to use when not specified via command line
  • CRYO_DATA_DIR: Default directory to store downloaded data when not specified via command line

Advanced Usage

SQL Queries Against Blockchain Data

Cryo MCP allows you to run powerful SQL queries against blockchain data, combining the flexibility of SQL with Cryo's data extraction capabilities:

Two-Step SQL Query Flow

You can split data extraction and querying into two separate steps:

python
# 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
)

Combined SQL Query Flow

For convenience, you can also use the combined function that handles both steps:

python
# 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
)

Note: For SQL queries, always use output_format="parquet" when downloading data to ensure optimal performance with DuckDB. When using query_blockchain_sql, you should refer to the file paths directly in your SQL using the read_parquet() function.

Querying with Block Ranges

Cryo MCP supports the full range of Cryo's block specification syntax:

python
# 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)

Contract Filtering

Filter logs and other data by contract address:

python
# Get all logs for USDC contract
client.query_dataset('logs', 
                    blocks='16M:16.1M', 
                    contract='0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48')

Column Selection

Include only the columns you need:

python
# Get just block numbers and timestamps
client.query_dataset('blocks', 
                    blocks='16M:16.1M', 
                    include_columns=['number', 'timestamp'])

Development

Project Structure

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

Run Tests

uv run pytest

License

MIT

Credits

  • Built on top of the amazing Cryo tool by Paradigm
  • Uses the MCP protocol for API communication

Cài đặt

TypingMind
Yêu cầu:

Node.js 18+

{
  "mcpServers": {
    "cryo": {
      "command": "uvx",
      "args": [
        "cryo-mcp"
      ],
      "env": {
        "ETH_RPC_URL": "",
        "CRYO_DATA_DIR": ""
      }
    }
  }
}

Dùng MCP Cryo với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối Cryo, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm Cryo làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của Cryo.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "cryo": {
      "command": "npx",
      "args": [
        "-y",
        "cryo-mcp"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của Cryo, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của Cryo.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng Cryo giúp tôi làm việc này không?
Cryo
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng Cryo.

Câu hỏi thường gặp

Máy chủ MCP Cryo dùng để làm gì?

Cryo là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP Cryo với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng Cryo với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP Cryo với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối Cryo, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP Cryo với TypingMind?

Cryo hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP Cryo cung cấp những công cụ nào trong TypingMind?

Cryo cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP Cryo không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu Cryo yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇