Flow MCP服务器
用于与Flow区块链交互的模型上下文协议(MCP)服务器。该服务器使AI助手能够访问Flow区块链数据,并通过标准化的界面执行操作。
特性
- Flow和可互换代币的余额检查
- 域解析
.find和.fn领域 - 读取区块链数据的脚本执行
- 交易提交和监控
- 账户信息检索
- 基于环境变量的流配置
安装
使用npx(推荐)
npx -y @outblock/flow-mcp-server --stdio或者使用端口指定HTTP模式:
npx -y @outblock/flow-mcp-server --port 3000本地安装(用于开发)
git clone https://github.com/lmcmz/flow-mcp-server.git
cd flow-mcp-server
npm install
npm run build
npm start用法
使用npx运行
# Run in stdio mode (for AI assistant integration)
npx -y @outblock/flow-mcp-server --stdio
# Run as HTTP server on port 3000
npx -y @outblock/flow-mcp-server --port 3000
# Specify Flow network
npx -y @outblock/flow-mcp-server --port 3000 --network testnet运行本地开发服务器
# Run in stdio mode
npm run build
npm start
# Run as HTTP server on port 3000
npm run build
PORT=3000 npm start
# For development with auto-reload
npm run dev配置
可以使用环境变量配置服务器:
PORT-要侦听的HTTP端口(如果未设置,则默认为stdio模式)FLOW_NETWORK-要连接的流网络(主网、测试网、仿真器)FLOW_ACCESS_NODE-自定义流访问节点URLLOG_LEVEL-日志记录级别(调试、信息、警告、错误)
使用AI助手
当与Claude等AI助手集成时,您可以在stdio模式下启动MCP服务器,并将其连接到助手的工具配置。
Claude工具配置示例:
{
"tools": [
{
"name": "flow-mcp-server",
"command": "npx -y @outblock/flow-mcp-server --stdio"
}
]
}HTTP API终结点
在HTTP模式下运行时,以下端点可用:
/sse-用于实时更新的服务器发送事件端点/messages-用于发送工具请求的POST端点/health-健康检查端点/-服务器信息
示例HTTP API调用:
curl -X POST http://localhost:3000/messages \
-H "Content-Type: application/json" \
-d '{
"tool_request": {
"name": "get_balance",
"parameters": {
"address": "0x2d4c3caffbeab845",
"network": "mainnet"
}
}
}'可用工具
get_balance-获取地址的流量平衡get_token_balance-获取可替代代币余额get_account-获取帐户信息resolve_domain-将.find或.fn域解析为一个地址execute_script-执行Cadence脚本send_transaction-将交易发送到区块链get_transaction-按ID获取交易详情
版本历史记录
- v0.1.1 -修复事务服务中formatArguments导入问题的错误
- v0.1.0 -与Flow区块链基本集成的初始版本
许可证
麻省理工学院
