Token导航 LogoToken导航TokenDH.com
Cast MCP Server logo
开发工具未说明官方级别未说明来源级核验

Cast MCP Server

MCP Server

Cast MCP Server是一个提供AI助手访问Foundry工具包中cast功能的MCP服务器,支持与以太坊区块链网络交互。

工具数

17

提示词数

0

GitHub Stars

0

资源数

0
命令行工具RustClaudeClaude DesktopClaudeCursor

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

liyue201

提供方

liyue201

最后核验

2026/5/17 20:22

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

强制MCP服务器

一种模型上下文协议(MCP)服务器,为AI助手提供访问 投射 Foundry工具包中的工具。

Cast是一个强大的命令行工具,用于与以太坊区块链网络进行交互。此MCP服务器将cast的功能作为可调用工具公开,AI模型可以通过MCP协议使用这些工具。

特性

链条工具

  • chain:获取当前链的符号名称
  • chain_id:获取当前链的链ID
  • client:获取当前客户端版本
  • age:获取块的时间戳

块工具

  • block:获取有关块的详细信息
  • block_number:获取特定区块或最新区块的区块编号
  • age:获取块的时间戳
  • gas_price:获取当前的天然气价格

帐户工具

  • balance:在wei或ether中获取账户余额
  • nonce:获取帐户的nonce
  • code:获取合约的字节码(可选反汇编)
  • code_size:获取合约字节码的大小(以字节为单位)
  • storage:获取特定插槽的存储值

实用工具

  • max_int:获取有符号整数类型(int8、int16、int32、int64、int256)的最大值
  • min_int:获取有符号整数类型(int8、int16、int32、int64、int256)的最小值
  • max_uint:获取无符号整数类型(uint8、uint16、uint32、uint64、uint256)的最大值
  • address_zero:获取零以太坊地址(0x0000000000000000000000000000000000)
  • hash_zero:获取零哈希值(0x0000000000000000000000000000000000000000000000000000000000)

快速开始

先决条件

  • Rust 1.91.0(通过Rust-toolchain.toml自动管理)
  • 支持MCP协议的AI客户端(如Claude Desktop、Cursor或其他兼容MCP的客户端)
  • 访问以太坊RPC端点(默认:http://localhost:8545)

安装

# Clone the repository
git clone 
cd cast-mcp-server

# Build the project
make build
# Or use cargo directly
cargo build --release

# The executable will be located at:
# ./target/release/cast-mcp-server

跑步

# Run in development mode
cargo run

# Run in production mode
./target/release/cast-mcp-server

配置

环境变量

服务器支持以下环境变量配置:

# Set log level (options: trace, debug, info, warn, error)
# Default: debug
RUST_LOG=info

# Note: RPC endpoints are configured per-tool via parameters
# Default RPC endpoint: http://localhost:8545

用法示例

在启用MCP的AI客户端中配置此服务器:

Claude桌面配置

添加到您的Claude桌面配置文件中:

{
  "mcpServers": {
    "cast-mcp-server": {
      "command": "/path/to/cast-mcp-server/target/release/cast-mcp-server",
      "args": []
    }
  }
}

通用MCP客户端配置

对于其他MCP兼容客户端,请使用以下配置服务器:

  • 命令:编译二进制文件的路径
  • 参数:无需(空数组)
  • 工作目录:项目根目录

工具使用示例

以下是如何使用可用工具的示例:

块工具

{
  "name": "block",
  "arguments": {
    "rpc": "https://mainnet.infura.io/v3/YOUR_PROJECT_ID",
    "block": "latest",
    "full": true,
    "fields": ["number", "timestamp", "gasUsed"]
  }
}
{
  "name": "block_number",
  "arguments": {
    "rpc": "https://mainnet.infura.io/v3/YOUR_PROJECT_ID",
    "block": "latest"
  }
}
{
  "name": "age",
  "arguments": {
    "rpc": "https://mainnet.infura.io/v3/YOUR_PROJECT_ID",
    "block": "1000000"
  }
}
{
  "name": "gas_price",
  "arguments": {
    "rpc": "https://mainnet.infura.io/v3/YOUR_PROJECT_ID"
  }
}

帐户工具

{
  "name": "balance",
  "arguments": {
    "rpc": "https://mainnet.infura.io/v3/YOUR_PROJECT_ID",
    "who": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
    "ether": true
  }
}
{
  "name": "nonce",
  "arguments": {
    "rpc": "https://mainnet.infura.io/v3/YOUR_PROJECT_ID",
    "who": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
    "block": "latest"
  }
}
{
  "name": "code_size",
  "arguments": {
    "rpc": "https://mainnet.infura.io/v3/YOUR_PROJECT_ID",
    "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
    "block": "latest"
  }
}

所有工具都支持以下常见参数:

  • rpc:以太坊RPC端点URL(默认值:http://localhost:8545)
  • :块标识符(数字、哈希或“最新”、“已完成”、“安全”、“最早”、“待定”等标签)

发展

代码格式化

# Format code (requires nightly toolchain)
make fmt
# Or
cargo +nightly fmt

掉毛

# Run clippy linter
cargo clippy

# Run clippy with all features and stricter warnings
cargo clippy --all-targets --all-features -- -D warnings

清洁建筑

make clean
# Or
cargo clean

测试

# Run all tests
cargo test

# Run tests with verbose output
cargo test -- --nocapture

# Run specific test modules
cargo test common::account_tools
cargo test common::block_tools
cargo test common::chain_tools
cargo test common::utility_tools

# Run integration tests (if available)
cargo test --test integration_test

贡献

欢迎投稿!以下是您可以提供帮助的方式:

开发设置

  1. 分叉此存储库
  2. 克隆你的叉子: git clone https://github.com/your-username/cast-mcp-server.git
  3. 创建要素分支: git checkout -b feature/amazing-feature
  4. 进行更改
  5. 设置代码格式: make fmt
  6. 测试您的更改: cargo test
  7. 提交您的更改: git commit -am 'Add amazing feature'
  8. 推到分支: git push origin feature/amazing-feature
  9. 打开拉取请求

代码规范

  • 遵循现有的代码风格(由rustfmt强制执行)
  • 添加新功能的测试
  • 根据需要更新文档
  • 在提交PR之前,确保所有测试都通过

报告问题

请包括:

  • 对问题的清晰描述
  • 重现步骤
  • 预期行为与实际行为
  • 环境信息(操作系统、Rust版本等)

许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

致谢

相关链接

目录标签

目录标签

命令行工具RustClaude区块链工具本地部署以太坊交互MCP协议智能合约

支持客户端

Claude DesktopClaudeCursor

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

17

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP