Skip to main content
Glama
Telegraph MCP Server

Telegraph MCP Server

@telegraph/mcp-server

MCP 服务器,将 Telegraph Protocol AI 推理 API 作为工具暴露,并支持自动 x402 微支付。

连接任何兼容 MCP 的代理(Claude Desktop、Cursor、ElizaOS、LangChain、OpenClaw、Goose 等)到 Telegraph 的 AI 矿工网络——天气预报、深度伪造检测、LLM 推理、AI 文本检测、信号监控——代理中无需任何加密代码。MCP 服务器内部处理私钥托管、支付签名和交易结算。

矿工可以是 Bittensor 子网、托管模型或通过 YAML 集成的任何私有 API。某些工具和字段名称因历史原因仍使用 subnet——请将其理解为“矿工”。

文档

文档

描述

架构

MCP 协议、工具类别、x402 自动支付、客户端集成

故障排除

常见问题及解决方案

Related MCP server: telegraph-mcp

快速开始

选项 A — npx(无需克隆,发布后推荐)

TELEGRAPH_NODE_URL=http://13.237.89.59:7044 \
TELEGRAPH_ENGINE_URL=http://13.237.89.59:8080 \
TELEGRAPH_DAEMON_URL=http://13.237.89.59:8081 \
TELEGRAPH_EVM_PRIVATE_KEY=0xyour_key_here \
npx -y telegraph-protocol-mcp

选项 B — 从源码构建

# 1. Clone and enter
git clone https://github.com/telegraphprotocol/telegraph-mcp
cd telegraph-mcp

# 2. Copy and edit .env
cp .env.example .env
# Edit: set TELEGRAPH_EVM_PRIVATE_KEY=0xyour_key_here

# 3. Install and build
npm install && npm run build

# 4. Run
npm start

已发布到 npm 为 telegraph-protocol-mcp,并在 MCP 注册表 上列为 io.github.telegraphprotocol/telegraph。维护者请参阅 PUBLISHING.md。

架构

Agent (Claude / Cursor / Eliza / etc.)
       │
       │ MCP protocol (JSON-RPC over stdio)
       │
┌──────▼─────────────────────────────────────────┐
│  Telegraph MCP Server (runs locally)            │
│                                                 │
│  ┌─────────┐  ┌──────────┐  ┌───────────────┐  │
│  │ Node    │  │ Engine   │  │ Daemon        │  │
│  │ :7044   │  │ :8080    │  │ :8081         │  │
│  ├─────────┤  ├──────────┤  ├───────────────┤  │
│  │ Status  │  │ Subnets  │  │ Health        │  │
│  │ Health  │  │ Ask      │  │ Categories    │  │
│  │ Subnets │  │ Direct   │  │ Questions     │  │
│  │ Dynamic │  │          │  │               │  │
│  └─────────┘  └──────────┘  └───────────────┘  │
│                                                 │
│  X402 payment handled transparently:            │
│    request → 402 → sign EIP-3009 → retry        │
└─────────────────────────────────────────────────┘

配置

全部通过环境变量(.env 文件或内联方式):

变量

必需

默认值

描述

TELEGRAPH_NODE_URL

是

http://localhost:7044

Telegraph 节点 URL

TELEGRAPH_ENGINE_URL

是

http://localhost:8080

引擎服务器 URL

TELEGRAPH_DAEMON_URL

是

http://localhost:8081

守护进程 API URL

TELEGRAPH_EVM_PRIVATE_KEY

是*

—

EVM 私钥(0x 前缀十六进制)

TELEGRAPH_SOLANA_PRIVATE_KEY

否*

—

Solana 私钥(base58)

EVM_NETWORK

否

eip155:*

EVM CAIP-2 网络

SVM_NETWORK

否

solana:*

Solana CAIP-2 网络

REFRESH_INTERVAL_MS

否

300000

矿工工具刷新间隔(毫秒)。设为 0 禁用。

