@telegraphprotocol/telegraph-protocol-mcp 1.0.0 → 2.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 (87) hide show
  1. package/.agents/skills/telegraph/SKILL.md +47 -129
  2. package/README.md +66 -366
  3. package/dist/chain.d.ts +60 -0
  4. package/dist/chain.d.ts.map +1 -0
  5. package/dist/chain.js +122 -0
  6. package/dist/chain.js.map +1 -0
  7. package/dist/cli.d.ts +2 -0
  8. package/dist/cli.d.ts.map +1 -0
  9. package/dist/cli.js +264 -0
  10. package/dist/cli.js.map +1 -0
  11. package/dist/config.d.ts +14 -2
  12. package/dist/config.d.ts.map +1 -1
  13. package/dist/config.js +43 -20
  14. package/dist/config.js.map +1 -1
  15. package/dist/docs.d.ts +9 -0
  16. package/dist/docs.d.ts.map +1 -0
  17. package/dist/docs.js +35 -0
  18. package/dist/docs.js.map +1 -0
  19. package/dist/http.d.ts +3 -0
  20. package/dist/http.d.ts.map +1 -0
  21. package/dist/http.js +20 -0
  22. package/dist/http.js.map +1 -0
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +20 -50
  26. package/dist/index.js.map +1 -1
  27. package/dist/limits.d.ts +20 -0
  28. package/dist/limits.d.ts.map +1 -0
  29. package/dist/limits.js +82 -0
  30. package/dist/limits.js.map +1 -0
  31. package/dist/pay.d.ts +27 -0
  32. package/dist/pay.d.ts.map +1 -0
  33. package/dist/pay.js +159 -0
  34. package/dist/pay.js.map +1 -0
  35. package/dist/tools.d.ts +10 -0
  36. package/dist/tools.d.ts.map +1 -0
  37. package/dist/tools.js +335 -0
  38. package/dist/tools.js.map +1 -0
  39. package/dist/wallet.d.ts +7 -0
  40. package/dist/wallet.d.ts.map +1 -0
  41. package/dist/wallet.js +38 -0
  42. package/dist/wallet.js.map +1 -0
  43. package/guides/1-getting-started.md +42 -0
  44. package/guides/2-payments.md +39 -0
  45. package/guides/3-intents-and-ranking.md +29 -0
  46. package/guides/4-troubleshooting.md +41 -0
  47. package/package.json +11 -14
  48. package/dist/client.d.ts +0 -6
  49. package/dist/client.d.ts.map +0 -1
  50. package/dist/client.js +0 -116
  51. package/dist/client.js.map +0 -1
  52. package/dist/discovery.d.ts +0 -3
  53. package/dist/discovery.d.ts.map +0 -1
  54. package/dist/discovery.js +0 -16
  55. package/dist/discovery.js.map +0 -1
  56. package/dist/schema.d.ts +0 -3
  57. package/dist/schema.d.ts.map +0 -1
  58. package/dist/schema.js +0 -84
  59. package/dist/schema.js.map +0 -1
  60. package/dist/tools/daemon.d.ts +0 -4
  61. package/dist/tools/daemon.d.ts.map +0 -1
  62. package/dist/tools/daemon.js +0 -82
  63. package/dist/tools/daemon.js.map +0 -1
  64. package/dist/tools/engine.d.ts +0 -5
  65. package/dist/tools/engine.d.ts.map +0 -1
  66. package/dist/tools/engine.js +0 -83
  67. package/dist/tools/engine.js.map +0 -1
  68. package/dist/tools/node.d.ts +0 -4
  69. package/dist/tools/node.d.ts.map +0 -1
  70. package/dist/tools/node.js +0 -88
  71. package/dist/tools/node.js.map +0 -1
  72. package/dist/tools/subnets.d.ts +0 -10
  73. package/dist/tools/subnets.d.ts.map +0 -1
  74. package/dist/tools/subnets.js +0 -114
  75. package/dist/tools/subnets.js.map +0 -1
  76. package/dist/transport.d.ts +0 -4
  77. package/dist/transport.d.ts.map +0 -1
  78. package/dist/transport.js +0 -17
  79. package/dist/transport.js.map +0 -1
  80. package/dist/types.d.ts +0 -71
  81. package/dist/types.d.ts.map +0 -1
  82. package/dist/types.js +0 -2
  83. package/dist/types.js.map +0 -1
  84. package/dist/x402.d.ts +0 -3
  85. package/dist/x402.d.ts.map +0 -1
  86. package/dist/x402.js +0 -61
  87. package/dist/x402.js.map +0 -1
@@ -1,151 +1,69 @@
1
1
  ---
2
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.
3
+ description: Use the Telegraph network through its MCP server. Activate when the user wants live facts (crypto or stock prices, FX rates, weather, gas prices, TVL), web, news or academic search, or a specialist answer (security or code review, vulnerability triage, sanctions or compliance checks, fact checks) from Telegraph's ranked miners; when they ask which Telegraph intents, miners or rankings exist; or when they ask about their Telegraph escrow balance or paying in USDC. Requires the Telegraph MCP server; paid asks need the wallet from its `setup` command.
4
4
  license: MIT
