Skip to content
Back to search

slither-mcp

MCP server for Slither static analysis of Solidity smart contracts

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/trailofbits--slither-mcp/badge.svg)](/listings/trailofbits--slither-mcp)

HTML

<a href="/listings/trailofbits--slither-mcp"><img src="/api/listings/trailofbits--slither-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

This project uses [UV](https://github.com/astral-sh/uv) for package management:

# Install dependencies
uv sync

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

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 178 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Slither MCP Server
  2. [![Tests](https://github.com/trailofbits/slither-mcp/actions/workflows/test.yml/badge.svg)](https://github.com/trailofbits/slither-mcp/actions/workflows/test.yml)
  3. [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
  4. [![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)
  5. <!-- [![PyPI version](https://badge.fury.io/py/slither-mcp.svg)](https://badge.fury.io/py/slither-mcp) -->
  6. A Model Context Protocol (MCP) server that provides static analysis capabilities for Solidity smart contracts using [Slither](https://github.com/crytic/slither).
  7. ## Overview
  8. 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.
  9. You can also use Slither MCP as an easy-to-use Slither API for other use cases.
  10. ## Features
  11. - **Caching**: Slither runs are cached to `{$PROJECT_PATH}/artifacts/project_facts.json` for faster subsequent loads
  12. - **MCP Tools**: Query contract and function information through MCP tools
  13. - **Security Analysis**: Run Slither detectors and access results with filtering
  14. - **Comprehensive Analysis**: Extracts detailed information about:
  15. - Contract metadata (abstract, interface, library flags)
  16. - Function signatures and modifiers
  17. - Inheritance hierarchies
  18. - Function call relationships (internal, external, library calls)
  19. - Security vulnerabilities and code quality issues
  20. - Source code locations
  21. While this is a v1.0 release, we anticipate API changes as we receive more feedback.
  22. ## Installation
  23. This project uses [UV](https://github.com/astral-sh/uv) for package management:
  24. ```bash
  25. # Install dependencies
  26. uv sync
  27. # Or install in development mode
  28. uv pip install -e .
  29. ```
  30. ## Usage
  31. ### Basic Usage
  32. Start the Slither MCP server:
  33. ```bash
  34. uv run slither-mcp
  35. ```
  36. 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.
  37. ### Use in Claude Code
  38. ```bash
  39. claude mcp add --transport stdio --scope user slither -- uvx --from git+https://github.com/trailofbits/slither-mcp slither-mcp
  40. ```
  41. ### Use in Cursor
  42. Make sure uvx is on your Cursor path using `sudo ln -s ~/.local/bin/uvx /usr/local/bin/uvx`
  43. In your `~/.cursor/mcp.json`:
  44. ```json
  45. {
  46. "mcpServers": {
  47. "slither-mcp": {
  48. "command": "uvx --from git+https://github.com/trailofbits/slither-mcp slither-mcp",
  49. }
  50. }
  51. }
  52. ```
  53. ## Metrics and Privacy
  54. 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.
  55. ### What We Collect
  56. - Tool call events (which tools are used)
  57. - Success/failure status
  58. **We do not collect**: tool call parameters, contract details, function names, or any project-specific information.
  59. ### Disabling Metrics
  60. To permanently opt out:
  61. ```bash
  62. uv run slither-mcp --disable-metrics
  63. ```
  64. **For complete details**, see [METRICS.md](METRICS.md).
  65. ## MCP Tools
  66. The server exposes tools for querying contract and function information. **All tools accept a `path` parameter** that specifies the Solidity project directory to analyze.
  67. ### Query Tools
  68. ### 1. `list_contracts` - List contracts with filters
  69. Requires: `path` (project directory)
  70. Filter contracts by type (concrete, abstract, interface, library) or path pattern.
  71. ### 2. `get_contract` - Get detailed contract information
  72. Retrieve full contract metadata including functions, inheritance, and flags.
  73. ### 3. `get_contract_source` - Get contract source code
  74. Returns the complete source code of the Solidity file containing the specified contract.
  75. ### 4. `get_function_source` - Get function source code
  76. Returns the source code for a specific function with line numbers. Useful for focused analysis.
  77. ### 5. `list_functions` - List functions with filters
  78. Filter functions by contract, visibility, or modifiers.
  79. ### 6. `function_callees` - Get function call relationships
  80. Returns internal, external, and library callees for a function, including low-level call detection.
  81. ### 7. `function_callers` - Get functions that call a target function
  82. Returns all functions that call the specified target function, grouped by call type (internal, external, library). This is the inverse of `function_callees`.
  83. ### 8. `get_inherited_contracts` - Get contract inheritance
  84. Returns a recursive tree of all contracts that a contract inherits from (parents and ancestors).
  85. ### 9. `get_derived_contracts` - Get contracts that inherit from this one
  86. Returns a recursive tree of all contracts that inherit from a contract (children and descendants).
  87. ### 10. `list_function_implementations` - Find function implementations
  88. Find all implementations of a function signature across contracts.
  89. ### 11. `list_detectors` - List available Slither detectors
  90. Returns metadata about Slither detectors including names, descriptions, impact levels, and confidence ratings. Supports filtering by name or description.
  91. ### 12. `run_detectors` - Get detector results with filtering
  92. Returns cached detector results. Filter by detector names, impact level (High, Medium, Low, Informational), or confidence level (High, Medium, Low).
  93. 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.
  94. ## Client Usage
  95. 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.
  96. The client provides:
  97. - Type-safe methods for all MCP tools
  98. - Automatic serialization/deserialization of Pydantic models
  99. - Helper methods for common patterns
  100. - Tool wrappers for pydantic-ai agent integration
  101. For detailed usage examples and documentation, see [CLIENT_USAGE.md](CLIENT_USAGE.md).
  102. ## Requirements
  103. - Python 3.11+
  104. - Solidity compiler setup (Foundry, Hardhat, or similar)
  105. - Slither and its dependencies
  106. ## Development
  107. ### Pre-commit Hooks
  108. Install pre-commit hooks to run linting before commits:
  109. ```bash
  110. pre-commit install
  111. ```
  112. ### Running Tests
  113. ```bash
  114. uv run pytest
  115. ```

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.