*至少需要一个私钥。

可用工具

节点工具(无需支付)

工具

描述

tg_node_status

节点状态、公钥、链信息

tg_node_subnets_health

矿工集成健康检查

tg_node_list_subnets

完整矿工目录,包含元数据、模式、端点

引擎工具

工具

支付

描述

tg_engine_list_subnets

免费

列出引擎可路由到的矿工

tg_engine_ask

x402

自动路由推理(LLM 为你的查询选择最佳矿工)

tg_engine_ask_subnet

x402

通过指定矿工 ID 直接推理

守护进程工具(无需支付)

工具

描述

tg_daemon_health

守护进程健康检查

tg_daemon_categories

信号类别(POLITICS、ECONOMICS、TECHNOLOGY、CLIMATE、HEALTH、CRYPTO、SPORTS 等)

tg_daemon_questions

使用过滤器(类别、来源、时间、兴趣)查询收集的信号

动态矿工工具(自动发现,x402 支付)

每个矿工端点的工具从 Telegraph 节点的实时集成注册表中自动生成。实时集合在链上变化,因此请将其视为快照,而非权威来源(调用 tg_node_list_subnets 获取当前目录):

矿工

工具

Zeus (18) — 天气

tg_zeus_predict

ItsAI (32) — AI 文本检测

tg_itsai_text_detector_detect

Sapling (33) — AI 内容检测

tg_sapling_ai_detector_detect

BitMind (34) — 深度伪造

tg_bitmind_detect_image、tg_bitmind_detect_video、tg_bitmind_preprocess_video、tg_bitmind_get_video_upload_url

OpenAI (102) — LLM / 图像

tg_openai_chat、tg_openai_responses、tg_openai_embed、tg_openai_images_generate、tg_openai_moderate

这些会自动更新。 链上新注册的矿工将在 5 分钟内出现。已注销的矿工将被清理。代理始终只看到当前有效的工具。

某些工具和字段名称包含 subnet 是历史原因——Telegraph 最初集成的是 Bittensor 子网。如今,矿工 是通过 YAML 集成的任何提供者,无论是否为子网。

x402 支付如何工作

当代理调用付费工具(例如 tg_engine_ask)时:

  1. MCP 服务器向 Telegraph 发送请求

  2. Telegraph 返回 HTTP 402,响应头中包含支付要求

  3. @x402/fetch 拦截 402,使用你的私钥签署 EIP-3009 TransferWithAuthorization,将签名附加为 PAYMENT 头,然后重试

  4. Telegraph 通过 PayAI 协调器在链上验证支付,并返回结果

代理和 LLM 永远不会看到支付流程、私钥或区块链交易。 完全透明——代理只看到一个返回结果的工具。

集成指南

Claude Desktop

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json(macOS)或 %APPDATA%\Claude\claude_desktop_config.json(Windows)。

使用 npx(最简单——无需克隆或构建):

{
  "mcpServers": {
    "telegraph": {
      "command": "npx",
      "args": ["-y", "telegraph-protocol-mcp"],
      "env": {
        "TELEGRAPH_NODE_URL": "http://13.237.89.59:7044",
        "TELEGRAPH_ENGINE_URL": "http://13.237.89.59:8080",
        "TELEGRAPH_DAEMON_URL": "http://13.237.89.59:8081",
        "TELEGRAPH_EVM_PRIVATE_KEY": "0xyour_key_here"
      }
    }
  }
}

或指向本地构建:

{
  "mcpServers": {
    "telegraph": {
      "command": "node",
      "args": ["/path/to/telegraph-mcp/dist/index.js"],
      "env": {
        "TELEGRAPH_NODE_URL": "http://13.237.89.59:7044",
        "TELEGRAPH_ENGINE_URL": "http://13.237.89.59:8080",
        "TELEGRAPH_DAEMON_URL": "http://13.237.89.59:8081",
        "TELEGRAPH_EVM_PRIVATE_KEY": "0xyour_key_here"
      }
    }
  }
}

