TS

trailofbits/slither-mcp

开发工具官方

本页由 AI 翻译,技术细节请以原文为准。 查看原文

99 stars 11 forks 质量 69 趋势 0AGPL-3.0

trailofbits/slither-mcp 是从 https://github.com/trailofbits/slither-mcp. 导入的 MCP 服务器候选

概览

trailofbits/slither-mcp 是从 https://github.com/trailofbits/slither-mcp. 导入的 MCP 服务器候选

概述(AI 翻译)

一款模型上下文协议(MCP)服务器,为使用 Slither 的 Solidity 智能合约提供静态分析能力。

概述

该MCP服务器包裹了Slither静态分析功能,使其通过模型上下文协议(Model Context Protocol)能够访问。它可以分析Solidity项目(如Foundry、Hardhat等),并生成关于契约、函数、继承层级等的全面元数据。

你也可以把 Slither MCP 作为一个易用的 Slither API,用于其他用例。

特色

  • 缓存:Slither运行缓存到{$PROJECT_PATH}/artifacts/project_facts.json以实现更快的后续加载
  • MCP 工具:通过 MCP 工具查询合同和功能信息
  • 安全分析:运行Slither检测器并访问过滤结果
  • 全面分析:摘录以下详细信息:
  • 合同元数据(抽象、接口、库标志)
  • 函数签名和修饰符
  • 继承层级
  • 函数调用关系(内部调用、外部调用、库调用)
  • 安全漏洞和代码质量问题
  • 源代码位置

虽然这是v1.0版本,但我们预计随着更多反馈,API会有所变化。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Slither MCP Server

A Model Context Protocol (MCP) server that provides static analysis capabilities for Solidity smart contracts using Slither.

Overview

This MCP server wraps Slither static analysis functionality, making it accessible through the Model Context Protocol. It can analyze Solidity projects (Foundry, Hardhat, etc.) and generate comprehensive metadata about contracts, functions, inheritance hierarchies, and more.

You can also use Slither MCP as an easy-to-use Slither API for other use cases.

Features

  • Caching: Slither runs are cached to {$PROJECT_PATH}/artifacts/project_facts.json for faster subsequent loads
  • MCP Tools: Query contract and function information through MCP tools
  • Security Analysis: Run Slither detectors and access results with filtering
  • Comprehensive Analysis: Extracts detailed information about:
    • Contract metadata (abstract, interface, library flags)
    • Function signatures and modifiers
    • Inheritance hierarchies
    • Function call relationships (internal, external, library calls)
    • Security vulnerabilities and code quality issues
    • Source code locations

While this is a v1.0 release, we anticipate API changes as we receive more feedback.

Installation

This project uses UV for package management:

# Install dependencies
uv sync

# Or install in development mode
uv pip install -e .

Usage

Basic Usage

Start the Slither MCP server:

uv run slither-mcp

All tools accept a path parameter that specifies which Solidity project to analyze. Projects are automatically cached in /artifacts/project_facts.json for faster subsequent queries.

Use in Claude Code

claude mcp add --transport stdio --scope user slither -- uvx --from git+https://github.com/trailofbits/slither-mcp slither-mcp

Use in Cursor

Make sure uvx is on your Cursor path using sudo ln -s ~/.local/bin/uvx /usr/local/bin/uvx

In your ~/.cursor/mcp.json:

{
  "mcpServers": {
    "slither-mcp": {
      "command": "uvx --from git+https://github.com/trailofbits/slither-mcp slither-mcp",
    }
  }
}

Metrics and Privacy

Slither MCP includes opt-out metrics to help improve reliability by letting us know how often LLMs use each tool and their successful call rate. Metrics are enabled by default but can be permanently disabled.

What We Collect

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "slither-mcp": { "command": "uvx --from git+https://github.com/trailofbits/slither-mcp slither-mcp", } } }