区块链模型协议服务器

Hathor MCP是一个连接AI助手与Hathor区块链全节点的模型上下文协议服务器,支持查询区块链状态、管理钱包、处理智能合约等功能。

  • by HathorNetwork
  • Rust
  • 本地部署
  • 更新于
在 GitHub 查看 HathorNetwork/hathor-mcp

使用说明

哈索尔MCP

用于Hathor网络的MCP(模型上下文协议)服务器。将Claude等AI助手连接到任何Hathor全节点。

特性

  • 查询区块链状态(区块、交易、节点状态)
  • 通过钱包无头管理钱包(创建、充值、发送、检查余额)
  • 使用纳米合约/蓝图(发布、创建、执行、查询状态)
  • 水龙头操作(从fullnode的内置钱包发送)
  • 两种传输模式:HTTP和stdio(适用于Claude Desktop)

快速开始

# Build
cargo build --release

# Run with default settings (fullnode at localhost:8080)
./target/release/hathor-mcp

# Connect to a specific fullnode
./target/release/hathor-mcp \
  --fullnode-url http://my-node:8080 \
  --wallet-headless-url http://my-node:8001

# Use stdio transport for Claude Desktop
./target/release/hathor-mcp --stdio

CLI选项

标志 默认值 描述
--bind 127.0.0.1 HTTP侦听地址。使用 0.0.0.0 只有当你想暴露端口时
--port 9876 HTTP服务器端口
--fullnode-url http://127.0.0.1:8080 Hathor完整节点API URL
--wallet-headless-url http://localhost:8001 钱包无头服务URL
--tx-mining-url http://localhost:8002 Tx挖矿服务URL
--orchestrator-url (未设置) 多租户模式的无头编排器URL
--auth-token (已生成) 承载令牌客户端必须存在;还阅读 HATHOR_MCP_TOKEN.如果未设置,则自动生成到stderr
--no-auth false 禁用/mcp上的承载身份验证(仅限环回)
--stdio false 使用stdio传输而不是HTTP

认证

HTTP模式要求每个节点上都有一个承载令牌 /mcp 和 /mcp/sse 请求:

Authorization: Bearer <token>

如果 --auth-token 和 HATHOR_MCP_TOKEN 如果两者都未设置,启动时会生成一个随机的32字节令牌并打印到stderr。集 HATHOR_MCP_TOKEN (或 --auth-token)在重启过程中重复使用固定值。使用 --no-auth 仅当您确定没有其他进程可以到达该端口时,才在环回绑定上。

这 /health 端点未经身份验证,因此容器编排器可以对其进行健康检查。

MCP配置

克劳德代码(.mcp.json)

{
  "mcpServers": {
    "hathor": {
      "type": "http",
      "url": "http://127.0.0.1:9876/mcp"
    }
  }
}

克劳德桌面

{
  "mcpServers": {
    "hathor": {
      "command": "/path/to/hathor-mcp",
      "args": ["--stdio", "--fullnode-url", "http://127.0.0.1:8080"]
    }
  }
}

可用工具

区块链

  • get_node_status --节点状态、块高度、网络信息
  • get_blocks --最近区块(可配置计数)
  • get_transaction --按哈希计算的交易详细信息

钱包操作

  • generate_seed --生成BIP39种子短语
  • create_wallet / close_wallet --管理钱包。生成的种子在中内联返回 create_wallet的响应,并且从不存储在服务器端
  • get_wallet_status / get_wallet_balance / get_wallet_addresses
  • send_from_wallet --发送HTR

水龙头

  • get_faucet_balance --全节点钱包余额
  • send_from_faucet --从全节点钱包发送
  • fund_wallet --从水龙头自动充值钱包

纳米合约

  • list_blueprints / get_blueprint_info
  • publish_blueprint --在链上部署Python蓝图
  • create_nano_contract --实例化蓝图
  • execute_nano_contract --调用合约方法
  • get_nano_contract_state / get_nano_contract_history / get_nano_contract_logs

配置

  • get_service_urls --检查配置的端点URL(URL在启动时是固定的)

许可证

麻省理工学院