重启 Claude Desktop。Telegraph 工具将出现在工具列表中。尝试询问 “拉合尔的天气怎么样?” 或 “使用 Telegraph 引擎解释什么是比特币。”

Cursor

添加到 Cursor 设置 → MCP → 添加新的 MCP 服务器:

{
  "mcpServers": {
    "telegraph": {
      "command": "node",
      "args": ["/path/to/telegraph-mcp/dist/index.js"],
      "env": {
        "TELEGRAPH_NODE_URL": "http://13.237.89.59:7044",
        "TELEGRAPH_ENGINE_URL": "http://13.237.89.59:8080",
        "TELEGRAPH_DAEMON_URL": "http://13.237.89.59:8081",
        "TELEGRAPH_EVM_PRIVATE_KEY": "0xyour_key_here"
      }
    }
  }
}

ElizaOS

在你的 Eliza 角色文件或 MCP 插件配置中:

{
  "mcp": {
    "telegraph": {
      "command": "node",
      "args": ["/path/to/telegraph-mcp/dist/index.js"],
      "env": {
        "TELEGRAPH_NODE_URL": "http://13.237.89.59:7044",
        "TELEGRAPH_ENGINE_URL": "http://13.237.89.59:8080",
        "TELEGRAPH_DAEMON_URL": "http://13.237.89.59:8081",
        "TELEGRAPH_EVM_PRIVATE_KEY": "0xyour_key_here"
      }
    }
  }
}

ElizaOS v0.25+ 通过 @elizaos/plugin-mcp 包支持 MCP。在你的角色插件列表中启用它:

{
  "plugins": ["@elizaos/plugin-mcp"]
}

LangChain / LangGraph

LangChain 通过 langchain-mcp-adapters 支持 MCP:

pip install langchain-mcp-adapters
from langchain_mcp_adapters.client import MultiServerMCPClient

client = MultiServerMCPClient({
    "telegraph": {
        "command": "node",
        "args": ["/path/to/telegraph-mcp/dist/index.js"],
        "env": {
            "TELEGRAPH_NODE_URL": "http://13.237.89.59:7044",
            "TELEGRAPH_ENGINE_URL": "http://13.237.89.59:8080",
            "TELEGRAPH_DAEMON_URL": "http://13.237.89.59:8081",
            "TELEGRAPH_EVM_PRIVATE_KEY": "0xyour_key_here",
        },
        "transport": "stdio",
    }
})

tools = client.get_tools()
# Use tools with your LangChain agent

TypeScript/Node.js:

npm install @langchain/mcp-adapters
import { MultiServerMCPClient } from "@langchain/mcp-adapters";

const client = new MultiServerMCPClient({
  telegraph: {
    command: "node",
    args: ["/path/to/telegraph-mcp/dist/index.js"],
    env: {
      TELEGRAPH_NODE_URL: "http://13.237.89.59:7044",
      TELEGRAPH_ENGINE_URL: "http://13.237.89.59:8080",
      TELEGRAPH_DAEMON_URL: "http://13.237.89.59:8081",
      TELEGRAPH_EVM_PRIVATE_KEY: "0xyour_key_here",
    },
    transport: "stdio",
  },
});

const tools = await client.getTools();

OpenClaw

OpenClaw 原生支持 MCP 配置。添加到 openclaw.config.json:

{
  "mcpServers": {
    "telegraph": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/telegraph-mcp/dist/index.js"],
      "env": {
        "TELEGRAPH_NODE_URL": "http://13.237.89.59:7044",
        "TELEGRAPH_ENGINE_URL": "http://13.237.89.59:8080",
        "TELEGRAPH_DAEMON_URL": "http://13.237.89.59:8081",
        "TELEGRAPH_EVM_PRIVATE_KEY": "0xyour_key_here"
      }
    }
  }
}

