关于 ETH Security MCP
ETH Security MCP 是面向以太坊安全分析人员、审计人员和事件响应人员的 MCP 服务集合,涵盖交易与代币活动查询、合约源码和函数签名检索,以及交易模拟。
主要功能
- 01查询交易和代币活动
- 02检索合约源码
- 03解析函数签名
- 04使用 Foundry cast 模拟交易
适用场景
- 01审查以太坊地址相关活动
- 02检查合约并识别函数签名
- 03模拟交易以查看执行情况和 Gas 用量
MCP 相关
它向 MCP 客户端提供 Dune、Sources 和 Cast 三种专用 MCP 服务,分别用于查询链上活动、合约数据和交易模拟结果。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
ETH Security MCP
为安全分析师、审计人员和事件响应人员提供的一系列 MCP 服务。
设置
依赖项
eth-security-mcp 需要安装以下依赖项:
环境变量设置
eth-security-mcp 中的 MCP 服务可能会使用环境变量传递 API 密钥等信息。.env.example 列出了运行所有 MCP 服务所需的相关值。要设置 .env 文件,请运行 cp .env.example .env 并填写相关信息。
工作区
此代码库使用 npm 工作区来分隔各项操作。要与特定工作区交互,请使用 npm <action> -w src/<directory-name>。
构建和调试
此代码库使用 justfile,通过 MCP Inspector 自动执行构建和调试。例如,要构建和调试 dune MCP 服务,可以运行以下命令:
$ just -l
Available recipes:
build workspace
debug workspace
$ just debug dune
将 MCP 服务安装到 Claude Desktop
要将此代码库中的 MCP 服务安装到 Claude Desktop:
-
运行
just setup-<machine> <mcp-server>,其中machine可以是linux或macos,mcp-server是包含要安装的 MCP 服务的目录名称。 -
just 命令会在 MCP 服务所在目录中生成一个名为
claude.config.tmp.json的文件。将其内容复制并粘贴到以下文件中的mcpServers下:- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - linux:
~/.config/Claude/claude_desktop_config.json
- macOS:
-
添加配置信息后,重启 Claude Desktop 以使更改生效。
MCP 服务
此集合包含三个专用于 Ethereum 安全分析的 MCP 服务:
| 服务 | 用途 | 工具 |
|---|---|---|
| Dune | 交易分析和区块链数据 | get_transactions_by_address、get_activity_by_address |
| Sources | 函数签名和合约源代码 | retrieve_function_signature、retrieve_source_code |
| Cast | 交易模拟和调试 | run_transaction |
🔍 Dune
**用途:**访问 Dune API 端点,进行结构化交易分析并检索区块链数据。
工具
get_transactions_by_address
**说明:**使用 Dune 的 Sim API 检索特定地址的交易。
参数
| 参数 | 类型 | 必需 | 说明 |
|---|---|---|---|
address | string | ✅ | 要查询交易的地址 |
block_number | number | ❌ | 筛选从此区块编号开始的交易 |
chain_ids | string | ❌ | 以逗号分隔的链 ID 列表 |
is_sender | boolean | ❌ | 返回该地址为发送方的交易 |
is_receiver | boolean | ❌ | 返回该地址为接收方的交易 |
返回值
返回一个交易对象数组,结构如下:
{
address: string; // Contract or account address
block_number: number; // Block containing the transaction
data: string; // Raw transaction data
from: string; // Transaction sender address
to: string | null; // Transaction recipient (null for contract creation)
value: string; // ETH amount transferred in wei
logs: Array<{ // Event logs emitted during execution
address: string; // Contract emitting the event
data: string; // Raw event data
topics: string[]; // Event topics
}>;
}[]
get_activity_by_address
**说明:**使用 Dune 的 Sim API 检索特定地址的代币活动。
参数
| 参数 | 类型 | 必需 | 说明 |
|---|---|---|---|
address | string | ✅ | 要查询代币活动的地址 |
block_number | number | ✅ | 返回截至此区块编号的活动 |
chain_ids | string | ❌ | 以逗号分隔的链 ID 列表 |
返回值
返回一个活动对象数组,结构如下:
{
chain_id: number; // Chain ID where activity occurred
block_number: number; // Block containing the activity
block_time: string; // Timestamp of the block
tx_hash: string; // Transaction hash
type: string; // Type of activity (transfer, swap, etc.)
asset_type: string; // Type of asset (erc20, native, etc.)
token_address: string; // Address of the token contract
from: string; // Sender address
to: string; // Receiver address
spender: string; // Spender address (for approvals)
value: string; // Amount transferred
value_usd: number; // USD value of the transfer
token_metadata: { // Token information
symbol: string; // Token symbol
decimals: number; // Token decimals
name: string; // Token name
price_usd: number; // Token price in USD
standard: string; // Token standard (erc20, etc.)
};
function: { // Function call details
signature: string; // Function signature
name: string; // Function name
inputs: { // Function inputs
name: string; // Parameter name
type: string; // Parameter type
value: string; // Parameter value
};
};
contract_metadata: { // Contract information
name: string; // Contract name
};
from_token_address: string; // Source token address (for swaps)
from_token_value: string; // Source token amount (for swaps)
to_token_address: string; // Destination token address (for swaps)
to_token_value: string; // Destination token amount (for swaps)
}[]
📚 Sources
**用途:**访问函数签名数据和合约源代码,以进行安全分析。
工具
retrieve_function_signature
**说明:**从 4byte API 检索给定函数选择器对应的函数签名。
参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
selector | string | ✅ | 十六进制函数选择器(例如:"0x70a08231") |
返回值
{
best_match: string; // Most likely function signature (lowest ID)
all_matches: string[]; // All potential matching signatures
}
retrieve_source_code
描述: 从 Sourcify 获取合约地址对应的源代码。
参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
address | string | ✅ | 要获取源代码的合约地址 |
chain_id | number | ✅ | 部署合约的链 ID |
返回值
{
sources: Record<string, { // Source files
[filePath: string]: string; // File path → file content
}>;
}
⚡ Cast
用途: 使用 Foundry 的 cast 命令行工具进行交易模拟和智能合约交互。
工具
run_transaction
描述: 使用 Foundry 的 cast run 命令模拟交易,以便进行调试和分析。
参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
transactionHash | string | ✅ | 要模拟的交易哈希 |
rpcUrl | string | ✅ | Ethereum 节点的 RPC URL |
quick | boolean | ❌ | 使用快速模式加快模拟速度(默认值:false) |
返回值
返回一个字符串,其中包含:
- 交易执行详情
- 状态变更
- Gas 使用情况
- 回滚原因(如果交易失败)
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。