以太坊安全分析工具集

ETH Security MCP 是一套专为安全分析师、审计员和事件响应团队设计的工具集,提供交易分析、函数签名检索和交易模拟等功能,适用于以太坊区块链安全分析场景。

  • by alexiswilliams010
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 sirocco-k1/eth-security-mcp

使用说明

ETH 安全 MCP(以太坊安全管理协议/中心点,具体含义根据上下文确定)

为安全分析师、审计员和事件响应人员提供的MCP服务器集合。

设置

依赖项

eth-security-mcp 需要安装以下依赖项:

环境变量设置

内部的MCP服务器 eth-security-mcp 可以利用环境变量来传递诸如API密钥之类的信息 .env.example 列出了运行所有MCP服务器所需的相关值。为了设置您的 .env 文件,运行 cp .env.example .env 并填写相关信息。

工作区

这个仓库使用npm工作区来分离每个操作。要与特定的工作区进行交互,请使用 npm <action> -w src/<directory-name>。

构建与调试

这个仓库使用了一个 justfile(注:这可能是一个特定软件或服务的名称,直接翻译为“仅文件”或“纯粹文件”并不准确,因为缺乏上下文,这里保留原英文形式以表示其可能是一个专有名词或特定术语) 使用(某工具或平台)实现构建和调试的自动化 MCP 检查器例如,构建并调试 dune MCP服务器,您可以运行以下命令:

$ just -l
Available recipes:
    build workspace
    debug workspace

$ just debug dune

在Claude桌面安装MCP服务器

要将此仓库中的MCP服务器安装到Claude Desktop中:

  1. 跑 just setup-<machine> <mcp-server> 哪里 machine 是或者 linux 或者 macos,和 mcp-server 是包含您想要安装的MCP服务器的目录名称。

  2. `just` 命令将在 MCP 服务器的目录中生成一个名为(此处应接具体文件名,但原文未给出)的文件 claude.config.tmp.json,可以复制粘贴到以下文件中的 mcpServers:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json
  3. 添加配置信息后,请重启Claude Desktop以使更改生效。

MCP 服务器

此集合包含三台专门用于以太坊安全分析的MCP服务器:

服务器 用途 工具
《沙丘》(Dune) 交易分析与区块链数据 get_transactions_by_address, get_activity_by_address
来源 函数签名和合约源代码 retrieve_function_signature, retrieve_source_code
演员阵容 交易模拟与调试 run_transaction

🔍 沙丘

目的: 访问Dune API端点,以进行结构化交易分析和区块链数据检索。

工具

get_transactions_by_address

描述: 使用Dune的Sim API检索特定地址的交易记录。

参数

参数 类型 必需 描述
中文翻译 英文 日文 韩文
字符串 ✅ 获取交易的地址 block_number
number ❌ 从此区块编号开始过滤交易 chain_ids
字符串 ❌ 以逗号分隔的链ID列表 is_sender
布尔值 ❌ 返回地址为发送方的交易 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 | 中文翻译 | 对应英文 | 中文翻译 | 对应英文 | | block_number | 字符串 | ✅ | 获取代币活动的地址 | | chain_ids | 编号 | ✅ | 返回到此区块编号之前的活动 |

|

| 字符串 | ❌ | 以逗号分隔的链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)
}[]

回报

返回一个包含活动对象的数组,结构如下: 📚 来源

目的:

retrieve_function_signature

访问函数签名数据和合约源代码以进行安全分析。 工具

描述:

从4byte API中检索给定函数选择器的函数签名。 参数 | 参数 | 类型 | 必填 | 描述 | selector |-----------|------|----------|-------------|

|(无对应中文翻译,表示表格分隔)|(无对应中文翻译,表示空列)|(无对应中文翻译,表示空列)|(无对应中文翻译,表示空列)|

{
  best_match: string;      // Most likely function signature (lowest ID)
  all_matches: string[];   // All potential matching signatures
}

retrieve_source_code

| | 字符串 | ✅ | 十六进制函数选择器(例如,“0x70a08231”) |

退货

描述: 从Sourcify检索合约地址的源代码。 参数 address | 参数 | 类型 | 必填 | 描述 | |-----------|------|----------|-------------| chain_id |(无对应中文)|(无对应中文)|(无对应中文)|(无对应中文)|

|

{
  sources: Record<string, {      // Source files
    [filePath: string]: string;  // File path → file content
  }>;
}

| 字符串 | ✅ | 用于检索来源的合约地址 |

| | 编号 | ✅ | 合约部署的链ID |

退货

run_transaction

⚡ 演员阵容 目的:

访问Foundry的铸币命令行工具,用于交易模拟和智能合约交互。

工具 描述: 使用Foundry的`cast run`命令模拟交易,以便进行调试和分析。 transactionHash 参数 | 参数 | 类型 | 必填 | 描述 | rpcUrl |-----------|------|----------|-------------| |(无对应中文翻译)|(无对应中文翻译)|(无对应中文翻译)|(无对应中文翻译)| quick |

| 字符串 | ✅ | 用于模拟的交易哈希 |

|

  • | 字符串 | ✅ | 以太坊节点的RPC URL |
  • |
  • | 布尔值 | ❌ | 使用快速模式以加快模拟速度(默认:false) |
  • 退货