MCP Integration¶
Expose AuditAI tools to external agents and IDE integrations via Model Context Protocol.
What is MCP?¶
Model Context Protocol (MCP) is a standard for connecting AI models to external tools and data sources. AuditAI implements an MCP server that exposes smart contract audit capabilities as MCP tools, allowing any MCP-compatible client (Cursor, Claude, etc.) to run audits.
Starting the MCP Server¶
The server runs over stdio by default (stdin/stdout), which is the standard transport for MCP clients.
Connecting from IDEs¶
Cursor¶
- Open Settings → MCP
- Add a new MCP server:
- Type:
stdio - Command:
python3 -m src.main serve - Working directory:
/path/to/eth-beijing-2026
Claude Desktop¶
Add to your claude_desktop_config.json:
{
"mcpServers": {
"auditai": {
"command": "python3",
"args": ["-m", "src.main", "serve"],
"cwd": "/path/to/eth-beijing-2026"
}
}
}
Available Tools¶
The MCP server exposes three tools:
analyze_contract¶
Run a full smart contract audit.
Input Schema:
{
"contract_path": "string (required) — path to the .sol file",
"mode": "string — 'detect', 'patch', 'exploit', or 'all' (default: 'all')"
}
Example call:
{
"name": "analyze_contract",
"arguments": {
"contract_path": "data/contracts/VulnerableBank.sol",
"mode": "all"
}
}
Returns: Full audit result with vulnerabilities, patches, and verification.
get_vulnerability_details¶
Look up a vulnerability type from the RAG knowledge base.
Input Schema:
Example call:
Returns: Relevant knowledge base entries about the vulnerability type.
generate_report¶
Generate a formatted audit report from audit results.
Input Schema:
{
"audit_result": "object (required) — audit result object",
"format": "string — 'json', 'markdown', or 'html' (default: 'markdown')"
}
Example call:
{
"name": "generate_report",
"arguments": {
"audit_result": { "contract_path": "...", "vulnerabilities": [...] },
"format": "markdown"
}
}
Protocol Details¶
The server implements MCP protocol version 2024-11-05 and supports:
initialize— server handshaketools/list— list available toolstools/call— invoke a tool
It also supports a manual JSON-RPC dispatch mode for HTTP/SSE transports and testing.
Extending the MCP Server¶
To add new tools, edit src/mcp/mcp_server.py:
- Add a tool definition to
_register_default_tools() - Add a handler method (e.g.,
_handle_my_tool) - Register the handler in
_dispatch_tool()
See Extending Guide for details.
See Also¶
- CLI Reference — command-line alternative
- Architecture Overview — how the pipeline works
- Extending Guide — add new MCP tools