Flow-MCP 工具
提供了与Flow区块链交互的工具,包括Flow余额查询、代币余额查询以及Cadence拥有的账户信息检索。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"flow": {
"args": [
"-y",
"@outblock/flow-mcp"
],
"command": "npx"
}
}
}
服务介绍
@outblock/flow-mcp
Flow 区块链工具,用于 Model Context Protocol (MCP)。此包提供了一组通过 Model Context Protocol 与 Flow 区块链交互的工具。
功能
- 获取任何地址的 FLOW 余额
- 获取任何 Flow 代币的余额
- 获取 COA 账户信息
- 获取合约源代码
- 获取详细的账户信息,包括存储统计
安装
# Using npm
npm install @outblock/flow-mcp
# Using bun
bun add @outblock/flow-mcp
MCP 配置
要将此工具与 Claude 一起使用,请在您的 MCP 配置中添加以下内容:
{
"mcpServers": {
"flow": {
"command": "npx",
"args": ["-y", "@outblock/flow-mcp"]
}
}
}
您可以在以下位置找到您的 MCP 配置:
- macOS:
~/Library/Application Support/Claude/mcp.json - Windows:
%APPDATA%/Claude/mcp.json - Linux:
~/.config/Claude/mcp.json
添加配置后,重启 Claude 以加载新的 MCP 服务器。
工具
Flow 余额
获取任何地址的 FLOW 余额:
{
name: 'get_flow_balance',
input: {
address: string,
network?: 'mainnet' | 'testnet'
}
}
账户信息
获取详细的账户信息:
{
name: 'get_account_info',
input: {
address: string,
network?: 'mainnet' | 'testnet'
}
}
代币余额
获取任何 Flow 代币的余额:
{
name: 'get_token_balance',
input: {
address: string,
network?: 'mainnet' | 'testnet'
}
}
COA 账户
获取 COA 账户信息:
{
name: 'get_coa_account',
input: {
address: string,
network?: 'mainnet' | 'testnet'
}
}
获取合约
获取合约源代码:
{
name: 'get_contract',
input: {
address: string,
contractName: string,
network?: 'mainnet' | 'testnet'
}
}
📂 项目结构
flow-mcp/
├── src/
│ ├── tools/ # MCP tools implementation
│ │ ├── flowBalance/ # Flow balance tool
│ │ ├── accountInfo/ # Account info tool
│ │ ├── tokenBalance/ # Token balance tool
│ │ ├── coaAccount/ # COA account tool
│ │ └── getContract/ # Contract source tool
│ ├── utils/ # Shared utilities
│ ├── prompts/ # MCP prompts
│ ├── types/ # Type definitions
│ └── bin/ # CLI implementation
├── biome.json # Linting configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Project dependencies
🛠️ 开发
此项目使用 FastMCP 进行开发和测试。FastMCP 为 MCP 服务器提供了简化的开发体验。
# Install dependencies
bun install
# Format code
bun run format
# Run tests
bun test
# Run development server
bun run dev
# Inspect the server
bun run inspect
# Build
bun run build
要将您的开发 MCP 服务器添加到 Claude Desktop 中:
-
构建项目:
bun run build -
添加到您的 Claude Desktop 配置中:
// 如果需要向服务器传递参数,则只需要参数部分 { "mcpServers": { "your-server-name": { "command": "node", "args": ["/path/to/your/project/dist/main.js", "some_argument"] } } }
创建新工具
该项目包含一个脚本,帮助创建新的 MCP 工具:
bun run scripts/create-tool.ts <tool-name>
这将会:
- 在
src/tools/<tool-name>下创建一个新的工具目录 - 生成基本的工具结构,包括:
- index.ts(主要实现)
- schema.ts(工具参数的 JSON 模式)
- test.ts(测试文件)
- 更新工具索引文件以导出新工具
示例:
bun run scripts/create-tool.ts weather
提交消息格式
feat: 新功能(提升次要版本号)fix: 修复错误(提升补丁版本号)BREAKING CHANGE: 破坏性变更(提升主版本号)
📜 版本管理
此项目使用 standard-version 进行自动化版本管理。运行 bun run release 以创建新版本。
📦 发布到 npm
-
确保您已登录到 npm:
npm login -
构建项目:
bun run build -
发布包:
npm publish
请记得在发布新版本之前使用 bun run release 更新版本号。
许可证
MIT 许可证 - 详情请参阅 LICENSE 文件。
贡献
欢迎贡献!请随时提交 Pull Request。