mcp-contractaudit
README.md
# mcp-contractaudit
MCP server for **Smart Contract Audit** — static analysis, vulnerability scanning, gas optimization, formal verification, report generation, and contract information.
## Tools
### `run_static_analysis`
Run static analysis on a smart contract using multiple tools (Slither, Mythril, Echidna, Manticore, Foundry).
| Parameter | Type | Default | Description |
|---|---|---|---|
| `contract_address` | string | **required** | Contract address on-chain |
| `source_code` | string | **required** | Solidity source code for analysis |
| `tools` | array | `["slither", "mythril"]` | Analysis tools to run |
| `chain` | string enum | `ethereum` | ethereum, polygon, arbitrum, optimism, base |
Returns audit with findings, summary by severity, and metadata.
### `get_vulnerability_report`
Get vulnerability report for a completed audit.
| Parameter | Type | Default | Description |
|---|---|---|---|
| `audit_id` | string | **required** | Audit identifier |
Returns audit with findings grouped by severity.
### `optimize_gas`
Analyze and suggest gas optimizations for contract functions.
| Parameter | Type | Default | Description |
|---|---|---|---|
| `contract_address` | string | **required** | Contract address on-chain |
| `source_code` | string | **required** | Solidity source code |
| `target_function` | string | - | Specific function to optimize; omit for all |
Returns optimization suggestions with estimated gas savings.
### `verify_formal_spec`
Verify formal specification against contract implementation.
| Parameter | Type | Default | Description |
|---|---|---|---|
| `contract_address` | string | **required** | Contract address on-chain |
| `spec_file` | string | **required** | Path to formal specification file |
| `spec_language` | string enum | `k-framework` | k-framework, certora, scribble |
Returns verification result with proof status and counterexamples.
### `generate_audit_report`
Generate a comprehensive audit report from audit findings.
| Parameter | Type | Default | Description |
|---|---|---|---|
| `audit_id` | string | **required** | Audit identifier |
| `format` | string enum | `markdown` | pdf, markdown, html, json |
| `include_code_snippets` | boolean | `true` | Include code snippets |
| `executive_summary` | boolean | `true` | Include executive summary |
Returns formatted audit report.
### `get_contract_info`
Get basic information about a deployed contract.
| Parameter | Type | Default | Description |
|---|---|---|---|
| `contract_address` | string | **required** | Contract address on-chain |
| `chain` | string enum | `ethereum` | ethereum, polygon, arbitrum, optimism, base |
Returns contract info with audit history.
## Installation
```bash
pip install -r requirements.txt
```
## Usage
```bash
python main.py
```
State persisted in `./state/`. Override with `MCP_CONTRACTAUDIT_STATE_DIR`.
## Connecting to an MCP client
```json
{
"mcpServers": {
"contractaudit": {
"command": "python3",
"args": ["/tmp/v3-services/mcp-contractaudit/main.py"]
}
}
}
```
## License
MITThis server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues