Slither MCP Server

Slither MCP Server

Enables static analysis of Solidity smart contracts using Slither, including contract metadata, function details, inheritance, and security detectors through MCP tools.

Category
访问服务器

README

Slither MCP Server

Tests Python 3.11+ License: AGPL v3 <!-- PyPI version -->

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 <path>/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

  • Tool call events (which tools are used)
  • Success/failure status

We do not collect: tool call parameters, contract details, function names, or any project-specific information.

Disabling Metrics

To permanently opt out:

uv run slither-mcp --disable-metrics

For complete details, see METRICS.md.

MCP Tools

The server exposes tools for querying contract and function information. All tools accept a path parameter that specifies the Solidity project directory to analyze.

Query Tools

1. list_contracts - List contracts with filters

Requires: path (project directory) Filter contracts by type (concrete, abstract, interface, library) or path pattern.

2. get_contract - Get detailed contract information

Retrieve full contract metadata including functions, inheritance, and flags.

3. get_contract_source - Get contract source code

Returns the complete source code of the Solidity file containing the specified contract.

4. get_function_source - Get function source code

Returns the source code for a specific function with line numbers. Useful for focused analysis.

5. list_functions - List functions with filters

Filter functions by contract, visibility, or modifiers.

6. function_callees - Get function call relationships

Returns internal, external, and library callees for a function, including low-level call detection.

7. function_callers - Get functions that call a target function

Returns all functions that call the specified target function, grouped by call type (internal, external, library). This is the inverse of function_callees.

8. get_inherited_contracts - Get contract inheritance

Returns a recursive tree of all contracts that a contract inherits from (parents and ancestors).

9. get_derived_contracts - Get contracts that inherit from this one

Returns a recursive tree of all contracts that inherit from a contract (children and descendants).

10. list_function_implementations - Find function implementations

Find all implementations of a function signature across contracts.

11. list_detectors - List available Slither detectors

Returns metadata about Slither detectors including names, descriptions, impact levels, and confidence ratings. Supports filtering by name or description.

12. run_detectors - Get detector results with filtering

Returns cached detector results. Filter by detector names, impact level (High, Medium, Low, Informational), or confidence level (High, Medium, Low).

All tools return responses with a success boolean and either data fields or an error_message. See individual tool implementations in slither_mcp/tools/ for detailed schemas and usage.

Client Usage

The slither-mcp package includes a typed Python client (SlitherMCPClient) for programmatically interacting with the Slither MCP server. This is useful for building tools, scripts, or agents that need to query Solidity projects.

The client provides:

  • Type-safe methods for all MCP tools
  • Automatic serialization/deserialization of Pydantic models
  • Helper methods for common patterns
  • Tool wrappers for pydantic-ai agent integration

For detailed usage examples and documentation, see CLIENT_USAGE.md.

Requirements

  • Python 3.11+
  • Solidity compiler setup (Foundry, Hardhat, or similar)
  • Slither and its dependencies

Development

Pre-commit Hooks

Install pre-commit hooks to run linting before commits:

pre-commit install

Running Tests

uv run pytest

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选