@telegraphprotocol/telegraph-protocol-mcp 1.0.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.
Files changed (52) hide show
  1. package/.agents/skills/telegraph/SKILL.md +151 -0
  2. package/LICENSE +21 -0
  3. package/README.md +399 -0
  4. package/dist/client.d.ts +6 -0
  5. package/dist/client.d.ts.map +1 -0
  6. package/dist/client.js +116 -0
  7. package/dist/client.js.map +1 -0
  8. package/dist/config.d.ts +3 -0
  9. package/dist/config.d.ts.map +1 -0
  10. package/dist/config.js +25 -0
  11. package/dist/config.js.map +1 -0
  12. package/dist/discovery.d.ts +3 -0
  13. package/dist/discovery.d.ts.map +1 -0
  14. package/dist/discovery.js +16 -0
  15. package/dist/discovery.js.map +1 -0
  16. package/dist/index.d.ts +3 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +60 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/schema.d.ts +3 -0
  21. package/dist/schema.d.ts.map +1 -0
  22. package/dist/schema.js +84 -0
  23. package/dist/schema.js.map +1 -0
  24. package/dist/tools/daemon.d.ts +4 -0
  25. package/dist/tools/daemon.d.ts.map +1 -0
  26. package/dist/tools/daemon.js +82 -0
  27. package/dist/tools/daemon.js.map +1 -0
  28. package/dist/tools/engine.d.ts +5 -0
  29. package/dist/tools/engine.d.ts.map +1 -0
  30. package/dist/tools/engine.js +83 -0
  31. package/dist/tools/engine.js.map +1 -0
  32. package/dist/tools/node.d.ts +4 -0
  33. package/dist/tools/node.d.ts.map +1 -0
  34. package/dist/tools/node.js +88 -0
  35. package/dist/tools/node.js.map +1 -0
  36. package/dist/tools/subnets.d.ts +10 -0
  37. package/dist/tools/subnets.d.ts.map +1 -0
  38. package/dist/tools/subnets.js +114 -0
  39. package/dist/tools/subnets.js.map +1 -0
  40. package/dist/transport.d.ts +4 -0
  41. package/dist/transport.d.ts.map +1 -0
  42. package/dist/transport.js +17 -0
  43. package/dist/transport.js.map +1 -0
  44. package/dist/types.d.ts +71 -0
  45. package/dist/types.d.ts.map +1 -0
  46. package/dist/types.js +2 -0
  47. package/dist/types.js.map +1 -0
  48. package/dist/x402.d.ts +3 -0
  49. package/dist/x402.d.ts.map +1 -0
  50. package/dist/x402.js +61 -0
  51. package/dist/x402.js.map +1 -0
  52. package/package.json +66 -0
