slither-mcp
by trailofbits·★ 89·综合分 48
一个包装 Slither 的 MCP 服务器,用于静态分析 Solidity 智能合约。
概述
Slither MCP 服务器通过模型上下文协议为 Solidity 智能合约提供全面的静态分析功能。它包装了 Slither 分析工具,将合约元数据、函数签名、继承层次结构和安全漏洞作为 MCP 工具暴露出来。该服务器包含缓存功能以便更快地后续分析,并提供用于检查代码结构的查询工具和用于检测漏洞的安全分析工具。它由知名的区块链安全公司 Trail of Bits 维护,似乎正在积极维护中。
试试问 AI
装完之后,这里有 7 个你可以让 AI 做的事:
什么时候选它
当您需要将 Solidity 合约的静态安全分析集成到 AI 工作流或开发流程中时,选择这个服务器。
什么时候不要选它
如果您需要实时分析或处理非 Solidity 智能合约语言,不要选择这个服务器。
此 server 暴露的工具
从 README 抽取出 12 个工具list_contractsList contracts with filters by type or path pattern
get_contractGet detailed contract information including functions and inheritance
get_contract_sourceGet the complete source code of a contract's Solidity file
get_function_sourceGet source code for a specific function with line numbers
list_functionsList functions with filters by contract, visibility, or modifiers
function_calleesGet function call relationships including internal, external, and library calls
function_callersGet all functions that call a target function grouped by call type
get_inherited_contractsGet a recursive tree of all contracts that a contract inherits from
get_derived_contractsGet a recursive tree of all contracts that inherit from a contract
list_function_implementationsFind all implementations of a function signature across contracts
list_detectorsList available Slither detectors with metadata
run_detectorsGet detector results with filtering by name, impact, or confidence
可对比工具
安装
安装
此项目使用 UV 进行包管理:
# 安装依赖
uv sync
# 或者在开发模式下安装
uv pip install -e .使用
基本用法
启动 Slither MCP 服务器:
uv run slither-mcpClaude Desktop 配置
添加到 claude_desktop_config.json:
{
"mcpServers": {
"slither-mcp": {
"command": "uvx",
"args": ["--from", "git+https://github.com/trailofbits/slither-mcp", "slither-mcp"]
}
}
}FAQ
- Slither MCP 收集哪些指标?
- Slither MCP 收集工具调用事件(使用哪些工具)和成功/失败状态。它不收集工具调用参数、合约详情、函数名称或任何项目特定信息。指标默认启用,但可以使用 --disable-metrics 标志禁用。
- 支持哪些 Solidity 项目设置?
- 该服务器支持任何可以被 Slither 分析的 Solidity 项目,包括 Foundry、Hardhat 和其他流行的开发框架。项目会自动缓存到 <path>/artifacts/project_facts.json 中以便更快后续查询。
- 我可以将 Slither MCP 用作常规 API 吗?
- 是的,该包包含一个类型化的 Python 客户端(SlitherMCPClient),用于以编程方式与 Slither MCP 服务器交互。这可用于构建需要查询 Solidity 项目的工具、脚本或代理,而无需在 MCP 环境中使用。
slither-mcp 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。