区块链数据流式MCP服务

该服务将 Indexing Co 的区块链管道数据经 WebSocket 实时同步到本地 SQLite,使 Claude Code 能够订阅、SQL 查询与分析链上事件,适用于实时链上数据监控、分析和自动化开发场景。

  • by indexing-co
  • TypeScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 indexing-co/indexing-co-mcp

使用说明

Archived 2026-09-29 — moved into @indexing/cli. Use indexing-co mcp from npm i -g @indexing/cli (0.2.0+). For Claude Code: claude mcp add indexing-co -- npx -y @indexing/cli mcp.

Indexing Co MCP Server

Stream live blockchain data from Indexing Co pipelines directly into your Claude Code session.

Instead of pushing to a database and querying separately, this MCP server subscribes to pipeline events over WebSockets and stores them in local SQLite — so Claude can query, analyze, and react to blockchain data in real time.

[Blockchain] → [Indexer Pipeline] → [DIRECT adapter] → [MCP Server (WebSocket)] → [SQLite] → [Claude Code]

Quick Start

1. Install

git clone https://github.com/indexing-co/indexing-co-mcp.git
cd indexing-co-mcp
npm install && npm run build

This also installs the Claude Code pipeline skill to ~/.claude/skills/. To update later: git pull && npm run build.

2. Configure

Sign in to Console, open Account -> API Keys, and create or copy an active account API key. New accounts include 10,000 free blocks and no card is required.

Add the key to ~/.indexing-co/credentials:

API_KEY=<your Indexing Co API key>

You can also set INDEXING_API_KEY in the MCP server environment. Do not use browser JWTs, bearer headers, destination secrets, or private keys as MCP credentials.

3. Register with Claude Code

claude mcp add indexing-co -- node /path/to/indexing-co-mcp/dist/index.js

4. Use

In Claude Code, the following tools are now available:

Tool Description
subscribe Subscribe to a DIRECT pipeline channel. Validates channel exists.
unsubscribe Stop receiving events for a channel.
get_subscriptions List active channels, connection status, event counts.
get_events Get recent raw events as JSON.
describe_data Auto-discover data shape from stored events.
query Run read-only SQL with json_extract() support.
clear_events Delete stored events (all or by channel).
chart Run SQL and render results as ASCII chart (sparkline, line, bar, histogram, table).
get_status WebSocket state, channels, event counts, and uptime.
list_pipelines List all pipelines. Shows DIRECT channel names.
get_pipeline Get a pipeline by name.
create_pipeline Create or update a pipeline (POSTGRES, HTTP, WEBSOCKET, DIRECT).
delete_pipeline Delete a pipeline.
backfill Backfill historical data for a pipeline.
list_filters List all filters.
get_filter Get filter values with optional prefix search.
create_filter Create a filter or add values to an existing filter.
delete_filter_values Remove values from a filter.
list_transformations List all transformations.
get_transformation Get transformation code by name.
create_transformation Create or update a transformation.
test_transformation Test transformation code against live blockchain data.

How It Works

Pipeline Setup

When creating an Indexing Co pipeline, add DIRECT as a delivery adapter:

{
  "delivery": {
    "adapter": "DIRECT",
    "connectionUri": "",
    "table": "my-channel-name"
  }
}
  • table is the channel name you'll subscribe to
  • Empty connectionUri uses env vars
  • Can run alongside any other adapter (e.g., DIRECT + POSTGRES)
  • Events only sent when at least one subscriber is connected — no wasted API calls

Querying Data

Events are stored as raw JSON in SQLite. Use describe_data to discover the shape, then query with SQL:

SELECT json_extract(data, '$.chain') as chain,
       json_extract(data, '$.transaction_hash') as tx,
       json_extract(data, '$.decoded.value') as amount
FROM events
WHERE channel = 'my-transfers'
  AND json_extract(data, '$.chain') = 'ethereum'
ORDER BY received_at DESC
LIMIT 20;

Architecture

  • No external client libraries — uses Node 22+ built-in WebSocket
  • Auto-reconnect with exponential backoff
  • SQLite with WAL mode for concurrent read/write
  • Generic schema — works with any pipeline output shape
  • Events are stored locally in SQLite. The MCP tools intentionally do not expose the absolute database path.

Environment Variables

Variable Required Description
INDEXING_API_KEY Yes Indexing Co account API key from Console -> Account -> API Keys (also read from ~/.indexing-co/credentials as API_KEY)
STREAM_URL No Override stream WebSocket URL (auto-fetched from API if not set)

Requirements

  • Node.js 22+
  • An Indexing Co Console account with an active API key

License

MIT