Slither MCP Server
OfficialProvides static analysis for Solidity smart contracts, including contract metadata, function signatures, inheritance, call relationships, security detectors, and source code extraction.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Slither MCP Server list contracts in my Solidity project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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.
Related MCP server: smart-contract-scanner-api
Features
Caching: Slither runs are cached to
{$PROJECT_PATH}/artifacts/project_facts.jsonfor faster subsequent loadsMCP 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-mcpAll 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-mcpUse 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-metricsFor 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 installRunning Tests
uv run pytestAvailable Tools
23 toolsanalyze_eventsA
Analyzes event definitions across the project or for a specific contract. Use this when understanding what events a contract emits, finding indexed parameters, or auditing logging. Returns event names, parameters with types and indexed flags, and source locations. Does not find event emissions; search source code for that. Supports pagination.
Inputs: request (required). Returns: Response containing event analysis.
analyze_low_level_callsA
Finds all functions using low-level calls (call, delegatecall, staticcall, or assembly). Use this for security auditing since low-level calls bypass Solidity's type safety and can introduce vulnerabilities. Returns functions grouped by call type with source locations. Critical for reentrancy and proxy pattern analysis. Supports pagination.
Inputs: request (required). Returns: Response containing low-level call analysis.
analyze_modifiersA
Analyzes custom modifier definitions and their usage across functions. Use this when auditing access control patterns, finding modifier implementations, or understanding function guards. Returns modifier definitions with their source and a list of functions that use each modifier. Supports pagination.
Inputs: request (required). Returns: Response containing modifier analysis.
analyze_state_variablesA
Analyzes state variables across the project or for a specific contract. Use this when auditing storage layout, finding public state, or understanding contract data. Can filter by visibility, include/exclude constants and immutables. Returns variable details including type, visibility, and declaration location. For storage slot layout, use get_storage_layout. Supports pagination.
Inputs: request (required). Returns: Response containing state variable analysis.
export_call_graphA
Exports the project's function call graph in Mermaid or DOT visualization format. Use this when you need a visual representation of function relationships or for documentation. Can filter to specific contracts or entry points only. Returns a string in the requested format suitable for rendering. May be large for big projects; use max_nodes to limit.
Inputs: request (required). Returns: Response containing the call graph.
find_dead_codeA
Finds functions with no callers (potential dead code). Use this during code cleanup, auditing for unused code, or understanding code coverage. Can exclude known entry points (external/public functions), test framework functions, and inherited functions. Returns uncalled functions with their metadata. Some functions may be called dynamically and not detected. Supports pagination.
Inputs: request (required). Returns: Response containing dead code findings.
get_contractA
Gets detailed metadata for a specific contract including inheritance hierarchy, declared and inherited functions, state variables, and events. Use this when you need complete information about a contract after finding it with list_contracts or search_contracts. Returns the full ContractModel with all relationships. For source code, use get_contract_source instead.
Inputs: request (required). Returns: Response containing contract details.
get_contract_dependenciesA
Maps all dependencies for a specific contract including inheritance, external calls, and library usage. Use this when understanding what a contract depends on, finding coupling issues, or detecting circular dependencies. Returns categorized dependencies with optional circular dependency detection.
Inputs: request (required). Returns: Response containing contract dependencies.
get_contract_sourceA
Retrieves the source code of a contract from the original Solidity file. Use this when you need to read the actual implementation after finding a contract with list_contracts. Returns the source code as a string with optional line range filtering via start_line and max_lines parameters. Only returns the contract's portion of the file; for the full file, read it directly.
Inputs: request (required). Returns: Response containing the contract's source file content.
get_derived_contractsA
Gets all contracts that inherit from a specific contract (downward traversal). Use this when finding all implementations of a base contract, understanding the impact of changes to a parent, or discovering contract variants. Returns a recursive tree of child contracts. Set max_depth to limit; returns truncated flag if exceeded.
Inputs: request (required). Returns: Response containing derived contracts.
get_function_calleesA
Gets all functions called by a specific function (outgoing edges in the call graph). Use this when tracing what a function does internally, finding dependencies, or understanding control flow. Returns categorized callees: internal (same contract), external (other contracts), and library calls, plus a flag for low-level calls (call/delegatecall). Does not recurse; call repeatedly to trace deeper.
Inputs: request (required). Returns: Response containing function callees.
get_function_callersA
Gets all functions that call a specific function (incoming edges in the call graph). Use this when finding entry points to a function, understanding usage patterns, or assessing impact of changes. Returns categorized callers: internal, external, and library. Useful for dead code detection and refactoring impact analysis.
Inputs: request (required). Returns: Response containing function callers grouped by call type.
get_function_sourceA
Retrieves the source code of a specific function. Use this when you need to read the implementation details after finding a function with list_functions or search_functions. Returns the function body with line numbers. Requires the function's contract_key and full signature to uniquely identify the function.
Inputs: request (required). Returns: Response containing the function's source code.
get_inherited_contractsA
Gets the inheritance tree of parent contracts (upward traversal). Use this when understanding what a contract inherits, finding the source of inherited functions, or analyzing the inheritance hierarchy. Returns a recursive tree structure with parent contracts and their parents. Set max_depth to limit traversal depth; returns truncated flag if depth exceeded.
Inputs: request (required). Returns: Response containing inherited contracts.
get_project_overviewA
Gets aggregate statistics about the entire project including contract counts by type, function counts by visibility, and security findings by impact level. Use this as a starting point when exploring an unfamiliar codebase or generating project summaries. Returns counts and distributions, not detailed data. Use list_contracts and run_detectors for details.
Inputs: request (required). Returns: Response containing project overview.
get_storage_layoutA
Computes the storage slot layout for a contract showing slot numbers, byte offsets, and variable sizes. Use this for upgrade safety analysis, storage collision detection, or understanding how variables are packed. Returns ordered slot assignments following Solidity's packing rules. Excludes constants and immutables (not in storage). Can include or exclude inherited storage. Supports pagination.
Inputs: request (required). Returns: Response containing storage layout information.
list_contractsA
Lists all contracts in a Solidity project with optional filtering by type and path. Use this when discovering contracts in an unfamiliar codebase, filtering out test/library dependencies, or finding specific contract types like interfaces or abstracts. Returns contract metadata including name, path, type flags (is_abstract, is_interface, is_library), and direct inheritance list. Does not include function details; use get_contract for full contract data. Supports pagination via offset/limit parameters.
Inputs: request (required). Returns: Response containing list of contracts.
list_detectorsA
Lists all available Slither security detectors with their metadata. Use this to discover what security checks are available before running analysis, or to filter detectors by name. Returns detector name, description, impact level (High/Medium/Low/Informational), and confidence level. Does not run detection; use run_detectors for that.
Inputs: request (required). Returns: Response containing list of available detectors.
list_function_implementationsA
Finds all contracts that implement a specific function signature. Use this when looking for overrides of a virtual function, finding all implementations of an interface method, or understanding polymorphism in the codebase. Returns contracts with their implementation details. Matches by signature string. Supports pagination.
Inputs: request (required). Returns: Response containing contracts that implement the function.
list_functionsA
Lists functions across the project or filtered by contract, visibility, and modifier usage. Use this when searching for functions with specific characteristics like external entry points, functions with modifiers, or private helpers. Returns function signatures, visibility, modifiers, arguments, and return types. Does not include function source code; use get_function_source for that. Supports pagination and sorting.
Inputs: request (required). Returns: Response containing list of functions.
run_detectorsA
Gets security findings from Slither's static analysis. Use this to find vulnerabilities, code quality issues, or informational findings in the project. Can filter by specific detectors, impact level, confidence, or exclude paths like tests. Returns findings with descriptions and source locations. Results are cached from initial analysis.
Inputs: request (required). Returns: Response containing detector results.
search_contractsA
Searches for contracts by name using regex pattern matching. Use this when you know part of a contract name but not its exact path or when looking for contracts following a naming convention. Returns matching contracts with full metadata. Case-insensitive by default; set case_sensitive=true for exact matching. Supports pagination.
Inputs: request (required). Returns: Response with matching contracts.
search_functionsA
Searches for functions by name or signature using regex pattern matching. Use this when looking for functions across the codebase by name pattern or parameter types. Can search function names only or full signatures including parameters. Returns matching functions with full metadata. Supports pagination.
Inputs: request (required). Returns: Response with matching functions.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 23 tools
Each tool targets a specific analysis task or information retrieval function. For example, analyze_events is distinct from analyze_low_level_calls, and list_contracts differs from search_contracts. There is no ambiguity between tool purposes.
Tool names follow a consistent verb_noun pattern in snake_case. While the verbs vary (e.g., analyze_, get_, list_, search_), the structure is predictable and each verb is used consistently for related tools.
With 23 tools, the server covers a broad range of Solidity analysis capabilities including security detection, code browsing, call graph analysis, and source retrieval. The count feels well-proportioned for the domain.
The tool set covers the full lifecycle of static analysis: discovering contracts/functions, retrieving source code, analyzing various aspects (events, storage, modifiers, calls), running detectors, and exporting graphs. There are no obvious missing operations for the stated purpose.
Maintenance
Related MCP Connectors
EVM audit (Slither + source + security.txt + MCP-probe + wallet-exposure). 6 tools + /trace.
Self-hosted MCP server: 26 deterministic dev, security, and EVM tools.
EVM Slither audit (zero-arg demo + live) + Blockscout source + security.txt lookup + MCP probe.
Free MCP contract auditing for AI agents and developers. Check tool schemas, detect potential breaking changes between versions, and get structured compatibility findings before deployment. Static analysis only.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables smart contract security auditing using Slither, Aderyn, and custom pattern analysis through the Model Context Protocol, allowing AI assistants to run static analysis and vulnerability checks on Solidity and Vyper contracts.1Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables scanning Solidity smart contracts for 13 vulnerability classes using pattern-based analysis; provides full audit, quick scan, gas analysis, and detector catalog through MCP tools.MIT
- AlicenseAqualityCmaintenanceEnables static security audit of Solidity smart contracts by analyzing source code or deployed bytecode for vulnerabilities, providing risk scores and detailed findings.1MIT
- FlicenseNot gradedqualityBmaintenanceEnables Solidity callgraph and control-flow analysis to detect reentrancy vulnerabilities in smart contracts, with MCP integration for automated security auditing and DeFi vulnerability triage.8-