M

MCP 集群管理工具 (模型上下文协议服务器)

@ayv8er/mcp-clusters-api-v1
0 Stars 31 次浏览 ayv8er 更新于 2026-08-23

一种实现了模型上下文协议的服务器,提供了基于钱包的身份验证、集群管理和名称注册服务的端点。

该服务暂未提供标准配置,请参考 README 手动接入

服务介绍

MCP 服务器 - Clusters API v1

这是一个用于 Clusters API v1 的模型上下文协议(MCP)服务器实现。它提供了用于身份验证、集群管理、名称注册等功能的端点。

依赖项

{
  "@modelcontextprotocol/sdk": "^1.7.0",
  "dotenv": "^16.4.7",
  "zod": "^3.24.2"
}

设置

  1. 安装依赖项:
npm install
  1. 创建一个包含以下内容的 .env 文件:CLUSTERS_API_KEY={CLUSTERS_API_KEY}

  2. 构建并启动服务器:

npm run dev

测试端点

由于此服务器使用 StdioServerTransport,您需要通过标准输入发送 JSON-RPC 消息。以下是测试每个端点的示例命令:

身份验证端点

获取消息

echo '{"jsonrpc":"2.0","id":1,"method":"auth_get_message","params":{"address":"0x123...","chainId":1,"nonce":"abc123"}}' | node dist/index.js

获取令牌

echo '{"jsonrpc":"2.0","id":1,"method":"auth_get_token","params":{"signature":"0x123...","signingDate":"2024-03-21","type":"evm","wallet":"0x123..."}}' | node dist/index.js

验证令牌

echo '{"jsonrpc":"2.0","id":1,"method":"auth_validate_token","params":{"authKey":"your-auth-key"}}' | node dist/index.js

集群管理端点

创建集群

echo '{"jsonrpc":"2.0","id":1,"method":"create_cluster","params":{"wallets":[{"address":"0x123...","name":"MyWallet","isPrivate":false}],"authKey":"your-auth-key","testnet":false}}' | node dist/index.js

通过 ID 获取集群

echo '{"jsonrpc":"2.0","id":1,"method":"get_cluster_by_id","params":{"id":"cluster-id","testnet":false}}' | node dist/index.js

通过名称获取集群

echo '{"jsonrpc":"2.0","id":1,"method":"get_cluster_by_name","params":{"name":"cluster-name","testnet":false}}' | node dist/index.js

通过地址获取集群 ID

echo '{"jsonrpc":"2.0","id":1,"method":"get_cluster_id_by_address","params":{"address":"0x123...","testnet":false}}' | node dist/index.js

添加钱包

echo '{"jsonrpc":"2.0","id":1,"method":"add_wallets","params":{"wallets":[{"address":"0x123...","name":"NewWallet","isPrivate":false}],"authKey":"your-auth-key","testnet":false}}' | node dist/index.js

生成钱包

echo '{"jsonrpc":"2.0","id":1,"method":"generate_wallet","params":{"type":"evm","name":"NewWallet","isPrivate":false,"authKey":"your-auth-key","testnet":false}}' | node dist/index.js

更新钱包

echo '{"jsonrpc":"2.0","id":1,"method":"update_wallets","params":{"wallets":[{"address":"0x123...","name":"UpdatedName"}],"authKey":"your-auth-key","testnet":false}}' | node dist/index.js

移除钱包

echo '{"jsonrpc":"2.0","id":1,"method":"remove_wallets","params":{"addresses":["0x123..."],"authKey":"your-auth-key","testnet":false}}' | node dist/index.js

验证钱包

echo '{"jsonrpc":"2.0","id":1,"method":"verify_wallet","params":{"clusterId":"cluster-id","authKey":"your-auth-key","testnet":false}}' | node dist/index.js

地址 ↔ 名称解析端点

通过地址获取数据

echo '{"jsonrpc":"2.0","id":1,"method":"get_data_by_address","params":{"address":"0x123...","testnet":false}}' | node dist/index.js

通过多个地址批量获取数据

echo '{"jsonrpc":"2.0","id":1,"method":"get_bulk_data_by_addresses","params":{"addresses":["0x123...","0x456..."],"testnet":false}}' | node dist/index.js

通过多个名称批量获取数据

echo '{"jsonrpc":"2.0","id":1,"method":"get_bulk_data_by_names","params":{"names":[{"name":"name1"}],"testnet":false}}' | node dist/index.js

注册端点

检查名称可用性

echo '{"jsonrpc":"2.0","id":1,"method":"check_name_availability","params":{"names":["name1","name2"]}}' | node dist/index.js

获取注册签名数据

echo '{"jsonrpc":"2.0","id":1,"method":"get_registration_sign_data","params":{"network":"1","sender":"0x123...","names":[{"name":"name1","amountWei":"1000000000000000000"}],"referralClusterId":"optional-id","testnet":false}}' | node dist/index.js

获取交易状态

echo '{"jsonrpc":"2.0","id":1,"method":"get_transaction_status","params":{"txHash":"0x123..."}}' | node dist/index.js

注意事项

  1. 将占位符值(如 0x123...your-auth-key 等)替换为实际值
  2. 对于大多数端点,testnet 参数是可选的
  3. 所有响应将以 JSON-RPC 2.0 格式返回
  4. 对于需要身份验证的端点,请确保获取并包含有效的 authKey
  5. 服务器使用环境变量进行配置,请确保您的 .env 文件已正确设置

替代测试方法

为了更方便地测试,您可以修改服务器以使用 HTTP 传输而不是 stdio。这样您就可以使用 curl 命令代替 echo 管道。如果您希望切换到 HTTP 传输,请告诉我。