subgraph-registry-mcp 0.2.3 → 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/README.md +47 -3
- package/package.json +9 -4
- package/src/index.js +68 -7
package/README.md
CHANGED
|
@@ -96,10 +96,15 @@ classifier.py - rule-based domain/protocol classification + schema fingerprintin
|
|
|
96
96
|
registry.py --- builds JSON registry + SQLite + indices
|
|
97
97
|
|
|
|
98
98
|
v
|
|
99
|
-
server.py ----- FastAPI REST API with /recommend endpoint
|
|
99
|
+
server.py ----- FastAPI REST API with /recommend endpoint (:3847)
|
|
100
100
|
|
|
|
101
101
|
v
|
|
102
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)
|
|
103
108
|
```
|
|
104
109
|
|
|
105
110
|
## Output
|
|
@@ -143,7 +148,9 @@ All values are log-scaled and capped at 1.0. Usage signals (fees + volume) are w
|
|
|
143
148
|
|
|
144
149
|
## MCP Server
|
|
145
150
|
|
|
146
|
-
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:
|
|
147
154
|
|
|
148
155
|
- **search_subgraphs** — filter by domain, network, protocol type, entity, or keyword
|
|
149
156
|
- **recommend_subgraph** — natural language goal to best subgraphs
|
|
@@ -156,7 +163,7 @@ The registry is available as an MCP server for agent integration. It exposes 4 t
|
|
|
156
163
|
npx subgraph-registry-mcp
|
|
157
164
|
```
|
|
158
165
|
|
|
159
|
-
### Add to Claude Desktop
|
|
166
|
+
### Add to Claude Desktop (stdio)
|
|
160
167
|
|
|
161
168
|
```json
|
|
162
169
|
{
|
|
@@ -169,6 +176,43 @@ npx subgraph-registry-mcp
|
|
|
169
176
|
}
|
|
170
177
|
```
|
|
171
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
|
+
|
|
172
216
|
The server auto-downloads the pre-built registry (8MB SQLite) from GitHub on first run — no local build needed.
|
|
173
217
|
|
|
174
218
|
## How It Stays Current
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "subgraph-registry-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"mcpName": "io.github.PaulieB14/subgraph-registry-mcp",
|
|
5
5
|
"description": "MCP server for agent-friendly subgraph discovery on The Graph Network. 15,500+ classified subgraphs with reliability scoring.",
|
|
6
6
|
"type": "module",
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"data/registry.db"
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
|
-
"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"
|
|
16
18
|
},
|
|
17
19
|
"keywords": [
|
|
18
20
|
"mcp",
|
|
@@ -21,7 +23,9 @@
|
|
|
21
23
|
"web3",
|
|
22
24
|
"defi",
|
|
23
25
|
"agent",
|
|
24
|
-
"ai"
|
|
26
|
+
"ai",
|
|
27
|
+
"openclaw",
|
|
28
|
+
"sse"
|
|
25
29
|
],
|
|
26
30
|
"repository": {
|
|
27
31
|
"type": "git",
|
|
@@ -31,6 +35,7 @@
|
|
|
31
35
|
"license": "MIT",
|
|
32
36
|
"dependencies": {
|
|
33
37
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
34
|
-
"better-sqlite3": "^11.8.2"
|
|
38
|
+
"better-sqlite3": "^11.8.2",
|
|
39
|
+
"express": "^4.21.0"
|
|
35
40
|
}
|
|
36
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) => {
|