@telegraphprotocol/telegraph-protocol-mcp 2.1.1 → 2.2.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.
@@ -1,69 +1,70 @@
1
- ---
2
- name: telegraph
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
- license: MIT
5
- homepage: https://github.com/telegraphprotocol/telegraph-mcp
6
- metadata:
7
- version: 2.1.1
8
- homepage: https://github.com/telegraphprotocol/telegraph-mcp
9
- documentation: https://docs.telegraphprotocol.com
10
- keywords: [mcp, x402, escrow, usdc, miners, ranking, ai-agents, web3, agent-payments]
11
- openclaw:
12
- emoji: "📡"
13
- requires:
14
- config: ["mcp.servers.telegraph"]
15
- ---
16
-
17
- # Telegraph
18
-
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.
20
-
21
- ## Tools
22
-
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 |
33
-
34
- ## How to use it
35
-
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.
41
-
42
- ## Payments
43
-
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.
48
-
49
- ## Errors
50
-
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.
55
-
56
- ## Setup
57
-
58
- ```json
59
- {
60
- "mcpServers": {
61
- "telegraph": {
62
- "command": "npx",
63
- "args": ["-y", "@telegraphprotocol/telegraph-protocol-mcp"]
64
- }
65
- }
66
- }
67
- ```
68
-
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).
1
+ ---
2
+ name: telegraph
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. For an ordinary request that just needs an answer, prefer the `anjoman` skill when it is installed; use this one when the user wants direct control of a specific miner, intent or ranking.
4
+ license: MIT
5
+ homepage: https://github.com/telegraphprotocol/telegraph-mcp
6
+ metadata:
7
+ version: 2.2.0
8
+ homepage: https://github.com/telegraphprotocol/telegraph-mcp
9
+ documentation: https://docs.telegraphprotocol.com
10
+ keywords: [mcp, x402, escrow, usdc, miners, ranking, ai-agents, web3, agent-payments]
11
+ openclaw:
12
+ emoji: "📡"
13
+ requires:
14
+ config: ["mcp.servers.telegraph"]
15
+ ---
16
+
17
+ # Telegraph
18
+
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.
20
+
21
+ ## Tools
22
+
23
+ | Tool | Cost | Use it to |
24
+ |---|---|---|
25
+ | `telegraph_ask` | ~$0.01 per miner used | 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 |
33
+
34
+ ## How to use it
35
+
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
+ - When the first answer misses part of the question, the node asks the next ranked miners for the rest within the ask's budget. `fulfillment` says whether the answer is complete (`status`), which miner gave each field (`provenance`) and what was paid (`payments`).
41
+ - An intent with no ranking yet is answered by one of the miners that declare it. `telegraph_intent` says when that is the case.
42
+
43
+ ## Payments
44
+
45
+ - **Escrow first**: if the wallet has a Telegraph escrow balance, each ask is signed against it and charged at the epoch close. An ask holds its budget while it runs and is billed only for the miners whose answers it used. A failed ask is never billed.
46
+ - 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.
47
+ - `telegraph_account` shows the balances, limits and how to top up. Never ask the user for a private key.
48
+ - The private key stays in the MCP server's process. It never appears in tool inputs, outputs or model context.
49
+
50
+ ## Errors
51
+
52
+ - **503 "could not route" or `no_compatible_miner`**: nothing was charged. Retry, or ask without the intent.
53
+ - **400 `invalid_params`**: check the params with `telegraph_intent`.
54
+ - **402**: escrow and wallet are both short. Check `telegraph_account`.
55
+ - **"Paying needs a wallet"**: the user hasn't run `npx -y @telegraphprotocol/telegraph-protocol-mcp setup` yet. The free tools still work.
56
+
57
+ ## Setup
58
+
59
+ ```json
60
+ {
61
+ "mcpServers": {
62
+ "telegraph": {
63
+ "command": "npx",
64
+ "args": ["-y", "@telegraphprotocol/telegraph-protocol-mcp"]
65
+ }
66
+ }
67
+ }
68
+ ```
69
+
70
+ 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).
package/LICENSE CHANGED
@@ -1,21 +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.
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 CHANGED
@@ -1,119 +1,127 @@
1
- # Telegraph MCP server
2
-
3
- Gives any MCP agent (Claude Desktop, Claude Code, Cursor, Continue, Goose, OpenClaw, LangChain, ElizaOS, ...) the Telegraph network, on your own computer. Ask a question and the best-ranked miner answers. Payment comes from your Telegraph escrow automatically: no keys, signatures or blockchain steps for you or your agent.
4
-
5
- ## Start in three steps
6
-
7
- You need Node 20 or later.
8
-
9
- **1. Set up once.** In a terminal:
10
-
11
- ```bash
12
- npx -y @telegraphprotocol/telegraph-protocol-mcp setup
13
- ```
14
-
15
- It checks the network and creates a wallet just for Telegraph. You can import a key instead. The wallet is saved to `~/.telegraph/wallet.json`, readable only by you. Setup then shows the address and balances, moves the USDC you choose into escrow after you confirm, and offers to add Telegraph to your agent app.
16
-
17
- **2. Restart your agent app.**
18
-
19
- **3. Ask it something:** "What is the BTC price? Use Telegraph." Every ask after that is paid from escrow on its own.
20
-
21
- Top up any time with `npx -y @telegraphprotocol/telegraph-protocol-mcp fund`. Check balances with `... status`.
22
- Take USDC back out with `... withdraw`: it requests the amount, and you run it again to collect once the network has settled it.
23
-
24
- Back up `~/.telegraph/wallet.json`. It is the only copy of the key, and the escrow balance goes with it.
25
-
26
- ## Adding it to an app by hand
27
-
28
- No setting or key is needed: the server uses the wallet from setup. `setup` and `install <app>` write these for you where they can.
29
-
30
- | App | How |
31
- |---|---|
32
- | Claude Code | `claude mcp add --scope user telegraph -- npx -y @telegraphprotocol/telegraph-protocol-mcp` |
33
- | Claude Desktop, Cursor, any other MCP client | Add to `mcpServers`: `{"telegraph": {"command": "npx", "args": ["-y", "@telegraphprotocol/telegraph-protocol-mcp"]}}` |
34
- | OpenClaw | `openclaw mcp add telegraph --command npx --arg=-y --arg @telegraphprotocol/telegraph-protocol-mcp` |
35
- | Continue, Goose, LangChain, ElizaOS | Ready files in [examples/](examples/) |
36
-
37
- ## How paying works
38
-
39
- - **The MCP server is your wallet.** It runs on your machine, loads the key from `~/.telegraph/wallet.json` (or `TELEGRAPH_PRIVATE_KEY`), and calls the node's `/engine/v1/ask` itself. When the node asks for payment, the server signs the escrow authorization with that key and sends the ask again. The agent never sees the key or the signature.
40
- - **Escrow, always, by default.** You deposit USDC once. The escrow signature proves you asked, but it can't move funds. Asks are deducted at the epoch close, and **a failed ask is never billed**.
41
- - **When escrow runs low,** the ask is refused with a message saying how much is left and how to top up. Nothing is charged, and the wallet is never paid from silently.
42
- - **No double charges.** Repeating the same ask within a minute, or while it's still running, returns that answer, not a second charge.
43
- - **Limits.** The server won't pay more than $0.50 for one ask or $5 a day. Change them with the settings below.
44
- - **x402** (paying each ask straight from the wallet's USDC) is still there, but only if you turn it on: `TELEGRAPH_PAYMENT=auto` for escrow then x402, or `x402` for x402 only.
45
-
46
- Details, debt and withdrawing: [guides/2-payments.md](guides/2-payments.md).
47
-
48
- ## Settings
49
-
50
- All optional.
51
-
52
- | Variable | Default | What it is |
53
- |---|---|---|
54
- | `TELEGRAPH_PAYMENT` | `escrow` | `escrow`; `auto` (escrow, then x402); `x402` |
55
- | `TELEGRAPH_MAX_ASK_USD` | `0.5` | The most one ask may cost. `0` means no limit |
56
- | `TELEGRAPH_DAILY_LIMIT_USD` | `5` | The most all asks may cost in a UTC day. `0` means no limit |
57
- | `TELEGRAPH_HOME` | `~/.telegraph` | Where the wallet and the day's spending are kept |
58
- | `TELEGRAPH_PRIVATE_KEY` | none | Use this key instead of the wallet file. For servers and CI. (`TELEGRAPH_EVM_PRIVATE_KEY`, the v1 name, also works.) |
59
- | `TELEGRAPH_API_KEY` | none | An Anjoman API key (`anjoman_…`). Switches to [key mode](#using-an-api-key-instead-of-a-wallet): no wallet is used |
60
- | `TELEGRAPH_API_URL` | `https://backend.telegraphprotocol.com` | Where the API key is used |
61
- | `TELEGRAPH_ALLOW_AGENT_DEPOSIT` | off | Also give the agent a `telegraph_deposit` tool |
62
- | `TELEGRAPH_URL` | `https://devnode.telegraphprotocol.com` | The node (Telegraph beta 2) |
63
- | `TELEGRAPH_RPC_URL`, `TELEGRAPH_DIAMOND`, `TELEGRAPH_CHAIN_ID` | beta 2's | The chain and the contract that holds escrow |
64
-
65
- ## Using an API key instead of a wallet
66
-
67
- If you have an Anjoman account, you can skip the wallet. Create a key on the **API keys** page (`https://anjoman.ai/dashboard/api-keys`), deposit into your account there, and set it in your agent's settings:
68
-
69
- ```json
70
- {"mcpServers": {"telegraph": {"command": "npx", "args": ["-y", "@telegraphprotocol/telegraph-protocol-mcp"], "env": {"TELEGRAPH_API_KEY": "anjoman_your_key_here"}}}}
71
- ```
72
-
73
- No `setup` is needed. In key mode:
74
-
75
- - `telegraph_ask` goes through your Anjoman account, which picks the sources, can combine several for one question, and writes the answer. It is paid from the account's escrow balance. A question can take up to a minute.
76
- - `telegraph_account` shows the account's escrow balance and what its last jobs cost. Top up in Anjoman: this server cannot deposit.
77
- - `telegraph_ask_miner` and `telegraph_deposit` are not offered: a key cannot call one miner directly or move funds.
78
- - The free tools (`telegraph_find_intents`, `telegraph_intent`, `telegraph_find_miners`, `telegraph_ranking`, `telegraph_docs`) work as before.
79
- - The wallet, `TELEGRAPH_PAYMENT` and the per-ask and daily limits do not apply. The account's balance and the key's own limits (30 requests a minute, an optional expiry) do. Revoke the key in Anjoman to cut off an agent at once.
80
-
81
- Treat the key like a password: it can spend your balance. Keep it in an agent's settings, not in a repository.
82
-
83
- ## Tools
84
-
85
- | Tool | Cost | What it does |
86
- |---|---|---|
87
- | `telegraph_ask` | ~$0.01 | Ask a question, optionally with an exact intent and params. The node routes it to the top live miner |
88
- | `telegraph_ask_miner` | the miner's price | Ask one miner you choose, or call one of its endpoints directly |
89
- | `telegraph_find_intents` | free | Search the 130+ intents (kinds of question) |
90
- | `telegraph_intent` | free | One intent's kind, params, answer fields and top miners |
91
- | `telegraph_find_miners` | free | An intent's miners with rank, score, price and endpoints, or a word search over all miners |
92
- | `telegraph_ranking` | free | The latest epoch's ranking, per intent |
93
- | `telegraph_account` | free | Address, network, wallet and escrow balances, limits, spending today, and how to top up |
94
- | `telegraph_docs` | free | Built-in guides, also served as MCP resources (`telegraph://docs/...`) |
95
- | `telegraph_deposit` | gas | Only with `TELEGRAPH_ALLOW_AGENT_DEPOSIT`: move wallet USDC into escrow |
96
-
97
- ## Test funds (beta 2)
98
-
99
- Beta 2 runs on Ethereum Sepolia, so there's no real money. Its USDC (`0xcc194e1a843B658526D0D5C431f670028582Ae17`) is Telegraph's own test token, not Circle's: the escrow takes that one and no other, and `telegraph_account` names it. Claim it at [anjoman.ai/dashboard/faucet](https://anjoman.ai/dashboard/faucet): sign in, send it to your Telegraph wallet, 1 USDC per account every 24 hours. `fund` points you there. Gas needs a little Sepolia ETH from a public faucet.
100
-
101
- ## Security
102
-
103
- - The key lives in `~/.telegraph/wallet.json` (mode 0600), or in `TELEGRAPH_PRIVATE_KEY` if you set one. It's never in an agent's config, a tool result or a log, so the agent and its model never see it through MCP.
104
- - Use a wallet made for this, holding only what you plan to spend. The limits cap what the agent can spend.
105
- - By default the agent gets no tool that moves funds: deposits and withdrawals happen in your terminal, after you confirm.
106
- - That holds for the tools. An agent that can also run shell commands (Claude Code, Cursor, Goose) can read the wallet file or run `fund` itself, so the real protection is the dedicated wallet and the limits, not the tool list.
107
- - The server runs locally over stdio and opens no port.
108
-
109
- ## Development
110
-
111
- ```bash
112
- npm install && npm run build && npm test
113
- node scripts/smoke.mjs # free tools against the node
114
- node scripts/smoke.mjs paid # plus three asks (~$0.03), using the setup wallet
115
- node scripts/smoke.mjs call telegraph_intent '{"intent":"CRYPTO_PRICE_USD"}'
116
- npx @modelcontextprotocol/inspector dist/index.js # browse the tools
117
- ```
118
-
119
- Architecture: [docs/architecture.md](docs/architecture.md). Problems: [docs/troubleshooting.md](docs/troubleshooting.md).
1
+ # Telegraph MCP server
2
+
3
+ > **Just want your agent to use Anjoman for outside intelligence?** Install the [`anjoman` skill](skills/anjoman/SKILL.md) instead: `npx skills add telegraphprotocol/telegraph-mcp --skill anjoman`, then set `ANJOMAN_API_KEY`. No MCP server or wallet, and it supports follow-ups, a spend cap, progress, traces and receipts. This MCP server is for direct specialist access.
4
+
5
+ Gives any MCP agent (Claude Desktop, Claude Code, Cursor, Continue, Goose, OpenClaw, LangChain, ElizaOS, ...) the Telegraph network, on your own computer. Ask a question and the best-ranked miner answers. Payment comes from your Telegraph escrow automatically: no keys, signatures or blockchain steps for you or your agent.
6
+
7
+ ## Start in three steps
8
+
9
+ You need Node 20 or later.
10
+
11
+ **1. Set up once.** In a terminal:
12
+
13
+ ```bash
14
+ npx -y @telegraphprotocol/telegraph-protocol-mcp setup
15
+ ```
16
+
17
+ It checks the network and creates a wallet just for Telegraph. You can import a key instead. The wallet is saved to `~/.telegraph/wallet.json`, readable only by you. Setup then shows the address and balances, moves the USDC you choose into escrow after you confirm, and offers to add Telegraph to your agent app.
18
+
19
+ **2. Restart your agent app.**
20
+
21
+ **3. Ask it something:** "What is the BTC price? Use Telegraph." Every ask after that is paid from escrow on its own.
22
+
23
+ Top up any time with `npx -y @telegraphprotocol/telegraph-protocol-mcp fund`. Check balances with `... status`.
24
+ Take USDC back out with `... withdraw`: it requests the amount, and you run it again to collect once a ledger root covers the request.
25
+
26
+ Back up `~/.telegraph/wallet.json`. It is the only copy of the key, and the escrow balance goes with it.
27
+
28
+ ## Adding it to an app by hand
29
+
30
+ No setting or key is needed: the server uses the wallet from setup. `setup` and `install <app>` write these for you where they can.
31
+
32
+ | App | How |
33
+ |---|---|
34
+ | Claude Code | `claude mcp add --scope user telegraph -- npx -y @telegraphprotocol/telegraph-protocol-mcp` |
35
+ | Claude Desktop, Cursor, any other MCP client | Add to `mcpServers`: `{"telegraph": {"command": "npx", "args": ["-y", "@telegraphprotocol/telegraph-protocol-mcp"]}}` |
36
+ | OpenClaw | `openclaw mcp add telegraph --command npx --arg=-y --arg @telegraphprotocol/telegraph-protocol-mcp` |
37
+ | Continue, Goose, LangChain, ElizaOS | Ready files in [examples/](examples/) |
38
+
39
+ ## How paying works
40
+
41
+ - **The MCP server is your wallet.** It runs on your machine, loads the key from `~/.telegraph/wallet.json` (or `TELEGRAPH_PRIVATE_KEY`), and calls the node's `/engine/v1/ask` itself. When the node asks for payment, the server signs the escrow authorization with that key and sends the ask again. The agent never sees the key or the signature.
42
+ - **Escrow, always, by default.** You deposit USDC once. The escrow signature proves you asked, but it can't move funds. Asks are charged in the epoch's ledger root, and **a failed ask is never billed**.
43
+ - **Multi-miner asks.** `telegraph_ask` sends `max_budget_usdc` (default 260000 μUSDC, $0.26, the most the testnet node takes). When the first miner's answer misses part of the question, the node asks the next ranked miners for the rest within that budget. Escrow holds the budget while the ask runs; only the miners whose answers are used are billed, and the rest is released. The reply's `fulfillment` says whether the answer is complete, who gave each field, and the payments.
44
+ - **When escrow runs low,** the ask is refused with a message saying how much is left and how to top up. Nothing is charged, and the wallet is never paid from silently.
45
+ - **No double charges.** Repeating the same ask within a minute, or while it's still running, returns that answer, not a second charge.
46
+ - **Limits.** The server won't pay more than $0.50 for one ask or $5 a day. Change them with the settings below.
47
+ - **x402** (paying each ask straight from the wallet's USDC) is still there, but only if you turn it on: `TELEGRAPH_PAYMENT=auto` for escrow then x402, or `x402` for x402 only.
48
+
49
+ Details and withdrawing: [guides/2-payments.md](guides/2-payments.md).
50
+
51
+ ## Settings
52
+
53
+ All optional.
54
+
55
+ | Variable | Default | What it is |
56
+ |---|---|---|
57
+ | `TELEGRAPH_PAYMENT` | `escrow` | `escrow`; `auto` (escrow, then x402); `x402` |
58
+ | `TELEGRAPH_MAX_ASK_USD` | `0.5` | The most one ask may cost. `0` means no limit |
59
+ | `TELEGRAPH_DAILY_LIMIT_USD` | `5` | The most all asks may cost in a UTC day. `0` means no limit |
60
+ | `TELEGRAPH_MAX_BUDGET_USDC` | `260000` | `max_budget_usdc` for each `telegraph_ask`, in μUSDC, the first call included (never above `TELEGRAPH_MAX_ASK_USD`). `0` sends none: one miner, nothing recovered |
61
+ | `TELEGRAPH_HOME` | `~/.telegraph` | Where the wallet and the day's spending are kept |
62
+ | `TELEGRAPH_PRIVATE_KEY` | none | Use this key instead of the wallet file. For servers and CI. (`TELEGRAPH_EVM_PRIVATE_KEY`, the v1 name, also works.) |
63
+ | `TELEGRAPH_API_KEY` | none | An Anjoman API key (`anjoman_…`). Switches to [key mode](#using-an-api-key-instead-of-a-wallet): no wallet is used |
64
+ | `TELEGRAPH_API_URL` | `https://backend.telegraphprotocol.com` | Where the API key is used |
65
+ | `TELEGRAPH_ALLOW_AGENT_DEPOSIT` | off | Also give the agent a `telegraph_deposit` tool |
66
+ | `TELEGRAPH_URL` | `https://devnode.telegraphprotocol.com` | The node (the Telegraph testnet) |
67
+ | `TELEGRAPH_RPC_URL`, `TELEGRAPH_DIAMOND`, `TELEGRAPH_CHAIN_ID` | the testnet's (diamond `0x72a70e949362670Bf8bceAd24eFC5b8f950aa08b`) | The chain and the contract that holds escrow |
68
+
69
+ ## Using an API key instead of a wallet
70
+
71
+ If you have an Anjoman account, you can skip the wallet. Create a key on the **API keys** page (`https://anjoman.ai/dashboard/api-keys`), deposit into your account there, and set it in your agent's settings:
72
+
73
+ ```json
74
+ {"mcpServers": {"telegraph": {"command": "npx", "args": ["-y", "@telegraphprotocol/telegraph-protocol-mcp"], "env": {"TELEGRAPH_API_KEY": "anjoman_your_key_here"}}}}
75
+ ```
76
+
77
+ No `setup` is needed. In key mode:
78
+
79
+ - `telegraph_ask` is a multi-miner call through your Anjoman account's agent: it splits the request across intents and miners, combines their answers and writes one reply. A question can take up to a minute.
80
+ - `telegraph_ask_auto` is the node's auto-routed ask, without the agent: the node picks the top live miner and asks the next ones for what it missed. It holds a budget of $0.26 while it runs and is billed only for the miners whose answers are used.
81
+ - `telegraph_ask_miner` is a miner call: one miner you choose, with a question or one of its endpoints, at that miner's price.
82
+ - All three are paid from the account's escrow balance.
83
+ - `telegraph_account` shows the account's escrow balance and what its last jobs cost. Top up in Anjoman: this server cannot deposit.
84
+ - `telegraph_deposit` is not offered: a key cannot move funds.
85
+ - The free tools (`telegraph_find_intents`, `telegraph_intent`, `telegraph_find_miners`, `telegraph_ranking`, `telegraph_docs`) work as before.
86
+ - The wallet, `TELEGRAPH_PAYMENT` and the per-ask and daily limits do not apply. The account's balance and the key's own limits (30 requests a minute, an optional expiry) do. Revoke the key in Anjoman to cut off an agent at once.
87
+
88
+ Treat the key like a password: it can spend your balance. Keep it in an agent's settings, not in a repository.
89
+
90
+ ## Tools
91
+
92
+ | Tool | Cost | What it does |
93
+ |---|---|---|
94
+ | `telegraph_ask` | ~$0.01 per miner used | Ask a question, optionally with an exact intent and params. The node routes it to the top live miner, and asks the next ones for what it missed |
95
+ | `telegraph_ask_miner` | the miner's price | Miner call: ask one miner you choose, or call one of its endpoints directly |
96
+ | `telegraph_ask_auto` | ~$0.01 per miner used | API key only: the node's auto-routed ask, without Anjoman's agent |
97
+ | `telegraph_find_intents` | free | Search the 130+ intents (kinds of question) |
98
+ | `telegraph_intent` | free | One intent's kind, params, answer fields and top miners |
99
+ | `telegraph_find_miners` | free | An intent's miners with rank, score, price and endpoints, or a word search over all miners |
100
+ | `telegraph_ranking` | free | The latest epoch's ranking, per intent |
101
+ | `telegraph_account` | free | Address, network, wallet and escrow balances, limits, spending today, and how to top up |
102
+ | `telegraph_docs` | free | Built-in guides, also served as MCP resources (`telegraph://docs/...`) |
103
+ | `telegraph_deposit` | gas | Only with `TELEGRAPH_ALLOW_AGENT_DEPOSIT`: move wallet USDC into escrow |
104
+
105
+ ## Test funds (testnet)
106
+
107
+ The testnet runs on Ethereum Sepolia, so there's no real money. Its USDC (`0xcc194e1a843B658526D0D5C431f670028582Ae17`) is Telegraph's own test token, not Circle's: the escrow takes that one and no other, and `telegraph_account` names it. Claim it at [anjoman.ai/dashboard/faucet](https://anjoman.ai/dashboard/faucet) (sign in) and send it to your Telegraph wallet, or mint it directly (`mint(address,uint256)`, anyone can). `fund` points you there. Gas needs a little Sepolia ETH from a public faucet. Balances in the previous diamond (`0x3624…b99b`) do not carry over.
108
+
109
+ ## Security
110
+
111
+ - The key lives in `~/.telegraph/wallet.json` (mode 0600), or in `TELEGRAPH_PRIVATE_KEY` if you set one. It's never in an agent's config, a tool result or a log, so the agent and its model never see it through MCP.
112
+ - Use a wallet made for this, holding only what you plan to spend. The limits cap what the agent can spend.
113
+ - By default the agent gets no tool that moves funds: deposits and withdrawals happen in your terminal, after you confirm.
114
+ - That holds for the tools. An agent that can also run shell commands (Claude Code, Cursor, Goose) can read the wallet file or run `fund` itself, so the real protection is the dedicated wallet and the limits, not the tool list.
115
+ - The server runs locally over stdio and opens no port.
116
+
117
+ ## Development
118
+
119
+ ```bash
120
+ npm install && npm run build && npm test
121
+ node scripts/smoke.mjs # free tools against the node
122
+ node scripts/smoke.mjs paid # plus three asks (~$0.03), using the setup wallet
123
+ node scripts/smoke.mjs call telegraph_intent '{"intent":"CRYPTO_PRICE_USD"}'
124
+ npx @modelcontextprotocol/inspector dist/index.js # browse the tools
125
+ ```
126
+
127
+ Architecture: [docs/architecture.md](docs/architecture.md). Problems: [docs/troubleshooting.md](docs/troubleshooting.md).
package/dist/api.d.ts CHANGED
@@ -3,6 +3,11 @@ export interface AskArgs {
3
3
  intent?: string;
4
4
  params?: Record<string, unknown>;
5
5
  }
6
+ export type EngineBody = Record<string, unknown>;
7
+ export interface EngineResult {
8
+ result: any;
9
+ receipt: unknown;
10
+ }
6
11
  export interface AskResult {
7
12
  status: string;
8
13
  answer?: string;
@@ -18,6 +23,8 @@ export declare class AnjomanApi {
18
23
  constructor(baseUrl: string, key: string);
19
24
  private request;
20
25
  ask(args: AskArgs): Promise<AskResult>;
26
+ askAuto(body: EngineBody): Promise<EngineResult>;
27
+ askMiner(miner: string, body: EngineBody): Promise<EngineResult>;
21
28
  private follow;
22
29
  private result;
23
30
  account(): Promise<{
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAID,qBAAa,UAAU;IAEnB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,GAAG;gBADH,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM;YAIP,OAAO;IAqBf,GAAG,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;YAO9B,MAAM;IAepB,OAAO,CAAC,MAAM;IAYR,OAAO;;;;;;;;;;;CAWd"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAGD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAGjD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAID,qBAAa,UAAU;IAEnB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,GAAG;gBADH,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM;YAIP,OAAO;IAqBf,GAAG,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;IAQtC,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;IAKhD,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;YAKxD,MAAM;IAepB,OAAO,CAAC,MAAM;IAYR,OAAO;;;;;;;;;;;CAWd"}
package/dist/api.js CHANGED
@@ -1,4 +1,5 @@
1
- // Key mode: asks go through the user's Anjoman account (agent chat), which pays from the account's escrow itself.
1
+ // Key mode: asks go through the user's Anjoman account, which pays from the account's escrow itself: the agent
2
+ // (agent chat), an auto-routed ask (the node picks the miner) or a miner call (one named miner).
2
3
  // No wallet, signature or chain call happens in this process.
3
4
  const ASK_WAIT_MS = 110_000; // the API answers at once or hands back a job within about 80 seconds
4
5
  const POLL_EVERY_MS = 3_000;
@@ -39,6 +40,15 @@ export class AnjomanApi {
39
40
  return this.result(body);
40
41
  return this.follow(body.jobId, body.conversationId);
41
42
  }
43
+ // Auto-routed: the node picks the best-ranked live miner and asks the next ones for what it missed, within the
44
+ // account's budget of 0.26 USDC per ask (only the miners whose answers are used are billed).
45
+ async askAuto(body) {
46
+ return (await this.request("POST", "/engine/ask", body, ASK_WAIT_MS)).body;
47
+ }
48
+ // Miner call: one named miner, no routing and no fallback, at that miner's price.
49
+ async askMiner(miner, body) {
50
+ return (await this.request("POST", `/engine/ask/${encodeURIComponent(miner)}`, body, ASK_WAIT_MS)).body;
51
+ }
42
52
  // The turn outlived the wait: read its job until it ends.
43
53
  async follow(jobId, conversationId) {
44
54
  const until = Date.now() + POLL_FOR_MS;
package/dist/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,kHAAkH;AAClH,8DAA8D;AAE9D,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,sEAAsE;AACnG,MAAM,aAAa,GAAG,KAAK,CAAC;AAC5B,MAAM,WAAW,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,6EAA6E;AAmB7G,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAEhF,MAAM,OAAO,UAAU;IAEX;IACA;IAFV,YACU,OAAe,EACf,GAAW;QADX,YAAO,GAAP,OAAO,CAAQ;QACf,QAAG,GAAH,GAAG,CAAQ;IAClB,CAAC;IAEJ,4GAA4G;IACpG,KAAK,CAAC,OAAO,CAAC,MAAsB,EAAE,IAAY,EAAE,IAAc,EAAE,SAAS,GAAG,MAAM;QAC5F,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,EAAE;YAChD,MAAM;YACN,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,IAAI,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,EAAE;YACnJ,IAAI,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IA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CAAC,CAAC,SAAS,EAAE;YACpG,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM;YACzB,WAAW,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;YAClH,MAAM,EAAE,iGAAiG;SAC1G,CAAC;IACJ,CAAC;CACF"}
package/dist/chain.d.ts CHANGED
@@ -7,6 +7,7 @@ export declare class Chain {
7
7
  private usdc?;
8
8
  constructor(cfg: Config);
9
9
  private usdcAddress;
10
+ private ledger;
10
11
  account(address: `0x${string}`): Promise<{
11
12
  address: `0x${string}`;
12
13
  network: string;
@@ -16,9 +17,11 @@ export declare class Chain {
16
17
  wallet_eth: number;
17
18
  escrow: {
18
19
  spendable_usdc: number;
20
+ balance_usdc: number;
19
21
  deposited_usdc: number;
20
- debt_usdc: number;
22
+ unbilled_usdc: number;
21
23
  pending_withdrawal_usdc: number;
24
+ withdrawal_status: any;
22
25
  };
23
26
  }>;
24
27
  deposit(account: PrivateKeyAccount, amountUsd: number): Promise<{
@@ -26,33 +29,34 @@ export declare class Chain {
26
29
  transactions: string[];
27
30
  escrow_now: {
28
31
  spendable_usdc: number;
32
+ balance_usdc: number;
29
33
  deposited_usdc: number;
30
- debt_usdc: number;
34
+ unbilled_usdc: number;
31
35
  pending_withdrawal_usdc: number;
36
+ withdrawal_status: any;
32
37
  };
33
38
  }>;
34
- withdrawalUnlock(address: `0x${string}`): Promise<{
35
- unlockSequence: bigint;
36
- unlockAt: Date;
37
- unlocked: boolean;
39
+ withdrawal(address: `0x${string}`): Promise<{
40
+ status: string;
41
+ amount_usdc: number;
42
+ fallback_at: string | undefined;
38
43
  }>;
39
44
  requestWithdraw(account: PrivateKeyAccount, amountUsd: number): Promise<{
40
45
  amount_usdc: number;
41
46
  transaction: `0x${string}`;
42
- unlock: {
43
- unlockSequence: bigint;
44
- unlockAt: Date;
45
- unlocked: boolean;
46
- };
47
+ needs_root_after: string | undefined;
48
+ fallback_at: string | undefined;
47
49
  }>;
48
50
  executeWithdraw(account: PrivateKeyAccount): Promise<{
49
51
  transaction: `0x${string}`;
50
52
  wallet_usdc: number;
51
53
  escrow_now: {
52
54
  spendable_usdc: number;
55
+ balance_usdc: number;
53
56
  deposited_usdc: number;
54
- debt_usdc: number;
57
+ unbilled_usdc: number;
55
58
  pending_withdrawal_usdc: number;
59
+ withdrawal_status: any;
56
60
  };
57
61
  }>;
58
62
  private waitOk;
@@ -1 +1 @@
1
- {"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../src/chain.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAuB1C,qBAAa,KAAK;IAKJ,OAAO,CAAC,GAAG;IAJvB,OAAO,CAAC,KAAK,CAAC;IACd,OAAO,CAAC,GAAG,CAAC;IACZ,OAAO,CAAC,IAAI,CAAC,CAAgB;gBAET,GAAG,EAAE,MAAM;YAUjB,WAAW;IAKnB,OAAO,CAAC,OAAO,EAAE,KAAK,MAAM,EAAE;;;;;;;;;;;;;;IA+B9B,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM;;;;;;;;;;IA0BrD,gBAAgB,CAAC,OAAO,EAAE,KAAK,MAAM,EAAE;;;;;IAUvC,eAAe,CAAC,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM;;;;;;;;;IAQ7D,eAAe,CAAC,OAAO,EAAE,iBAAiB;;;;;;;;;;YAQlC,MAAM;CAIrB"}
1
+ {"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../src/chain.ts"],"names":[],"mappings":"AACA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