集群管理API服务

MCP Server - Clusters API v1 是一个提供认证、集群管理、名称注册和社区注册功能的API服务。

  • by ayv8er
  • TypeScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 ayv8er/mcp-clusters-api-v1

使用说明

MCP服务器-集群API v1

这是用于集群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,您需要通过stdin发送JSON-RPC消息。以下是测试每个端点的示例命令:

身份验证端点

获取消息

echo '{"jsonrpc":"2.0","id":1,"method":"get_signing_message"}' | node dist/index.js

获取令牌

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

验证令牌

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

群集管理端点

创建群集

echo '{"jsonrpc":"2.0","id":1,"method":"create_a_cluster","params":{"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":"new-wallet","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":"new-wallet","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":"updated-name"}],"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_name_by_address","params":{"address":"0x123","testnet":false}}' | node dist/index.js

按地址获取所有姓名

echo '{"jsonrpc":"2.0","id":1,"method":"get_all_names_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":"name-1"},{"name":"name-2"}],"testnet":false}}' | node dist/index.js

注册端点

检查名称可用性

echo '{"jsonrpc":"2.0","id":1,"method":"check_name_availability","params":{"names":["name-1","name-2"],"testnet":false}}' | 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","testnet":false}}' | node dist/index.js

社区端点

检查社区名称可用性

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

注册社区名称

echo '{"jsonrpc":"2.0","id":1,"method":"register_community_name","params":{"authKey":"your-auth-key","communityName":"some_community","name":"some_name","walletAddress":"your-wallet-address","testnet":false}}' | node dist/index.js

备注

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