Smart Contract Security Analyzer
An MCP server that statically audits Solidity smart contracts for common vulnerabilities like reentrancy and access control, enabling developers to identify and fix security issues via natural language.
README
Smart Contract Security Analyzer (MCP)
A production-ready Model-Context-Protocol (MCP) server that statically audits Solidity contracts for the seven classes of vulnerability most likely to drain your contract — reentrancy, access control, integer overflow, unchecked low-level calls, timestamp dependence, tx.origin authorization, and unprotected selfdestruct.
The server is built on Next.js 14 (App Router) and Vercel's mcp-handler, ships a marketing landing page, an interactive /demo playground, and a direct REST POST /api/analyze endpoint.
Features
- Four MCP tools:
analyze_contract,check_vulnerability,generate_audit_report,suggest_fix. - Seven AST-based detectors: pure TypeScript walking the
@solidity-parser/parserAST — no Python, no subprocess, no slither on Vercel. - Pragma-aware arithmetic detection: only flags overflow on
< 0.8.0contracts (or insideunchecked {}blocks on 0.8+). - Risk scoring with cap table: critical 25/cap 50, high 15/cap 30, medium 10/cap 20, low 5/cap 10; clamped 0–100.
- Markdown audit report generator: executive summary, findings table, detailed findings, recommendations.
- Interactive demo at
/demo: paste a contract, click "Analyze", see a liveRiskScoreand per-findingVulnerabilityCards. - Dark theme + purple accent (Tailwind) and copy-to-clipboard install instructions.
Vulnerability coverage
| ID | SWC | Detector | Severity | Reference |
|---|---|---|---|---|
| reentrancy | SWC-107 | External call before state write | critical | https://swcregistry.io/docs/SWC-107 |
| access_control | SWC-105 | Public state-mutating function with no msg.sender check |
high | https://swcregistry.io/docs/SWC-105 |
| integer_overflow | SWC-101 | Unsigned arithmetic in pre-0.8 or unchecked {} |
high | https://swcregistry.io/docs/SWC-101 |
| unchecked_calls | SWC-104 | Unwrapped low-level call return value | medium | https://swcregistry.io/docs/SWC-104 |
| timestamp_dependence | SWC-116 | block.timestamp in comparison or randomness |
low | https://swcregistry.io/docs/SWC-116 |
| tx_origin | SWC-115 | tx.origin used for authorization |
high | https://swcregistry.io/docs/SWC-115 |
| selfdestruct | SWC-106 | selfdestruct/suicide without access control |
critical | https://swcregistry.io/docs/SWC-106 |
Quick start (local development)
git clone https://github.com/your-org/smart-contract-mcp.git
cd smart-contract-mcp
npm install
npm run dev
Then open http://localhost:3000 for the landing page or http://localhost:3000/demo for the interactive playground.
Build & verify
npm run build # type-check + Next.js production build
npm run typecheck # tsc --noEmit
npm run lint # next lint
npm run validate-schemas # exercise the four MCP tool schemas
Install in Claude Desktop
Add the following to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"smart-contract-mcp": {
"url": "https://smart-contract-mcp.vercel.app/api/mcp"
}
}
}
Restart Claude Desktop. You can now ask Claude to "audit this contract" or "check this function for reentrancy" and the four tools will be available.
Deploy to Vercel
- Push the repo to GitHub.
- Import it in Vercel — the default Next.js build command is correct.
- No environment variables are required.
The vercel.json in the repo pins the framework to nextjs; @solidity-parser/parser is declared in next.config.ts as an external server-component package so it is not bundled into the client.
API surface
MCP endpoint
GET /api/mcp— list tools + server info.POST /api/mcp— JSON-RPCtools/callinvocations.DELETE /api/mcp— session teardown.
Direct REST
POST /api/analyze—{ source_code, contract_name? }→AnalysisResultJSON.
Source layout
app/ # Next.js App Router (landing, /demo, /api/mcp, /api/analyze)
components/ # Hand-authored UI primitives (Button, Card, Badge, ...)
lib/ # Types, scoring, analyzers/*
scripts/ # smoke-mcp.mjs, validate-schemas.mjs, vulnerable-bank-payload.json
public/og.png # 1200x630 social card
License
MIT.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。