Goose

Goose 通过其扩展系统支持 MCP 服务器。配置在 ~/.config/goose/config.yaml:

extensions:
  telegraph:
    type: mcp
    command: node
    args:
      - /path/to/telegraph-mcp/dist/index.js
    env:
      TELEGRAPH_NODE_URL: http://13.237.89.59:7044
      TELEGRAPH_ENGINE_URL: http://13.237.89.59:8080
      TELEGRAPH_DAEMON_URL: http://13.237.89.59:8081
      TELEGRAPH_EVM_PRIVATE_KEY: 0xyour_key_here

VS Code / Continue

在 Continue 的 config.json 中:

{
  "experimental": {
    "modelContextProtocolServers": [
      {
        "transport": {
          "type": "stdio",
          "command": "node",
          "args": ["/path/to/telegraph-mcp/dist/index.js"],
          "env": {
            "TELEGRAPH_NODE_URL": "http://13.237.89.59:7044",
            "TELEGRAPH_ENGINE_URL": "http://13.237.89.59:8080",
            "TELEGRAPH_DAEMON_URL": "http://13.237.89.59:8081",
            "TELEGRAPH_EVM_PRIVATE_KEY": "0xyour_key_here"
          }
        }
      }
    ]
  }
}

通用 / 任何 MCP 客户端

该服务器使用 MCP stdio 传输——本地 MCP 服务器的标准方式。任何支持通过 stdio 的 MCP 协议的客户端都可以使用它:

{
  "mcpServers": {
    "telegraph": {
      "command": "node",
      "args": ["/path/to/telegraph-mcp/dist/index.js"],
      "env": {
        "TELEGRAPH_NODE_URL": "http://13.237.89.59:7044",
        "TELEGRAPH_ENGINE_URL": "http://13.237.89.59:8080",
        "TELEGRAPH_DAEMON_URL": "http://13.237.89.59:8081",
        "TELEGRAPH_EVM_PRIVATE_KEY": "0xyour_key_here"
      }
    }
  }
}

动态工具发现

子网工具不是硬编码的。在启动时以及每 5 分钟:

  1. 从 Telegraph 节点的 GET /miner-dispatcher/integrations 获取实时集成

  2. 与当前注册的工具进行差异比较

  3. 添加新子网 → 自动注册工具

  4. 移除过时子网 → 删除工具

  5. 向连接的客户端发送 notifications/tools/list_changed 通知

这意味着:

  • 新子网 在链上注册后 5 分钟内自动出现——无需重启 MCP

  • 已移除的子网 被清理——代理不会调用不存在的工具

  • 代理始终拥有网络可用工具的准确视图

安全性

  • 使用临时钱包。 切勿使用你的主钱包。仅存入推理所需的 USDC。

  • 私钥保留在 MCP 进程中。 绝不暴露给代理或 LLM。

  • MCP 服务器本地运行 通过 stdio——无网络暴露。

  • 支付按次计费:通常每次推理请求 $0.01。

开发

npm install          # Install deps
npm run build        # Compile TypeScript
npm run dev          # Dev mode with tsx (hot reload)
npx @modelcontextprotocol/inspector dist/index.js  # Inspect tools

Related MCP Connectors

Related MCP Servers

  • A
    license
    C
    quality
    D
    maintenance
    Connects AI tools to Telegram via MCP, enabling reading chats, sending messages, managing groups, and more using your own account.
    54
    39 PyPI
    7
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    MCP server that exposes Telegraph Protocol's AI inference APIs as tools with automatic x402 micropayments, enabling any MCP-compatible agent to access AI miners like weather forecasting, deepfake detection, and LLM inference without handling cryptocurrency.
    9
    7 npm
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables agents and users to query the Telegraph network through a hosted MCP endpoint, with tools to ask miners, request specific miners, retrieve intents/recipes, and verify signal hashes on-chain.
    MIT