ContractScan MCP Server
Expose ContractScan's multi-engine Solidity vulnerability scanner as a Model Context Protocol (MCP) server. Once connected, any MCP-compatible AI tool (Claude Desktop, Cursor, Windsurf, Cline, …) can scan smart contracts directly from a conversation.
Why MCP?
| Tool | Engines |
|---|---|
| Slither-MCP | Slither only |
| Aderyn-MCP | Aderyn only |
| ContractScan MCP | Slither + Semgrep + Mythril + AI cross-verification |
Requirements
- Python 3.11+
pip install contractscan-mcpsolcinstalled (solc-select install 0.8.20 && solc-select use 0.8.20)
Quick Start
Install
pip install contractscan-mcp
Test it works
contractscan-mcp --help
IDE Setup
Claude Desktop (macOS / Windows)
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"contractscan": {
"command": "contractscan-mcp",
"env": {
"ANTHROPIC_API_KEY": "sk-ant-...",
"GOOGLE_API_KEY": "AIza..."
}
}
}
}
Restart Claude Desktop. You should see ContractScan in the MCP tools list.
Cursor
Open Cursor Settings → MCP (or edit ~/.cursor/mcp.json):
{
"mcpServers": {
"contractscan": {
"command": "contractscan-mcp",
"env": {
"ANTHROPIC_API_KEY": "sk-ant-...",
"GOOGLE_API_KEY": "AIza..."
}
}
}
}
Restart Cursor. ContractScan tools will appear in the Composer context.
Windsurf
Edit ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"contractscan": {
"command": "contractscan-mcp",
"env": {
"ANTHROPIC_API_KEY": "sk-ant-...",
"GOOGLE_API_KEY": "AIza..."
}
}
}
}
Restart Windsurf. ContractScan will be available in Cascade.
Cline (VS Code)
In VS Code, open Cline settings and add to MCP Servers:
{
"contractscan": {
"command": "contractscan-mcp",
"env": {
"ANTHROPIC_API_KEY": "sk-ant-..."
}
}
}
Claude Code (CLI)
Add to your project's CLAUDE.md:
## MCP Tools
This project uses ContractScan MCP for smart contract security scanning.
Install: `pip install contractscan-mcp`
Add to `~/.claude/settings.json`:
\`\`\`json
{
"mcpServers": {
"contractscan": {
"command": "contractscan-mcp",
"env": { "ANTHROPIC_API_KEY": "YOUR_KEY" }
}
}
}
\`\`\`
Or run directly from the Claude Code terminal:
# Scan a single file
echo '{"tool":"scan_file","args":{"file_path":"contracts/Token.sol"}}' \
| contractscan-mcp
# Or use Claude Code with MCP enabled (add to settings.json first)
Available Tools
scan_contract
Scan Solidity source code passed as a string.
| Parameter | Type | Default | Description |
|---|---|---|---|
solidity_code |
string | required | Full Solidity source |
filename |
string | "contract.sol" |
Filename shown in reports |
generate_report |
bool | true |
Generate AI narrative report |
anthropic_api_key |
string | env ANTHROPIC_API_KEY |
BYOK Anthropic key |
openai_api_key |
string | env OPENAI_API_KEY |
BYOK OpenAI key |
tier |
string | "free" |
"free" / "basic" / "pro" |
scan_file
Scan a local .sol file or directory of Solidity files.
| Parameter | Type | Default | Description |
|---|---|---|---|
file_path |
string | required | Absolute or relative path |
generate_report |
bool | true |
Generate AI narrative report |
anthropic_api_key |
string | env ANTHROPIC_API_KEY |
BYOK Anthropic key |
openai_api_key |
string | env OPENAI_API_KEY |
BYOK OpenAI key |
tier |
string | "free" |
"free" / "basic" / "pro" |
get_engines
List all registered scan engines and their availability.
{
"engines": [
{"name": "slither", "tier": "free", "available": true},
{"name": "mythril", "tier": "basic", "available": true},
{"name": "semgrep", "tier": "basic", "available": true},
{"name": "ai", "tier": "free", "available": true}
]
}
get_report
Retrieve the most recent scan result from the current session.
Analysis Tiers
| Tier | Engines included |
|---|---|
free |
Slither + AI |
basic |
Slither + Semgrep + Mythril + AI |
pro |
All engines |
API Keys
The server reads API keys from environment variables or from the tool call arguments (BYOK):
| Variable | Use |
|---|---|
ANTHROPIC_API_KEY |
Claude-based AI report / detection |
GOOGLE_API_KEY |
Gemini-based AI report / detection |
OPENAI_API_KEY |
GPT-4o-based AI report / detection |
At least one AI key is recommended for full reports. Static analysis (Slither / Semgrep / Mythril) works without any key.
Example Usage (in Claude Desktop)
Once connected, you can use ContractScan in natural language:
"Scan this contract for vulnerabilities" — paste your Solidity code
"Check
/path/to/contracts/Token.solfor security issues" — scan a local file"What engines are available?" — list configured engines
Impact on Existing Features
The MCP server runs as a separate process using stdio transport. It does not modify or affect the existing ContractScan web API or FastAPI application.
Metadata
Release files for contractscan-mcp 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| contractscan_mcp-0.1.1.tar.gz | 4.7 kB | Without provenance | Details for contractscan_mcp-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| contractscan_mcp-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for contractscan_mcp-0.1.1-py3-none-any.whl |
Total release size: 8.4 kB
Release files / contractscan_mcp-0.1.1.tar.gz
| Download URL | contractscan_mcp-0.1.1.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
22bfb97275270b88fafbe47d735330ba393d8735a1af119930258fb82ae5c706
|
|
BLAKE2b-256 checksum How to use checksums |
9370f00e130f0ce80e83734aab671a002e3371b2a4a1ce12ef958c073954bb46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / contractscan_mcp-0.1.1-py3-none-any.whl
| Download URL | contractscan_mcp-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7eff62cf66dd67f309c77edcae091aee3566d7b72b8adce10bc10065910408bc
|
|
BLAKE2b-256 checksum How to use checksums |
117bbe14befe729dd1793f6c352c8573d590f7122291ea5d14cdf13a67dc48eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for contractscan-mcp 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.