subgraph-registry-mcp 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +178 -140
  2. package/package.json +2 -2
  3. package/src/index.js +1 -1
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Agent-friendly semantic classification of all subgraphs on [The Graph Network](https://thegraph.com).
8
8
 
9
- Pre-computed index of 15,500+ subgraphs with domain classification, protocol type detection, schema fingerprinting, canonical entity mapping, and composite reliability scoring.
9
+ Pre-computed index of **14,700+ subgraphs** with domain classification, protocol type detection, schema fingerprinting, canonical entity mapping, and composite reliability scoring.
10
10
 
11
11
  ## The Problem
12
12
 
@@ -14,158 +14,123 @@ Agents querying The Graph need to discover and select the right subgraph before
14
14
 
15
15
  ## What It Does
16
16
 
17
- 1. **Crawls** all active subgraphs from the Graph Network meta-subgraph (subgraphs indexing subgraphs)
17
+ 1. **Crawls** all active subgraphs from the Graph Network meta-subgraph
18
18
  2. **Fetches** the GraphQL schema for every deployment
19
- 3. **Classifies** each subgraph by:
20
- - **Domain**: DeFi, NFTs, DAOs, Gaming, Identity, Infrastructure, Social, Analytics
21
- - **Protocol Type**: DEX, Lending, Bridge, Staking, Options, Perpetuals, Marketplace, etc.
22
- - **Canonical Entities**: Maps schema types to a standard vocabulary (Pool -> `liquidity_pool`, Swap -> `trade`, etc.)
23
- - **Schema Family**: Groups forks/clones by schema fingerprint
24
- 4. **Scores** reliability (see [Reliability Score](#reliability-score) below)
25
- 5. **Publishes** as JSON registry + SQLite database + REST API
19
+ 3. **Classifies** each subgraph by domain, protocol type, canonical entities, and schema family
20
+ 4. **Scores** reliability using on-chain signals (query fees, volume, curation, stake)
21
+ 5. **Publishes** as SQLite database + REST API + MCP server
22
+ 6. **Generates** visual dashboards and bot-readable category files (auto-updated with each sync)
26
23
 
27
- ## Quick Start
24
+ ---
28
25
 
29
- ```bash
30
- cd python
31
- python3 -m venv .venv && source .venv/bin/activate
32
- pip install -r requirements.txt
26
+ ## Registry at a Glance
33
27
 
34
- # Create .env with your Graph API key
35
- echo "GATEWAY_API_KEY=your-key-here" > .env
28
+ <p align="center">
29
+ <img src="docs/charts/domains.svg" alt="Subgraphs by Domain" width="480"/>
30
+ </p>
36
31
 
37
- # Full crawl + classify (all 15K+ subgraphs, ~11 min)
38
- python registry.py
32
+ <p align="center">
33
+ <img src="docs/charts/networks.svg" alt="Subgraphs by Network" width="600"/>
34
+ </p>
39
35
 
40
- # Or limit to top N by signal
41
- python registry.py --max 500
36
+ <p align="center">
37
+ <img src="docs/charts/protocol-types.svg" alt="Subgraphs by Protocol Type" width="600"/>
38
+ </p>
42
39
 
43
- # Start API server
44
- python server.py
45
- ```
40
+ <p align="center">
41
+ <img src="docs/charts/reliability-dist.svg" alt="Reliability Distribution" width="480"/>
42
+ </p>
46
43
 
47
- ## API Endpoints
44
+ > Charts auto-generated from `registry.db` on each sync. See [`python/generate_docs.py`](python/generate_docs.py).
48
45
 
49
- ```
50
- GET /summary Registry overview and stats
51
- GET /domains Domain breakdown
52
- GET /networks Network breakdown
53
- GET /families Schema family groups (fork/clone detection)
54
- GET /subgraphs Filter subgraphs
55
- GET /subgraphs/{id} Full detail for one subgraph
56
- GET /search?q=uniswap Free-text search
57
- GET /recommend?goal=...&chain= Agent-optimized recommendation
58
- ```
46
+ ---
59
47
 
60
- ### Example: Agent Recommendation
48
+ ## Browse by Category
61
49
 
62
- ```bash
63
- curl "http://localhost:3847/recommend?goal=query+DEX+trades+on+Arbitrum&chain=arbitrum-one"
64
- ```
65
-
66
- Returns the top subgraphs matching the intent, with reliability scores and query instructions.
67
-
68
- ### Example: Filter by Entity Type
69
-
70
- ```bash
71
- curl "http://localhost:3847/subgraphs?entity=liquidity_pool&network=base&min_reliability=0.5"
72
- ```
50
+ ### Domains
73
51
 
74
- ## Weekly Sync
52
+ Explore subgraphs by use case — each file lists the top 25 subgraphs ranked by reliability score.
75
53
 
76
- ```bash
77
- # Run weekly incremental updates (only fetches new/changed subgraphs)
78
- python scheduler.py
54
+ | Domain | Count | File |
55
+ |--------|-------|------|
56
+ | [DeFi](docs/domains/defi.md) | 11,218 | Swaps, pools, lending, vaults, yield |
57
+ | [NFTs](docs/domains/nfts.md) | 857 | Collections, marketplaces, sales |
58
+ | [Infrastructure](docs/domains/infrastructure.md) | 581 | Indexers, oracles, registries |
59
+ | [DAO](docs/domains/dao.md) | 429 | Governance, proposals, voting |
60
+ | [Identity](docs/domains/identity.md) | 401 | ENS, name services, resolvers |
61
+ | [Analytics](docs/domains/analytics.md) | 327 | Snapshots, metrics, historical data |
62
+ | [Gaming](docs/domains/gaming.md) | 247 | Players, quests, items, worlds |
63
+ | [Social](docs/domains/social.md) | 74 | Profiles, posts, follows |
79
64
 
80
- # One-shot incremental
81
- python scheduler.py --once
82
- ```
65
+ Full index: [`docs/DOMAINS.md`](docs/DOMAINS.md)
83
66
 
84
- ## Architecture
67
+ ### Networks
85
68
 
86
- ```
87
- Graph Network Subgraph (meta-subgraph, 140M queries/month)
88
- |
89
- v
90
- crawler.py ---- async httpx, ID-based cursor pagination (bypasses 5K skip limit)
91
- |
92
- v
93
- classifier.py - rule-based domain/protocol classification + schema fingerprinting
94
- |
95
- v
96
- registry.py --- builds JSON registry + SQLite + indices
97
- |
98
- v
99
- server.py ----- FastAPI REST API with /recommend endpoint (:3847)
100
- |
101
- v
102
- scheduler.py -- weekly incremental sync via updatedAt filtering
69
+ Explore subgraphs by blockchain — each file lists the top 25 subgraphs on that chain.
103
70
 
104
- MCP Server (src/index.js)
105
- |
106
- ├── stdio transport ←── Claude Desktop / Claude Code (npx command)
107
- └── SSE/HTTP :3848 ←── OpenClaw / remote agents (--http flag)
108
- ```
71
+ | Network | Count | File |
72
+ |---------|-------|------|
73
+ | [Ethereum](docs/networks/mainnet.md) | 2,377 | Largest ecosystem |
74
+ | [Base](docs/networks/base.md) | 1,728 | Fast-growing L2 |
75
+ | [BSC](docs/networks/bsc.md) | 1,582 | BNB Chain |
76
+ | [Arbitrum](docs/networks/arbitrum-one.md) | 1,376 | Leading L2 |
77
+ | [Polygon](docs/networks/matic.md) | 1,266 | Polygon PoS |
78
+ | [Optimism](docs/networks/optimism.md) | 568 | OP Stack L2 |
79
+ | [Avalanche](docs/networks/avalanche.md) | 440 | C-Chain |
109
80
 
110
- ## Output
81
+ Full index: [`docs/NETWORKS.md`](docs/NETWORKS.md)
111
82
 
112
- | File | Size | Description |
113
- |---|---|---|
114
- | `registry.json` | ~130 MB | Full registry with all entity details |
115
- | `registry.db` | ~8 MB | SQLite with indexed lookups |
116
- | `sync-state.json` | <1 KB | Last sync timestamp for incremental updates |
83
+ ### Protocol Types
117
84
 
118
- ## Classification Results (as of March 2026)
85
+ | Type | Count | Description |
86
+ |------|-------|-------------|
87
+ | DEX | 4,176 | Uniswap, Sushi, Curve, Balancer, PancakeSwap |
88
+ | Lending | 1,424 | Aave, Compound, Morpho, Spark, Silo |
89
+ | Staking | 867 | Lido, Rocket Pool, EigenLayer, Graph Network |
90
+ | Bridge | 771 | Hop, Stargate, Across, Wormhole, LayerZero |
91
+ | NFT Marketplace | 436 | OpenSea, Blur, Rarible, Foundation |
92
+ | Governance | 416 | Snapshot, Tally, Compound Governor |
93
+ | Yield Aggregator | 387 | Yearn, Beefy, Harvest, Convex |
94
+ | Perpetuals | 266 | GMX, Gains, dYdX, Hyperliquid |
95
+ | Name Service | 223 | ENS, Space ID, Unstoppable Domains |
96
+ | Options | 179 | Premia, Dopex, Lyra, Hegic |
119
97
 
120
- | Domain | Count | | Network | Count |
121
- |---|---|---|---|---|
122
- | DeFi | 11,841 | | Ethereum | 2,471 |
123
- | NFTs | 893 | | Base | 1,845 |
124
- | Infrastructure | 602 | | BSC | 1,664 |
125
- | DAO | 450 | | Arbitrum | 1,442 |
126
- | Identity | 424 | | Polygon | 1,364 |
127
- | Analytics | 348 | | Optimism | 593 |
128
- | Gaming | 255 | | Avalanche | 454 |
129
- | Social | 78 | | | |
98
+ ---
130
99
 
131
100
  ## Reliability Score
132
101
 
133
- Each subgraph gets a composite reliability score (01) based on four on-chain signals:
102
+ Each subgraph gets a composite reliability score (0-1) based on four on-chain signals:
134
103
 
135
- | Signal | Weight | What it measures | Source |
136
- |---|---|---|---|
137
- | **Query Fees** | 30% | GRT fees earned from actual usage — proves real demand | Network subgraph |
138
- | **Query Volume** | 30% | 30-day query count — recent activity level | QoS subgraph |
139
- | **Curation Signal** | 20% | GRT tokens curated community vote of confidence | Network subgraph |
140
- | **Indexer Stake** | 20% | GRT staked by indexers skin in the game | Network subgraph |
104
+ | Signal | Weight | What it measures |
105
+ |--------|--------|------------------|
106
+ | **Query Fees** | 30% | GRT fees earned from actual usage |
107
+ | **Query Volume** | 30% | 30-day query count |
108
+ | **Curation Signal** | 20% | GRT tokens curated by the community |
109
+ | **Indexer Allocation** | 20% | GRT allocated to this subgraph by indexers |
141
110
 
142
- All values are log-scaled and capped at 1.0. Usage signals (fees + volume) are weighted higher at 60% because they prove real demand. A 0.5 penalty is applied if the subgraph has been denied/deprecated.
111
+ All values are log-scaled and capped at 1.0. A 0.5 penalty is applied if the subgraph has been denied/deprecated.
143
112
 
144
- **What the scores mean:**
145
- - **0.7–1.0**: High reliability — strong signal, active indexers, real usage (e.g. Uniswap, Aave)
146
- - **0.3–0.7**: Moderate — some signal and usage, likely functional
147
- - **0.0–0.3**: Low — minimal signal, may be inactive or a test deployment
113
+ **Score tiers:** High (0.7+) = strong signal, real usage | Medium (0.3-0.7) = functional, some activity | Low (<0.3) = minimal signal or test deployment
148
114
 
149
- ## MCP Server
115
+ ---
150
116
 
151
- The registry is available as an MCP server for agent integration. It supports **dual transport** — stdio for local clients (Claude Desktop, Claude Code) and SSE/HTTP for remote agents (OpenClaw, custom agent frameworks).
117
+ ## MCP Server
152
118
 
153
- It exposes 4 tools:
119
+ The registry is available as an MCP server with **dual transport** — stdio for local clients and SSE/HTTP for remote agents.
154
120
 
121
+ **4 tools:**
155
122
  - **search_subgraphs** — filter by domain, network, protocol type, entity, or keyword
156
123
  - **recommend_subgraph** — natural language goal to best subgraphs
157
124
  - **get_subgraph_detail** — full classification for a specific subgraph
158
125
  - **list_registry_stats** — registry overview (domains, networks, counts)
159
126
 
160
- ### Install via NPM
127
+ ### Install
161
128
 
162
129
  ```bash
163
- npx subgraph-registry-mcp
164
- ```
165
-
166
- ### Add to Claude Desktop (stdio)
130
+ # Claude Code
131
+ claude mcp add subgraph-registry -- npx subgraph-registry-mcp
167
132
 
168
- ```json
133
+ # Claude Desktop
169
134
  {
170
135
  "mcpServers": {
171
136
  "subgraph-registry": {
@@ -174,50 +139,123 @@ npx subgraph-registry-mcp
174
139
  }
175
140
  }
176
141
  }
142
+
143
+ # Remote agents (SSE)
144
+ npx subgraph-registry-mcp --http-only
145
+ # Then connect to http://localhost:3848/sse
177
146
  ```
178
147
 
179
- ### Add to OpenClaw / Remote Agents (SSE)
148
+ The server auto-downloads the pre-built registry (8MB SQLite) from GitHub on first run.
149
+
150
+ ---
180
151
 
181
- Start the server with the HTTP transport:
152
+ ## REST API
153
+
154
+ ```
155
+ GET /summary Registry overview and stats
156
+ GET /domains Domain breakdown
157
+ GET /networks Network breakdown
158
+ GET /families Schema family groups (fork/clone detection)
159
+ GET /subgraphs Filter subgraphs
160
+ GET /subgraphs/{id} Full detail for one subgraph
161
+ GET /search?q=uniswap Free-text search
162
+ GET /recommend?goal=...&chain= Agent-optimized recommendation
163
+ ```
182
164
 
183
165
  ```bash
184
- # Dual transport — stdio + SSE on port 3848
185
- npx subgraph-registry-mcp --http
166
+ # Start API server
167
+ cd python && python server.py
186
168
 
187
- # SSE only (for remote/server deployments)
188
- npx subgraph-registry-mcp --http-only
169
+ # Example: find DEX subgraphs on Arbitrum
170
+ curl "http://localhost:3847/recommend?goal=query+DEX+trades+on+Arbitrum&chain=arbitrum-one"
189
171
 
190
- # Custom port
191
- MCP_HTTP_PORT=4000 npx subgraph-registry-mcp --http
172
+ # Example: filter by entity type
173
+ curl "http://localhost:3847/subgraphs?entity=liquidity_pool&network=base&min_reliability=0.5"
192
174
  ```
193
175
 
194
- Then point your agent at the SSE endpoint:
176
+ ---
195
177
 
196
- ```json
197
- {
198
- "mcpServers": {
199
- "subgraph-registry": {
200
- "url": "http://localhost:3848/sse"
201
- }
202
- }
203
- }
178
+ ## Bot-Readable Category Files
179
+
180
+ The `docs/` directory contains structured `.md` files with YAML frontmatter designed for AI agents and bots to consume:
181
+
182
+ ```
183
+ docs/
184
+ ├── DOMAINS.md # Index of all domains with counts
185
+ ├── NETWORKS.md # Index of all networks with counts
186
+ ├── charts/ # Auto-generated SVG visualizations
187
+ │ ├── domains.svg
188
+ │ ├── networks.svg
189
+ │ ├── protocol-types.svg
190
+ │ └── reliability.svg
191
+ ├── domains/ # One file per domain
192
+ │ ├── defi.md # Top 25 DeFi subgraphs by reliability
193
+ │ ├── nfts.md
194
+ │ ├── dao.md
195
+ │ └── ...
196
+ └── networks/ # One file per network
197
+ ├── mainnet.md # Top 25 Ethereum subgraphs by reliability
198
+ ├── base.md
199
+ ├── arbitrum-one.md
200
+ └── ...
204
201
  ```
205
202
 
206
- ### Transport Modes
203
+ Each category file includes:
204
+ - YAML frontmatter (domain/network, count, percentage, last updated)
205
+ - Top 25 subgraphs ranked by reliability score
206
+ - MCP tool and REST API query examples
207
207
 
208
- | Invocation | Transports | Use case |
209
- |---|---|---|
210
- | `npx subgraph-registry-mcp` | stdio | Claude Desktop, Claude Code |
211
- | `npx subgraph-registry-mcp --http` | stdio + SSE :3848 | Dual — local + remote agents |
212
- | `npx subgraph-registry-mcp --http-only` | SSE :3848 | OpenClaw, remote deployments |
208
+ ---
213
209
 
214
- A `/health` endpoint is available at `http://localhost:3848/health` when HTTP transport is active.
210
+ ## Architecture
215
211
 
216
- The server auto-downloads the pre-built registry (8MB SQLite) from GitHub on first run — no local build needed.
212
+ ```
213
+ Graph Network Subgraph (meta-subgraph, 140M queries/month)
214
+ |
215
+ v
216
+ crawler.py ---- async httpx, ID-based cursor pagination
217
+ |
218
+ v
219
+ classifier.py - rule-based domain/protocol classification + schema fingerprinting
220
+ |
221
+ v
222
+ registry.py --- builds SQLite + indices
223
+ |
224
+ ├── server.py ------ FastAPI REST API (:3847)
225
+ ├── generate_docs.py SVG charts + category .md files
226
+ └── scheduler.py --- weekly incremental sync
227
+
228
+ MCP Server (src/index.js)
229
+ ├── stdio ←── Claude Desktop / Claude Code
230
+ └── SSE ←── OpenClaw / remote agents (:3848)
231
+ ```
232
+
233
+ ## Quick Start (Local Build)
234
+
235
+ ```bash
236
+ cd python
237
+ python3 -m venv .venv && source .venv/bin/activate
238
+ pip install -r requirements.txt
239
+
240
+ echo "GATEWAY_API_KEY=your-key-here" > .env
241
+
242
+ # Full crawl + classify (~11 min)
243
+ python registry.py
244
+
245
+ # Generate charts and category files
246
+ python generate_docs.py
247
+
248
+ # Start API server
249
+ python server.py
250
+ ```
217
251
 
218
252
  ## How It Stays Current
219
253
 
220
- The Graph Network subgraph indexes all subgraph deployments on-chain. The crawler queries `updatedAt_gte: lastSyncTimestamp` to fetch only what changed since the last run. Weekly syncs keep the registry fresh without full rebuilds.
254
+ A GitHub Actions workflow runs every 3 days:
255
+ 1. Incremental crawl (`updatedAt_gte: lastSyncTimestamp`)
256
+ 2. Reclassify new/changed subgraphs
257
+ 3. Regenerate SVG charts and category .md files
258
+ 4. Commit and push updates
221
259
 
222
260
  ## License
223
261
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "subgraph-registry-mcp",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "mcpName": "io.github.PaulieB14/subgraph-registry-mcp",
5
- "description": "MCP server for agent-friendly subgraph discovery on The Graph Network. 15,500+ classified subgraphs with reliability scoring.",
5
+ "description": "MCP server for agent-friendly subgraph discovery on The Graph Network. 14,700+ classified subgraphs with domain, protocol type, and reliability scoring.",
6
6
  "type": "module",
7
7
  "bin": {
8
8
  "subgraph-registry-mcp": "src/index.js"
package/src/index.js CHANGED
@@ -328,7 +328,7 @@ const TOOLS = [
328
328
  network: { type: "string", description: "Filter by chain: mainnet, arbitrum-one, base, matic, bsc, optimism, avalanche, etc." },
329
329
  protocol_type: { type: "string", description: "Filter by protocol type: dex, lending, bridge, staking, options, perpetuals, etc." },
330
330
  entity: { type: "string", description: "Filter by canonical entity: liquidity_pool, trade, token, position, vault, loan, etc." },
331
- min_reliability: { type: "number", description: "Minimum reliability score (0-1). Higher = more signal/stake/fees." },
331
+ min_reliability: { type: "number", description: "Minimum reliability score (0-1). Higher = more query fees, volume, curation signal, and indexer allocation." },
332
332
  limit: { type: "integer", description: "Max results to return (default: 20)", default: 20 },
333
333
  },
334
334
  },