loading…
Search for a command to run...
loading…
Enables static analysis of Solidity smart contracts using Slither, including contract metadata, function details, inheritance, and security detectors through MC
Enables static analysis of Solidity smart contracts using Slither, including contract metadata, function details, inheritance, and security detectors through MCP tools.
Tests Python 3.11+ License: AGPL v3
A Model Context Protocol (MCP) server that provides static analysis capabilities for Solidity smart contracts using Slither.
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.
{$PROJECT_PATH}/artifacts/project_facts.json for faster subsequent loadsWhile this is a v1.0 release, we anticipate API changes as we receive more feedback.
This project uses UV for package management:
# Install dependencies
uv sync
# Or install in development mode
uv pip install -e .
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.
claude mcp add --transport stdio --scope user slither -- uvx --from git+https://github.com/trailofbits/slither-mcp slither-mcp
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",
}
}
}
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.
We do not collect: tool call parameters, contract details, function names, or any project-specific information.
To permanently opt out:
uv run slither-mcp --disable-metrics
For complete details, see METRICS.md.
The server exposes tools for querying contract and function information. All tools accept a path parameter that specifies the Solidity project directory to analyze.
list_contracts - List contracts with filtersRequires: path (project directory)
Filter contracts by type (concrete, abstract, interface, library) or path pattern.
get_contract - Get detailed contract informationRetrieve full contract metadata including functions, inheritance, and flags.
get_contract_source - Get contract source codeReturns the complete source code of the Solidity file containing the specified contract.
get_function_source - Get function source codeReturns the source code for a specific function with line numbers. Useful for focused analysis.
list_functions - List functions with filtersFilter functions by contract, visibility, or modifiers.
function_callees - Get function call relationshipsReturns internal, external, and library callees for a function, including low-level call detection.
function_callers - Get functions that call a target functionReturns all functions that call the specified target function, grouped by call type (internal, external, library). This is the inverse of function_callees.
get_inherited_contracts - Get contract inheritanceReturns a recursive tree of all contracts that a contract inherits from (parents and ancestors).
get_derived_contracts - Get contracts that inherit from this oneReturns a recursive tree of all contracts that inherit from a contract (children and descendants).
list_function_implementations - Find function implementationsFind all implementations of a function signature across contracts.
list_detectors - List available Slither detectorsReturns metadata about Slither detectors including names, descriptions, impact levels, and confidence ratings. Supports filtering by name or description.
run_detectors - Get detector results with filteringReturns 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.
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:
For detailed usage examples and documentation, see CLIENT_USAGE.md.
Install pre-commit hooks to run linting before commits:
pre-commit install
uv run pytest
Выполни в терминале:
claude mcp add slither-mcp-server -- npx Безопасность
Низкий рискАвтоматическая эвристика по публичным данным — не гарантия безопасности.