subgraph-registry-mcp 0.2.2 → 0.3.0
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.
- package/LICENSE +21 -0
- package/README.md +51 -3
- package/package.json +14 -4
- package/src/index.js +68 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PaulieB14
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Subgraph Registry
|
|
2
2
|
|
|
3
|
+
<a href="https://glama.ai/mcp/servers/PaulieB14/subgraph-registry">
|
|
4
|
+
<img width="380" height="200" src="https://glama.ai/mcp/servers/PaulieB14/subgraph-registry/badge" />
|
|
5
|
+
</a>
|
|
6
|
+
|
|
3
7
|
Agent-friendly semantic classification of all subgraphs on [The Graph Network](https://thegraph.com).
|
|
4
8
|
|
|
5
9
|
Pre-computed index of 15,500+ subgraphs with domain classification, protocol type detection, schema fingerprinting, canonical entity mapping, and composite reliability scoring.
|
|
@@ -92,10 +96,15 @@ classifier.py - rule-based domain/protocol classification + schema fingerprintin
|
|
|
92
96
|
registry.py --- builds JSON registry + SQLite + indices
|
|
93
97
|
|
|
|
94
98
|
v
|
|
95
|
-
server.py ----- FastAPI REST API with /recommend endpoint
|
|
99
|
+
server.py ----- FastAPI REST API with /recommend endpoint (:3847)
|
|
96
100
|
|
|
|
97
101
|
v
|
|
98
102
|
scheduler.py -- weekly incremental sync via updatedAt filtering
|
|
103
|
+
|
|
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)
|
|
99
108
|
```
|
|
100
109
|
|
|
101
110
|
## Output
|
|
@@ -139,7 +148,9 @@ All values are log-scaled and capped at 1.0. Usage signals (fees + volume) are w
|
|
|
139
148
|
|
|
140
149
|
## MCP Server
|
|
141
150
|
|
|
142
|
-
The registry is available as an MCP server for agent integration. It
|
|
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).
|
|
152
|
+
|
|
153
|
+
It exposes 4 tools:
|
|
143
154
|
|
|
144
155
|
- **search_subgraphs** — filter by domain, network, protocol type, entity, or keyword
|
|
145
156
|
- **recommend_subgraph** — natural language goal to best subgraphs
|
|
@@ -152,7 +163,7 @@ The registry is available as an MCP server for agent integration. It exposes 4 t
|
|
|
152
163
|
npx subgraph-registry-mcp
|
|
153
164
|
```
|
|
154
165
|
|
|
155
|
-
### Add to Claude Desktop
|
|
166
|
+
### Add to Claude Desktop (stdio)
|
|
156
167
|
|
|
157
168
|
```json
|
|
158
169
|
{
|
|
@@ -165,6 +176,43 @@ npx subgraph-registry-mcp
|
|
|
165
176
|
}
|
|
166
177
|
```
|
|
167
178
|
|
|
179
|
+
### Add to OpenClaw / Remote Agents (SSE)
|
|
180
|
+
|
|
181
|
+
Start the server with the HTTP transport:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
# Dual transport — stdio + SSE on port 3848
|
|
185
|
+
npx subgraph-registry-mcp --http
|
|
186
|
+
|
|
187
|
+
# SSE only (for remote/server deployments)
|
|
188
|
+
npx subgraph-registry-mcp --http-only
|
|
189
|
+
|
|
190
|
+
# Custom port
|
|
191
|
+
MCP_HTTP_PORT=4000 npx subgraph-registry-mcp --http
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Then point your agent at the SSE endpoint:
|
|
195
|
+
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"mcpServers": {
|
|
199
|
+
"subgraph-registry": {
|
|
200
|
+
"url": "http://localhost:3848/sse"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Transport Modes
|
|
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 |
|
|
213
|
+
|
|
214
|
+
A `/health` endpoint is available at `http://localhost:3848/health` when HTTP transport is active.
|
|
215
|
+
|
|
168
216
|
The server auto-downloads the pre-built registry (8MB SQLite) from GitHub on first run — no local build needed.
|
|
169
217
|
|
|
170
218
|
## How It Stays Current
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "subgraph-registry-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"mcpName": "io.github.PaulieB14/subgraph-registry-mcp",
|
|
4
5
|
"description": "MCP server for agent-friendly subgraph discovery on The Graph Network. 15,500+ classified subgraphs with reliability scoring.",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"bin": {
|
|
@@ -11,7 +12,9 @@
|
|
|
11
12
|
"data/registry.db"
|
|
12
13
|
],
|
|
13
14
|
"scripts": {
|
|
14
|
-
"start": "node src/index.js"
|
|
15
|
+
"start": "node src/index.js",
|
|
16
|
+
"start:http": "node src/index.js --http",
|
|
17
|
+
"start:http-only": "node src/index.js --http-only"
|
|
15
18
|
},
|
|
16
19
|
"keywords": [
|
|
17
20
|
"mcp",
|
|
@@ -20,12 +23,19 @@
|
|
|
20
23
|
"web3",
|
|
21
24
|
"defi",
|
|
22
25
|
"agent",
|
|
23
|
-
"ai"
|
|
26
|
+
"ai",
|
|
27
|
+
"openclaw",
|
|
28
|
+
"sse"
|
|
24
29
|
],
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/PaulieB14/subgraph-registry.git"
|
|
33
|
+
},
|
|
25
34
|
"author": "PaulieB14",
|
|
26
35
|
"license": "MIT",
|
|
27
36
|
"dependencies": {
|
|
28
37
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
29
|
-
"better-sqlite3": "^11.8.2"
|
|
38
|
+
"better-sqlite3": "^11.8.2",
|
|
39
|
+
"express": "^4.21.0"
|
|
30
40
|
}
|
|
31
41
|
}
|
package/src/index.js
CHANGED
|
@@ -15,11 +15,13 @@
|
|
|
15
15
|
|
|
16
16
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
17
17
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
18
|
+
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
|
18
19
|
import {
|
|
19
20
|
CallToolRequestSchema,
|
|
20
21
|
ListToolsRequestSchema,
|
|
21
22
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
22
23
|
import Database from "better-sqlite3";
|
|
24
|
+
import express from "express";
|
|
23
25
|
import { fileURLToPath } from "url";
|
|
24
26
|
import { dirname, join } from "path";
|
|
25
27
|
import { existsSync, mkdirSync, writeFileSync } from "fs";
|
|
@@ -374,11 +376,9 @@ const HANDLERS = {
|
|
|
374
376
|
list_registry_stats: listRegistryStats,
|
|
375
377
|
};
|
|
376
378
|
|
|
377
|
-
|
|
378
|
-
await ensureDb();
|
|
379
|
-
|
|
379
|
+
function createServer() {
|
|
380
380
|
const server = new Server(
|
|
381
|
-
{ name: "subgraph-registry", version: "0.
|
|
381
|
+
{ name: "subgraph-registry", version: "0.3.0" },
|
|
382
382
|
{ capabilities: { tools: {} } }
|
|
383
383
|
);
|
|
384
384
|
|
|
@@ -408,9 +408,70 @@ async function main() {
|
|
|
408
408
|
}
|
|
409
409
|
});
|
|
410
410
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
411
|
+
return server;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// ── SSE/HTTP Transport (OpenClaw + remote agents) ──────────
|
|
415
|
+
|
|
416
|
+
function startHttpTransport(port) {
|
|
417
|
+
const app = express();
|
|
418
|
+
const sessions = new Map();
|
|
419
|
+
|
|
420
|
+
app.get("/sse", async (req, res) => {
|
|
421
|
+
const transport = new SSEServerTransport("/messages", res);
|
|
422
|
+
sessions.set(transport.sessionId, transport);
|
|
423
|
+
|
|
424
|
+
const server = createServer();
|
|
425
|
+
|
|
426
|
+
res.on("close", () => {
|
|
427
|
+
sessions.delete(transport.sessionId);
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
await server.connect(transport);
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
app.post("/messages", async (req, res) => {
|
|
434
|
+
const sessionId = req.query.sessionId;
|
|
435
|
+
const transport = sessions.get(sessionId);
|
|
436
|
+
if (!transport) {
|
|
437
|
+
res.status(400).json({ error: "Invalid or expired session" });
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
await transport.handlePostMessage(req, res);
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
app.get("/health", (_req, res) => {
|
|
444
|
+
res.json({ status: "ok", subgraphs: getDb().prepare("SELECT COUNT(*) as c FROM subgraphs").get().c });
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
app.listen(port, () => {
|
|
448
|
+
console.error(`SSE transport listening on http://localhost:${port}/sse`);
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
// ── Entry Point ────────────────────────────────────────────
|
|
453
|
+
|
|
454
|
+
async function main() {
|
|
455
|
+
await ensureDb();
|
|
456
|
+
|
|
457
|
+
const subgraphCount = getDb().prepare("SELECT COUNT(*) as c FROM subgraphs").get().c;
|
|
458
|
+
const httpPort = process.env.MCP_HTTP_PORT || (process.argv.includes("--http") ? "3848" : null);
|
|
459
|
+
const httpOnly = process.argv.includes("--http-only");
|
|
460
|
+
|
|
461
|
+
// Start SSE/HTTP transport if requested
|
|
462
|
+
if (httpPort || httpOnly) {
|
|
463
|
+
const port = parseInt(httpPort || "3848", 10);
|
|
464
|
+
startHttpTransport(port);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// Start stdio transport (default, skip if --http-only)
|
|
468
|
+
if (!httpOnly) {
|
|
469
|
+
const server = createServer();
|
|
470
|
+
const transport = new StdioServerTransport();
|
|
471
|
+
await server.connect(transport);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
console.error(`Subgraph Registry MCP server running (${subgraphCount} subgraphs)`);
|
|
414
475
|
}
|
|
415
476
|
|
|
416
477
|
main().catch((err) => {
|