@@ -0,0 +1,151 @@
1
+ ---
2
+ name: telegraph
3
+ description: Use Telegraph Protocol for verified AI inference. Activate when the user asks for weather forecasts or climate data; deepfake or AI-content detection; LLM completions, image generation, or embeddings via a decentralized network; AI text detection; autonomous signal monitoring across categories like POLITICS, TECHNOLOGY, CLIMATE, HEALTH, ECONOMICS, or GEOPOLITICS; or any task where the user explicitly wants to route inference through the Telegraph network or pay via x402 USDC micropayments. Requires the Telegraph MCP server running with a USDC-funded EVM or Solana wallet.
4
+ license: MIT
5
+ metadata:
6
+ version: 1.0.0
7
+ homepage: https://github.com/telegraphprotocol/telegraph-mcp
8
+ documentation: https://docs.telegraphprotocol.com
9
+ keywords: [ai-inference, x402, bittensor, mcp, usdc, deepfake-detection, weather, llm, web3, agent-payments]
10
+ ---
11
+
12
+ # Telegraph Protocol
13
+
14
+ Telegraph is a permissionless marketplace for verifiable AI inference. Agents pay USDC per request. Miners — which can be Bittensor subnets, OpenAI, open-source models, or any AI API — compete to supply answers. A decentralized validator mesh grades responses using zkTLS-verified ground truth and WASM scoring scripts, reaches BFT consensus, and delivers a cryptographically finalized result.
15
+
16
+ The native token is **MACHINA**. Every USDC paid for inference flows through an open-market TWAP to buy MACHINA for the miner — demand for intelligence directly drives demand for the token.
17
+
18
+ ---
19
+
20
+ ## MCP Tool Reference
21
+
22
+ ### Free tools (no payment)
23
+
24
+ | Tool | Purpose |
25
+ |------|---------|
26
+ | `tg_node_list_subnets` | Full miner catalog — IDs, slugs, endpoints, input/output schemas |
27
+ | `tg_node_subnets_health` | Health status of all miner integrations |
28
+ | `tg_node_status` | Node identity, public key, chain info |
29
+ | `tg_engine_list_subnets` | Engine's view of available miners with capabilities and cost |
30
+ | `tg_daemon_categories` | Signal categories in the Daemon database (POLITICS, CLIMATE, TECHNOLOGY, …) |
31
+ | `tg_daemon_questions` | Query the Daemon's stored signals — filterable by category, source, time, interest |
32
+ | `tg_daemon_health` | Daemon health check |
33
+
34
+ > The `subnet` in some tool names is legacy — every provider is a **miner** today, whether a Bittensor subnet, a hosted model, or a private API.
35
+
36
+ ### Paid tools (x402 USDC per call)
37
+
38
+ | Tool | Purpose |
39
+ |------|---------|
40
+ | `tg_engine_ask` | Auto-routed inference — Engine's LLM router selects the best miner for your query |
41
+ | `tg_engine_ask_subnet` | Direct inference to a specific miner by ID |
42
+ | Dynamic tools (auto-discovered) | Per-miner tools generated from the live integration registry (see below) |
43
+
44
+ ---
45
+
46
+ ## Access Modes
47
+
48
+ ### 1. Auto-routed inference (recommended)
49
+ The Engine classifies your natural language query into an Intent and routes to the highest-ranked miner for that task:
50
+
51
+ ```
52
+ tg_engine_ask(query="7-day weather forecast for Dubai")
53
+ tg_engine_ask(query="Is this image AI-generated?")
54
+ tg_engine_ask(query="Summarize the latest clinical trial results for GLP-1 drugs")
55
+ ```
56
+
57
+ The response includes `routing.reasoning` — which subnet was chosen and why.
58
+
59
+ ### 2. Direct miner inference
60
+ Route to a specific miner when you know exactly what you want:
61
+
62
+ ```
63
+ tg_engine_ask_subnet(subnet_id="18", method="GET", endpoint="/predict", payload={lat: 25.2, lon: 55.3, variable: "hourly"})
64
+ tg_engine_ask_subnet(subnet_id="34", method="POST", endpoint="/", payload={image_url: "https://..."})
65
+ tg_engine_ask_subnet(subnet_id="102", method="POST", endpoint="/chat", payload={model: "gpt-4o-mini", messages: [...]})
66
+ ```
67
+
68
+ ### 3. Daemon signal feed (free reads)
69
+ The Daemon runs autonomously every 3 hours — collecting data from registered sources (weather APIs, market feeds, news and social feeds), routing questions through miners, and storing verified results. Reading these is free:
70
+
71
+ ```
72
+ tg_daemon_categories()
73
+ # → live list of categories with current counts
74
+
75
+ tg_daemon_questions(category="CLIMATE", limit=10)
76
+ tg_daemon_questions(category="TECHNOLOGY", sort="interest", min_interest=5)
77
+ tg_daemon_questions(source="polymarket", since_hours=24)
78
+ ```
79
+
80
+ ### 4. Dynamic miner tools (auto-discovered)
81
+ On startup, the MCP server fetches the live integration registry and generates per-endpoint tools for every active miner. These update every 5 minutes without restart. The live set changes on-chain — treat the table below as a snapshot, not the source of truth:
82
+
83
+ | Tool (auto-generated) | Miner | Capability |
84
+ |-----------------------|-------|-----------|
85
+ | `tg_zeus_predict` | Zeus (18) | Weather forecast |
86
+ | `tg_itsai_text_detector_detect` | ItsAI (32) | AI text detection |
87
+ | `tg_sapling_ai_detector_detect` | Sapling (33) | AI content detection |
88
+ | `tg_bitmind_detect_image` | BitMind (34) | Deepfake image detection |
89
+ | `tg_bitmind_detect_video` | BitMind (34) | Deepfake video detection |
90
+ | `tg_openai_chat` | OpenAI (102) | LLM chat |
91
+ | `tg_openai_images_generate` | OpenAI (102) | Image generation |
92
+ | `tg_openai_embed` | OpenAI (102) | Text embeddings |
93
+ | `tg_openai_moderate` | OpenAI (102) | Content moderation |
94
+
95
+ Use `tg_node_list_subnets` to see the current live catalog with full schemas.
96
+
97
+ ---
98
+
99
+ ## Active Intents
100
+
101
+ The Engine's LLM router maps queries to canonical Intents:
102
+
103
+ | Category | Intents |
104
+ |----------|---------|
105
+ | Language | `LANGUAGE_GENERATION`, `CHAT_COMPLETION`, `TEXT_GENERATION`, `HIGH_PERFORMANCE_INFERENCE`, `EMBEDDINGS`, `CONTENT_MODERATION` |
106
+ | Weather | `WEATHER_CHECK`, `WEATHER_FORECAST`, `STORM_ALERT`, `WEATHER_RISK_ASSESSMENT` |
107
+ | Vision | `MULTIMODAL_INFERENCE`, `IMAGE_GENERATION`, `TEXT_TO_IMAGE` |
108
+ | Search | `WEB_SEARCH`, `TWITTER_SEARCH`, `NEWS_SEARCH`, `RESEARCH_SYNTHESIS`, `FACT_CHECK` |
109
+ | Authenticity | `DEEPFAKE_DETECTION`, `MEDIA_AUTHENTICITY_CHECK`, `AI_TEXT_DETECTION`, `TEXT_AUTHENTICITY_CHECK`, `IMAGE_VERIFICATION`, `VIDEO_VERIFICATION` |
110
+ | Tasks | `TASK_COMPLETION`, `AGENT_TASK` |
111
+
112
+ ---
113
+
114
+ ## Payments
115
+
116
+ All paid calls use **x402** — an HTTP-native micropayment protocol. The MCP server handles the full flow transparently: receives the 402 challenge, signs the USDC transfer using your configured private key, and retries. The agent never sees the payment step.
117
+
118
+ - **Network**: Base Sepolia (testnet) — USDC `0x036CbD53842c5426634e7929541eC2318f3dCF7e`
119
+ - **Typical cost**: $0.01 – $0.05 per inference call
120
+ - **Pricing**: miner's floor price × demand multiplier (rises with 24h request volume for the Intent)
121
+ - **Use a burner wallet** — fund with only the USDC you need; never use a main wallet
122
+
123
+ ---
124
+
125
+ ## Setup
126
+
127
+ 1. Clone and build:
128
+ ```bash
129
+ git clone https://github.com/telegraphprotocol/telegraph-mcp
130
+ cd telegraph-mcp && npm install && npm run build
131
+ ```
132
+
133
+ 2. Add to your MCP client config (Claude Desktop, Cursor, etc.):
134
+ ```json
135
+ {
136
+ "mcpServers": {
137
+ "telegraph": {
138
+ "command": "node",
139
+ "args": ["/path/to/Telegraph-MCP/dist/index.js"],
140
+ "env": {
141
+ "TELEGRAPH_NODE_URL": "http://13.237.89.59:7044",
142
+ "TELEGRAPH_ENGINE_URL": "http://13.237.89.59:8080",
143
+ "TELEGRAPH_DAEMON_URL": "http://13.237.89.59:8081",
144
+ "TELEGRAPH_EVM_PRIVATE_KEY": "0xyour_burner_wallet_key"
145
+ }
146
+ }
147
+ }
148
+ }
149
+ ```
150
+
151
+ Full integration guides for Claude Desktop, Cursor, ElizaOS, LangChain, Goose, and others are in the [README](https://github.com/telegraphprotocol/telegraph-mcp#readme).
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Telegraph Protocol
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 ADDED
@@ -0,0 +1,399 @@
1
+ # @telegraph/mcp-server
2
+
3
+ MCP server exposing [Telegraph Protocol](https://github.com/telegraphprotocol/Telegraph) AI inference APIs as tools with automatic x402 micropayments.
4
+
5
+ Connects any MCP-compatible agent (Claude Desktop, Cursor, ElizaOS, LangChain, OpenClaw, Goose, etc.) to Telegraph's network of AI miners — weather forecasting, deepfake detection, LLM inference, AI-text detection, signal monitoring — with zero crypto code in the agent. The MCP server handles private key custody, payment signing, and transaction settlement internally.
6
+
7
+ > Miners can be Bittensor subnets, hosted models, or any private API integrated via YAML. Some tool and field names still say `subnet` for legacy reasons — read it as "miner".
8
+
9
+ ## Quick Start
10
+
11
+ ### Option A — npx (no clone, recommended once published)
12
+
13
+ ```bash
14
+ TELEGRAPH_NODE_URL=http://13.237.89.59:7044 \
15
+ TELEGRAPH_ENGINE_URL=http://13.237.89.59:8080 \
16
+ TELEGRAPH_DAEMON_URL=http://13.237.89.59:8081 \
17
+ TELEGRAPH_EVM_PRIVATE_KEY=0xyour_key_here \
18
+ npx -y telegraph-protocol-mcp
19
+ ```
20
+
21
+ ### Option B — from source
22
+
23
+ ```bash
24
+ # 1. Clone and enter
25
+ git clone https://github.com/telegraphprotocol/telegraph-mcp
26
+ cd telegraph-mcp
27
+
28
+ # 2. Copy and edit .env
29
+ cp .env.example .env
30
+ # Edit: set TELEGRAPH_EVM_PRIVATE_KEY=0xyour_key_here
31
+
32
+ # 3. Install and build
33
+ npm install && npm run build
34
+
35
+ # 4. Run
36
+ npm start
37
+ ```
38
+
39
+ > Published to npm as [`telegraph-protocol-mcp`](https://www.npmjs.com/package/telegraph-protocol-mcp) and listed on the [MCP Registry](https://registry.modelcontextprotocol.io) as `io.github.telegraphprotocol/telegraph`. Maintainers: see [PUBLISHING.md](./PUBLISHING.md).
40
+
41
+ ## Architecture
42
+
43
+ ```
44
+ Agent (Claude / Cursor / Eliza / etc.)
45
+ │
46
+ │ MCP protocol (JSON-RPC over stdio)
47
+ │
48
+ ┌──────▼─────────────────────────────────────────┐
49
+ │ Telegraph MCP Server (runs locally) │
50
+ │ │
51
+ │ ┌─────────┐ ┌──────────┐ ┌───────────────┐ │
52
+ │ │ Node │ │ Engine │ │ Daemon │ │
53
+ │ │ :7044 │ │ :8080 │ │ :8081 │ │
54
+ │ ├─────────┤ ├──────────┤ ├───────────────┤ │
55
+ │ │ Status │ │ Subnets │ │ Health │ │
56
+ │ │ Health │ │ Ask │ │ Categories │ │
57
+ │ │ Subnets │ │ Direct │ │ Questions │ │
58
+ │ │ Dynamic │ │ │ │ │ │
59
+ │ └─────────┘ └──────────┘ └───────────────┘ │
60
+ │ │
61
+ │ X402 payment handled transparently: │
62
+ │ request → 402 → sign EIP-3009 → retry │
63
+ └─────────────────────────────────────────────────┘
64
+ ```
65
+
66
+ ## Configuration
67
+
68
+ All via environment variables (`.env` file or inline):
69
+
70
+ | Variable | Required | Default | Description |
71
+ |----------|----------|---------|-------------|
72
+ | `TELEGRAPH_NODE_URL` | Yes | `http://localhost:7044` | Telegraph node URL |
73
+ | `TELEGRAPH_ENGINE_URL` | Yes | `http://localhost:8080` | Engine server URL |
74
+ | `TELEGRAPH_DAEMON_URL` | Yes | `http://localhost:8081` | Daemon API URL |
75
+ | `TELEGRAPH_EVM_PRIVATE_KEY` | Yes* | — | EVM private key (`0x`-prefixed hex) |
76
+ | `TELEGRAPH_SOLANA_PRIVATE_KEY` | No* | — | Solana private key (base58) |
77
+ | `EVM_NETWORK` | No | `eip155:*` | EVM CAIP-2 network |
78
+ | `SVM_NETWORK` | No | `solana:*` | Solana CAIP-2 network |
79
+ | `REFRESH_INTERVAL_MS` | No | `300000` | Miner-tool refresh interval (ms). 0 to disable. |
80
+
81
+ *At least one private key required.
82
+
83
+ ## Available Tools
84
+
85
+ ### Node Tools (no payment)
86
+ | Tool | Description |
87
+ |------|-------------|
88
+ | `tg_node_status` | Node status, public key, chain info |
89
+ | `tg_node_subnets_health` | Miner integration health check |
90
+ | `tg_node_list_subnets` | Full miner catalog with metadata, schemas, endpoints |
91
+
92
+ ### Engine Tools
93
+ | Tool | Payment | Description |
94
+ |------|---------|-------------|
95
+ | `tg_engine_list_subnets` | Free | List the miners the Engine can route to |
96
+ | `tg_engine_ask` | x402 | Auto-routed inference (LLM picks the best miner for your query) |
97
+ | `tg_engine_ask_subnet` | x402 | Direct inference through a specific miner by ID |
98
+
99
+ ### Daemon Tools (no payment)
100
+ | Tool | Description |
101
+ |------|-------------|
102
+ | `tg_daemon_health` | Daemon health check |
103
+ | `tg_daemon_categories` | Signal categories (POLITICS, ECONOMICS, TECHNOLOGY, CLIMATE, HEALTH, CRYPTO, SPORTS, …) |
104
+ | `tg_daemon_questions` | Query collected signals with filters (category, source, time, interest) |
105
+
106
+ ### Dynamic Miner Tools (auto-discovered, x402 payment)
107
+ Tools for each miner endpoint are auto-generated from the Telegraph node's live integration registry. The live set changes on-chain, so treat this as a snapshot, not the source of truth (call `tg_node_list_subnets` for the current catalog):
108
+
109
+ | Miner | Tools |
110
+ |--------|-------|
111
+ | **Zeus (18)** — Weather | `tg_zeus_predict` |
112
+ | **ItsAI (32)** — AI text detection | `tg_itsai_text_detector_detect` |
113
+ | **Sapling (33)** — AI content detection | `tg_sapling_ai_detector_detect` |
114
+ | **BitMind (34)** — Deepfake | `tg_bitmind_detect_image`, `tg_bitmind_detect_video`, `tg_bitmind_preprocess_video`, `tg_bitmind_get_video_upload_url` |
115
+ | **OpenAI (102)** — LLM / images | `tg_openai_chat`, `tg_openai_responses`, `tg_openai_embed`, `tg_openai_images_generate`, `tg_openai_moderate` |
116
+
117
+ **These update automatically.** New miners registered on-chain appear within 5 minutes. Deregistered miners are cleaned up. The agent always sees only currently valid tools.
118
+
119
+ > Some tool and field names contain `subnet` for legacy reasons — Telegraph began by integrating Bittensor subnets. Today a **miner** is any provider integrated via YAML, subnet or not.
120
+
121
+ ## How x402 Payments Work
122
+
123
+ When an agent calls a paid tool (e.g., `tg_engine_ask`):
124
+
125
+ 1. MCP server sends request to Telegraph
126
+ 2. Telegraph returns HTTP 402 with payment requirements in response header
127
+ 3. `@x402/fetch` intercepts the 402, signs an EIP-3009 `TransferWithAuthorization` using your private key, attaches the signature as a `PAYMENT` header, and retries
128
+ 4. Telegraph verifies the payment on-chain via the PayAI facilitator and returns the result
129
+
130
+ **The agent and LLM never see the payment flow, private key, or blockchain transaction.** It's fully transparent — the agent just sees a tool that returns results.
131
+
132
+ ## Integration Guides
133
+
134
+ ### Claude Desktop
135
+
136
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows).
137
+
138
+ Using npx (simplest — no clone or build):
139
+
140
+ ```json
141
+ {
142
+ "mcpServers": {
143
+ "telegraph": {
144
+ "command": "npx",
145
+ "args": ["-y", "telegraph-protocol-mcp"],
146
+ "env": {
147
+ "TELEGRAPH_NODE_URL": "http://13.237.89.59:7044",
148
+ "TELEGRAPH_ENGINE_URL": "http://13.237.89.59:8080",
149
+ "TELEGRAPH_DAEMON_URL": "http://13.237.89.59:8081",
150
+ "TELEGRAPH_EVM_PRIVATE_KEY": "0xyour_key_here"
151
+ }
152
+ }
153
+ }
154
+ }
155
+ ```
156
+
157
+ Or pointing at a local build:
158
+
159
+ ```json
160
+ {
161
+ "mcpServers": {
162
+ "telegraph": {
163
+ "command": "node",
164
+ "args": ["/path/to/telegraph-mcp/dist/index.js"],
165
+ "env": {
166
+ "TELEGRAPH_NODE_URL": "http://13.237.89.59:7044",
167
+ "TELEGRAPH_ENGINE_URL": "http://13.237.89.59:8080",
168
+ "TELEGRAPH_DAEMON_URL": "http://13.237.89.59:8081",
169
+ "TELEGRAPH_EVM_PRIVATE_KEY": "0xyour_key_here"
170
+ }
171
+ }
172
+ }
173
+ }
174
+ ```
175
+
176
+ Restart Claude Desktop. The Telegraph tools will appear in the tool list. Try asking *"What's the weather in Lahore?"* or *"Use the Telegraph engine to explain what Bitcoin is."*
177
+
178
+ ### Cursor
179
+
180
+ Add to Cursor Settings → MCP → Add new MCP server:
181
+
182
+ ```json
183
+ {
184
+ "mcpServers": {
185
+ "telegraph": {
186
+ "command": "node",
187
+ "args": ["/path/to/telegraph-mcp/dist/index.js"],
188
+ "env": {
189
+ "TELEGRAPH_NODE_URL": "http://13.237.89.59:7044",
190
+ "TELEGRAPH_ENGINE_URL": "http://13.237.89.59:8080",
191
+ "TELEGRAPH_DAEMON_URL": "http://13.237.89.59:8081",
192
+ "TELEGRAPH_EVM_PRIVATE_KEY": "0xyour_key_here"
193
+ }
194
+ }
195
+ }
196
+ }
197
+ ```
198
+
199
+ ### ElizaOS
200
+
201
+ In your Eliza character file or MCP plugin config:
202
+
203
+ ```json
204
+ {
205
+ "mcp": {
206
+ "telegraph": {
207
+ "command": "node",
208
+ "args": ["/path/to/telegraph-mcp/dist/index.js"],
209
+ "env": {
210
+ "TELEGRAPH_NODE_URL": "http://13.237.89.59:7044",
211
+ "TELEGRAPH_ENGINE_URL": "http://13.237.89.59:8080",
212
+ "TELEGRAPH_DAEMON_URL": "http://13.237.89.59:8081",
213
+ "TELEGRAPH_EVM_PRIVATE_KEY": "0xyour_key_here"
214
+ }
215
+ }
216
+ }
217
+ }
218
+ ```
219
+
220
+ ElizaOS v0.25+ supports MCP via the `@elizaos/plugin-mcp` package. Enable it in your character's plugin list:
221
+
222
+ ```json
223
+ {
224
+ "plugins": ["@elizaos/plugin-mcp"]
225
+ }
226
+ ```
227
+
228
+ ### LangChain / LangGraph
229
+
230
+ LangChain supports MCP through `langchain-mcp-adapters`:
231
+
232
+ ```bash
233
+ pip install langchain-mcp-adapters
234
+ ```
235
+
236
+ ```python
237
+ from langchain_mcp_adapters.client import MultiServerMCPClient
238
+
239
+ client = MultiServerMCPClient({
240
+ "telegraph": {
241
+ "command": "node",
242
+ "args": ["/path/to/telegraph-mcp/dist/index.js"],
243
+ "env": {
244
+ "TELEGRAPH_NODE_URL": "http://13.237.89.59:7044",
245
+ "TELEGRAPH_ENGINE_URL": "http://13.237.89.59:8080",
246
+ "TELEGRAPH_DAEMON_URL": "http://13.237.89.59:8081",
247
+ "TELEGRAPH_EVM_PRIVATE_KEY": "0xyour_key_here",
248
+ },
249
+ "transport": "stdio",
250
+ }
251
+ })
252
+
253
+ tools = client.get_tools()
254
+ # Use tools with your LangChain agent
255
+ ```
256
+
257
+ TypeScript/Node.js:
258
+
259
+ ```bash
260
+ npm install @langchain/mcp-adapters
261
+ ```
262
+
263
+ ```typescript
264
+ import { MultiServerMCPClient } from "@langchain/mcp-adapters";
265
+
266
+ const client = new MultiServerMCPClient({
267
+ telegraph: {
268
+ command: "node",
269
+ args: ["/path/to/telegraph-mcp/dist/index.js"],
270
+ env: {
271
+ TELEGRAPH_NODE_URL: "http://13.237.89.59:7044",
272
+ TELEGRAPH_ENGINE_URL: "http://13.237.89.59:8080",
273
+ TELEGRAPH_DAEMON_URL: "http://13.237.89.59:8081",
274
+ TELEGRAPH_EVM_PRIVATE_KEY: "0xyour_key_here",
275
+ },
276
+ transport: "stdio",
277
+ },
278
+ });
279
+
280
+ const tools = await client.getTools();
281
+ ```
282
+
283
+ ### OpenClaw
284
+
285
+ OpenClaw natively supports MCP via configuration. Add to `openclaw.config.json`:
286
+
287
+ ```json
288
+ {
289
+ "mcpServers": {
290
+ "telegraph": {
291
+ "type": "stdio",
292
+ "command": "node",
293
+ "args": ["/path/to/telegraph-mcp/dist/index.js"],
294
+ "env": {
295
+ "TELEGRAPH_NODE_URL": "http://13.237.89.59:7044",
296
+ "TELEGRAPH_ENGINE_URL": "http://13.237.89.59:8080",
297
+ "TELEGRAPH_DAEMON_URL": "http://13.237.89.59:8081",
298
+ "TELEGRAPH_EVM_PRIVATE_KEY": "0xyour_key_here"
299
+ }
300
+ }
301
+ }
302
+ }
303
+ ```
304
+
305
+ ### Goose
306
+
307
+ Goose supports MCP servers through its extensions system. Configuration in `~/.config/goose/config.yaml`:
308
+
309
+ ```yaml
310
+ extensions:
311
+ telegraph:
312
+ type: mcp
313
+ command: node
314
+ args:
315
+ - /path/to/telegraph-mcp/dist/index.js
316
+ env:
317
+ TELEGRAPH_NODE_URL: http://13.237.89.59:7044
318
+ TELEGRAPH_ENGINE_URL: http://13.237.89.59:8080
319
+ TELEGRAPH_DAEMON_URL: http://13.237.89.59:8081
320
+ TELEGRAPH_EVM_PRIVATE_KEY: 0xyour_key_here
321
+ ```
322
+
323
+ ### VS Code / Continue
324
+
325
+ In Continue's `config.json`:
326
+
327
+ ```json
328
+ {
329
+ "experimental": {
330
+ "modelContextProtocolServers": [
331
+ {
332
+ "transport": {
333
+ "type": "stdio",
334
+ "command": "node",
335
+ "args": ["/path/to/telegraph-mcp/dist/index.js"],
336
+ "env": {
337
+ "TELEGRAPH_NODE_URL": "http://13.237.89.59:7044",
338
+ "TELEGRAPH_ENGINE_URL": "http://13.237.89.59:8080",
339
+ "TELEGRAPH_DAEMON_URL": "http://13.237.89.59:8081",
340
+ "TELEGRAPH_EVM_PRIVATE_KEY": "0xyour_key_here"
341
+ }
342
+ }
343
+ }
344
+ ]
345
+ }
346
+ }
347
+ ```
348
+
349
+ ### Generic / Any MCP Client
350
+
351
+ The server uses **MCP stdio transport** — the standard for local MCP servers. Any client that supports the MCP protocol over stdio can use it:
352
+
353
+ ```json
354
+ {
355
+ "mcpServers": {
356
+ "telegraph": {
357
+ "command": "node",
358
+ "args": ["/path/to/telegraph-mcp/dist/index.js"],
359
+ "env": {
360
+ "TELEGRAPH_NODE_URL": "http://13.237.89.59:7044",
361
+ "TELEGRAPH_ENGINE_URL": "http://13.237.89.59:8080",
362
+ "TELEGRAPH_DAEMON_URL": "http://13.237.89.59:8081",
363
+ "TELEGRAPH_EVM_PRIVATE_KEY": "0xyour_key_here"
364
+ }
365
+ }
366
+ }
367
+ }
368
+ ```
369
+
370
+ ## Dynamic Tool Discovery
371
+
372
+ Subnet tools are **not hardcoded**. On startup and every 5 minutes:
373
+
374
+ 1. Fetches live integrations from `GET /miner-dispatcher/integrations` on the Telegraph node
375
+ 2. Diffs against currently registered tools
376
+ 3. Adds new subnets → auto-registers tools
377
+ 4. Removes stale subnets → deletes tools
378
+ 5. Sends `notifications/tools/list_changed` to connected clients
379
+
380
+ This means:
381
+ - **New subnets** appear automatically within 5 minutes of on-chain registration — no MCP restart needed
382
+ - **Removed subnets** are cleaned up — agents won't call non-existent tools
383
+ - **Agents always have an accurate view** of what's available on the network
384
+
385
+ ## Security
386
+
387
+ - **Use a burner wallet.** Never use your main wallet. Fund with only the USDC needed for inference.
388
+ - **The private key stays in the MCP process.** Never exposed to the agent or LLM.
389
+ - **The MCP server runs locally** over stdio — no network exposure.
390
+ - Payments are per-call: typically $0.01 per inference request.
391
+
392
+ ## Development
393
+
394
+ ```bash
395
+ npm install # Install deps
396
+ npm run build # Compile TypeScript
397
+ npm run dev # Dev mode with tsx (hot reload)
398
+ npx @modelcontextprotocol/inspector dist/index.js # Inspect tools
399
+ ```
@@ -0,0 +1,6 @@
1
+ import type { Endpoint } from "./types.js";
2
+ export type PaymentFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
3
+ export declare function callSubnet(fetchWithPayment: PaymentFetch, nodeUrl: string, subnetId: string, endpoint: Endpoint, params: Record<string, unknown>): Promise<unknown>;
4
+ export declare function callEngine(fetchWithPayment: PaymentFetch, engineUrl: string, path: string, method: string, body?: unknown): Promise<unknown>;
5
+ export declare function callDaemon(daemonUrl: string, path: string, queryParams?: Record<string, string>): Promise<unknown>;
6
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE/F,wBAAsB,UAAU,CAC9B,gBAAgB,EAAE,YAAY,EAC9B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,OAAO,CAAC,CAuElB;AAED,wBAAsB,UAAU,CAC9B,gBAAgB,EAAE,YAAY,EAC9B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,OAAO,GACb,OAAO,CAAC,OAAO,CAAC,CAgClB;AAED,wBAAsB,UAAU,CAC9B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC,OAAO,CAAC,OAAO,CAAC,CAwBlB"}