aegis-defi
Aegis
在链上进行交易的 AI 代理无法区分合法代币和蜜罐。Aegis 解决了这个问题。它是一个任何代理都可以接入的 MCP 服务器,并由强制执行安全检查的链上合约提供支持。
在代理进行兑换之前,Aegis 会扫描目标合约、模拟交易,并返回一个简单的“通过/不通过”结果。如果合约有 99% 的卖出税或隐藏的暂停功能,代理将永远不会触碰它。
为什么存在这个项目
我们曾目睹一个代理在不到 30 秒的时间内因蜜罐代币损失了整个钱包的资金。该代币表面上看起来没问题——合约已验证、流动性充足、交易活跃。但代码中隐藏着 99% 的卖出税,以及一个在虚假的 renounceOwnership() 函数背后的隐藏所有者。
没有任何代理框架能够捕捉到这一点。所以我们构建了一个。
Related MCP server: agentshield-mcp
工作原理
Agent -> Aegis (scan + simulate + decide) -> Chain代理通过 MCP 连接到 Aegis(一行配置)
在任何兑换/授权/转账之前,代理调用
assess_riskAegis 扫描合约源代码,模拟交易,检查蜜罐模式
返回 ALLOW(允许)、WARN(警告)或 BLOCK(拦截),并附带风险评分(0-100)
链上:AegisGateway 合约在转发交易前强制执行证明
快速开始
# Add to Claude Code
claude mcp add aegis npx aegis-defi
# Or clone and try the demo
git clone https://github.com/StanleytheGoat/aegis
cd aegis && npm install
npx tsx demo/catch-honeypot.ts该演示部署了一个蓄意恶意的代币(99% 卖出税、虚假放弃所有权、隐藏管理员),并观察 Aegis 如何捕捉到每一个危险信号:
Aegis Risk Assessment
Risk Score: 100/100
Findings:
[CRITICAL] Fake Ownership Renounce
[CRITICAL] Asymmetric Buy/Sell Tax (99% sell)
[CRITICAL] Sell Pause Mechanism
[HIGH] Hidden Max Sell Amount
[HIGH] Hidden Admin Functions
Decision: BLOCK工具
MCP 服务器 (TypeScript) - 为任何兼容 MCP 的代理提供 6 种工具:
工具 | 用途 |
| 针对 165 种已知漏洞类型的模式匹配 |
| 在分叉链上进行试运行 |
| 反蜜罐检查(可卖性、持仓集中度) |
| 包含签名证明的一站式风险评估 |
| 追踪每一个内部调用,扫描每个合约 |
| 交叉引用 5 万多条真实审计发现 |
智能合约 (Solidity) - 部署在 Base 主网上:
合约 | 地址 | 用途 |
AegisGateway | 任何 DeFi 交互的安全包装器。验证证明,检查风险评分。 | |
AegisSafetyHook | Uniswap v4 |
文档
代理集成指南 - 如何连接您的代理
项目集成指南 - 如何将 Aegis 集成到产品中
Flaunch 集成 - Flaunch 模因币交易的安全检查
ElizaOS 插件 - 为 ElizaOS 代理提供的原生 Aegis 操作
AgentKit 提供程序 - 用于 Aegis 的 Coinbase AgentKit ActionProvider
llms.txt - 用于代理搜索的机器可读描述
安全性
遵循以太坊安全最佳实践构建(参考 ethskills):
签名:所有签名消息中包含链 ID + 合约地址(无跨链重放)。EIP-2 s-值延展性检查。针对 address(0) 验证 ecrecover。
费用数学:先乘后除。显式溢出防护。基点(而非百分比)。
访问控制:Gateway 上的 OZ Ownable + ReentrancyGuard。Hook 上的不可变所有者。不可变的费用接收者。
部署:Safe Singleton Factory CREATE2 部署器。源代码在 Basescan 上验证。所有权转移至 Safe 多签钱包。
测试:165 个测试(42 个合约测试 + 123 个 TypeScript 测试)。针对真实 Base 主网状态的分叉测试。
测试
npm test # TypeScript unit tests (123)
npm run test:contracts # Solidity contract tests (42)
npm run demo # Honeypot detection demo更新日志
v0.5.0 (当前版本)
Hook 证明支持 -
assess_risk现在为 Uniswap v4 受保护池返回网关和 Hook 证明EVM 地址验证 - 所有 MCP 工具输入均验证正确的地址格式
扩展知名合约 - Paraswap, Balancer Vault, CoW Protocol, Permit2, Uniswap V4 PoolManager
SDK 导出 - 证明器和 solodit 模块现可用于编程使用
强化获取 - response.ok 检查,所有外部请求均有 10 秒超时
安全标头和落地页 SEO 文件
v0.4.0
Solodit 集成 -
search_solodit工具查询来自 Cyfrin, Sherlock, Code4rena, Trail of Bits 等机构的 5 万多条真实审计发现自动丰富 - 当设置
SOLODIT_API_KEY时,assess_risk会将检测到的模式与真实审计发现进行交叉引用选择性 API 密钥模型 - 每个代理提供自己的 Solodit 密钥,无共享速率限制
v0.3.0
165 种漏洞模式,涵盖 25 个类别(之前为 22 个)
追踪级分析 -
trace_transaction工具跟踪每一个内部调用并扫描每个合约
v0.2.0
22 种漏洞模式(之前为 12 个) - 变形合约、预言机操纵、MEV 三明治攻击
代理技能 - 可安装的 Claude Code 技能文件
Flaunch SDK 集成 - Uniswap v4 池上模因币发布的安全扫描
许可证
MIT
Available Tools
4 toolsassess_riskA
Comprehensive risk assessment combining contract scanning, transaction simulation, and token checks. This is the recommended all-in-one safety check before any DeFi interaction. Returns a go/no-go recommendation.
Inputs: action (required), targetContract (required), from (required), chainId, +3 more.
check_tokenA
Check if a token is safe to trade. Detects honeypot mechanics (can't sell), concentrated holdings, fake ownership renouncement, and other scam indicators. Use this before swapping into any unfamiliar token.
Inputs: tokenAddress (required), chainId, holderAddress.
scan_contractA
Analyze a smart contract's source code or bytecode for known exploit patterns, honeypot mechanics, rug-pull signals, and security vulnerabilities. Returns a risk score (0-100) and detailed findings. Use this BEFORE interacting with any unfamiliar contract.
Inputs: source, bytecode, contractAddress, chainId.
simulate_transactionA
Simulate a transaction on a forked chain WITHOUT actually executing it. Detects reverts, abnormal gas usage, and other red flags. Use this to preview what will happen before sending a real transaction.
Inputs: from (required), to (required), data (required), chainId, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: assess_risk is a comprehensive all-in-one safety check, check_token focuses on token-specific scams, scan_contract analyzes contract code/bytecode, and simulate_transaction previews transaction outcomes. There is no overlap or ambiguity between these tools.
All tool names follow a consistent verb_noun pattern (assess_risk, check_token, scan_contract, simulate_transaction), using snake_case throughout. The naming is predictable and readable across the entire set.
With 4 tools, this server is well-scoped for DeFi security. Each tool earns its place by covering distinct aspects of safety assessment: holistic risk, token checks, contract analysis, and transaction simulation. This count is appropriate and avoids bloat.
The tool set provides complete coverage for DeFi security workflows: it includes comprehensive risk assessment (assess_risk), targeted checks for tokens and contracts, and transaction simulation. There are no obvious gaps—agents can perform end-to-end safety evaluations before any DeFi interaction.
Maintenance
Related MCP Connectors
Token rug-risk scans, Know Your Agent wallet checks and deployer reputation for AI agents.
Read-only smart-contract security intelligence for autonomous agents.
Crypto security, honeypot detection, wallet analysis, and token risk scoring across 31 blockchains.
Solana pre-trade safety for agents: rug check, honeypot sell-sim, drainer scan, tx preflight.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenancePre-execution safety layer for autonomous agent wallets. Risk scoring, transaction simulation, and policy enforcement via MCP.MIT
- AlicenseBqualityDmaintenanceReal-time smart contract security for autonomous AI agents, offering tools for contract verification, wallet monitoring, drain detection, threat reporting, and leaderboards.1925 npmMIT
- AlicenseNot gradedqualityDmaintenanceSecurity layer for AI agents that evaluates transaction intents and returns verdicts (ALLOW/WARN/DENY) using deterministic rules, on-chain checks, and simulation.9 npmMIT
- AlicenseAqualityDmaintenanceThe safety layer that checks a DeFi transaction or token before your agent (or you) signs — on Base L2.664 npmMIT