5
+ homepage: https://github.com/telegraphprotocol/telegraph-mcp
5
6
  metadata:
6
- version: 1.0.0
7
+ version: 2.0.0
7
8
  homepage: https://github.com/telegraphprotocol/telegraph-mcp
8
9
  documentation: https://docs.telegraphprotocol.com
9
- keywords: [ai-inference, x402, bittensor, mcp, usdc, deepfake-detection, weather, llm, web3, agent-payments]
10
+ keywords: [mcp, x402, escrow, usdc, miners, ranking, ai-agents, web3, agent-payments]
11
+ openclaw:
12
+ emoji: "📡"
13
+ requires:
14
+ config: ["mcp.servers.telegraph"]
10
15
  ---
11
16
 
12
- # Telegraph Protocol
17
+ # Telegraph
13
18
 
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.
19
+ Telegraph is a network of miners (APIs and models run by different people) that answer questions by intent. Every epoch the network checks each intent's miners and ranks them, and an ask goes to the best-ranked live miner. Asks are paid in USDC, usually $0.01.
15
20
 
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.
21
+ ## Tools
17
22
 
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
- ---
23
+ | Tool | Cost | Use it to |
24
+ |---|---|---|
25
+ | `telegraph_ask` | ~$0.01 | Ask a question. Optional `intent` and `params` make it exact |
26
+ | `telegraph_ask_miner` | that miner's price | Ask one miner the user chose, or call one of its endpoints directly |
27
+ | `telegraph_find_intents` | free | Find the intent for a kind of question |
28
+ | `telegraph_intent` | free | See an intent's kind, params, answer fields and top miners |
29
+ | `telegraph_find_miners` | free | List an intent's miners with rank, score and price, or search miners by words |
30
+ | `telegraph_ranking` | free | The latest ranking for an intent, or for all |
31
+ | `telegraph_account` | free | Wallet USDC and ETH, and the escrow balance |
32
+ | `telegraph_docs` | free | How payments, intents, ranking and errors work |
45
33
 
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
- ```
34
+ ## How to use it
67
35
 
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
- ---
36
+ - **A plain question is enough**: `telegraph_ask(question="What is the BTC price in USD?")`. The node finds the intent and the miner.
37
+ - **To be exact**, find the intent and its params first, then ask with them:
38
+ `telegraph_find_intents(search="weather")` → `telegraph_intent(intent="WEATHER_CHECK_TEMPERATURE")` → `telegraph_ask(intent="WEATHER_CHECK_TEMPERATURE", params={"location": "Lahore"})`.
39
+ - The answer comes back in the intent's fields (`answer`), with the miner that answered and the payment receipt. Tell the user which miner answered.
40
+ - An intent with no ranking yet is answered by one of the miners that declare it. `telegraph_intent` says when that is the case.
113
41
 
114
42
  ## Payments
115
43
 
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.
44
+ - **Escrow first**: if the wallet has a Telegraph escrow balance, each ask is signed against it and deducted at the epoch close. A failed ask is never billed.
45
+ - When escrow is low, the ask is refused with the balances; nothing is paid from the wallet. Tell the user to run `npx -y @telegraphprotocol/telegraph-protocol-mcp fund` in a terminal.
46
+ - `telegraph_account` shows the balances, limits and how to top up. Never ask the user for a private key.
47
+ - The private key stays in the MCP server's process. It never appears in tool inputs, outputs or model context.
117
48
 
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
49
+ ## Errors
122
50
 
123
- ---
51
+ - **503 "could not route" or `no_compatible_miner`**: nothing was charged. Retry, or ask without the intent.
52
+ - **400 `invalid_params`**: check the params with `telegraph_intent`.
53
+ - **402**: escrow and wallet are both short. Check `telegraph_account`.
54
+ - **"Paying needs a wallet"**: the user hasn't run `npx -y @telegraphprotocol/telegraph-protocol-mcp setup` yet. The free tools still work.
124
55
 
125
56
  ## Setup
126
57
 
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
- ```
58
+ ```json
59
+ {
60
+ "mcpServers": {
61
+ "telegraph": {
62
+ "command": "npx",
63
+ "args": ["-y", "@telegraphprotocol/telegraph-protocol-mcp"]
64
+ }
65
+ }
66
+ }
67
+ ```
150
68
 
151
- Full integration guides for Claude Desktop, Cursor, ElizaOS, LangChain, Goose, and others are in the [README](https://github.com/telegraphprotocol/telegraph-mcp#readme).
69
+ The default network is Telegraph beta 2 on Ethereum Sepolia (test USDC). On OpenClaw this skill gates on the `mcpServers.telegraph` config entry, so it stays dormant until the server is configured. Client guides: [README](https://github.com/telegraphprotocol/telegraph-mcp#readme).