Back to MCP directory
publicPublicdnsLocal runtime

flow-mcp

Flow区块链MCP工具包,提供账户查询、代币余额、合约源码等交互功能

article

README

🚀 @outblock/flow-mcp

@outblock/flow-mcp 是一个Flow区块链工具包,专门用于模型上下文协议(MCP)。此工具包提供了一系列与Flow区块链交互的实用工具,能帮助开发者轻松实现多种功能。

🚀 快速开始

本工具包提供了与Flow区块链交互的能力,可用于获取账户余额、合约代码等信息,还支持转账等操作。

✨ 主要特性

  • 获取任意地址的FLOW余额
  • 获取任意Flow代币的余额
  • 获取COA账户信息
  • 获取合约源代码
  • 获取详细的账户信息,包括存储统计信息

📦 安装指南

你可以使用以下命令进行安装:

# 使用npm
npm install @outblock/flow-mcp

# 使用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

工具使用

获取FLOW余额
export interface GetFlowBalanceParams {
  address: string;
}

export async function getFlowBalance(params: GetFlowBalanceParams): Promise<Balance>;
获取代币余额
export interface GetTokenBalanceParams {
  address: string;
  tokenAddress: string;
}

export async function getTokenBalance(params: GetTokenBalanceParams): Promise<TokenBalance>;
转账
export interface TransferParams {
  from: string;
  to: string;
  amount: number;
}

export async function transfer(params: TransferParams): Promise<TransactionReceipt>;

📚 详细文档

项目结构

flow-mcp/
├── src/
│   ├── index.ts          # 主入口文件
│   ├── utils/           # 工具函数
│   │   └── balance.ts    # 处理余额相关逻辑
│   ├── types/           # 定义类型和接口
│   │   └── types.ts      # 包含Balance、TokenBalance等类型定义
│   └── transactions/    # 交易处理逻辑
│       └── transfer.ts   # 处理转账事务
├── package.json         # 项目依赖和配置
└── README.md            # 项目文档

开发

# 安装依赖
bun install

# 格式化代码
bun run format

# 运行测试
bun test

# 提交代码
git add .
git commit -m "feat: 新功能"

创建新工具

使用脚本创建新工具:

bun run scripts/create-tool.ts new-feature

提交信息格式

  • feat: 新功能(主版本号不变,次版本号递增)
  • fix: 修复bug(主版本号和次版本号都不变,补丁版本号递增)
  • BREAKING CHANGE: 破坏性更改(主版本号递增)

版本管理

使用standard-version进行版本管理:

bun run release

发布到npm

  1. 登录npm:
    npm login
    
  2. 构建项目:
    bun run build
    
  3. 发布包:
    npm publish
    

请确保在发布新版本之前使用bun run release更新版本号。

📄 许可证

本项目采用MIT License,详情请参阅LICENSE文件。

贡献

欢迎贡献!请随意提交Pull Request。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client