aegis-defi
Aegis is a DeFi safety MCP server that protects AI agents from malicious smart contracts, honeypots, and scams before executing on-chain transactions.
scan_contract: Analyze a smart contract's source code or bytecode against 165+ known exploit patterns, honeypot mechanics, rug-pull signals, and vulnerabilities — returns a risk score (0–100) with detailed findings.simulate_transaction: Dry-run a transaction on a forked chain to detect reverts, abnormal gas usage, and other red flags before real execution.check_token: Detect honeypot mechanics (inability to sell), concentrated holdings, fake ownership renouncement, and other scam indicators before trading.assess_risk: All-in-one safety check combining contract scanning, simulation, and token checks — returns an ALLOW, WARN, or BLOCK decision with a signed attestation for swaps, approvals, transfers, and other DeFi interactions.trace_transaction: Trace every internal call of a transaction and scan each contract encountered for potential issues.search_solodit: Cross-reference detected patterns against 50K+ real audit findings from Cyfrin, Sherlock, Code4rena, and more.
Additionally, the AegisGateway contract can verify attestations and enforce safety checks on-chain, and AegisSafetyHook can block unverified swaps in Uniswap v4 pools. Aegis integrates with agent frameworks such as Claude Code, ElizaOS, and AgentKit.
Provides a safety layer for DeFi operations on Ethereum-compatible networks by scanning smart contracts for vulnerabilities, simulating transactions to detect malicious logic, and enforcing risk assessments through on-chain attestations via the AegisGateway.
Enables automated analysis of Solidity smart contract source code to identify malicious patterns such as asymmetric taxes, hidden administrative functions, and fraudulent ownership renouncements.
Aegis
Safety layer for autonomous DeFi agents. | Website | Docs
AI agents trading on-chain have no way to tell a legitimate token from a honeypot. Aegis fixes that. It's an MCP server that any agent can plug into, backed by on-chain contracts that enforce the safety checks.
Before an agent swaps, Aegis scans the target contract, simulates the transaction, and returns a simple go/no-go. If the contract has a 99% sell tax or a hidden pause function, the agent never touches it.
Why this exists
We watched an agent lose its entire wallet to a honeypot token in under 30 seconds. The token looked fine on the surface - verified contract, decent liquidity, active trading. But buried in the code was a 99% sell tax and a hidden owner behind a fake renounceOwnership().
No agent framework had a way to catch this. So we built one.
How it works
Agent -> Aegis (scan + simulate + decide) -> ChainAgent connects to Aegis via MCP (one line of config)
Before any swap/approve/transfer, agent calls
assess_riskAegis scans the contract source, simulates the tx, checks for honeypot patterns
Returns ALLOW, WARN, or BLOCK with a risk score (0-100)
On-chain: the AegisGateway contract enforces attestations before forwarding the transaction
Quick Start
# 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.tsThe demo deploys a deliberately malicious token (99% sell tax, fake ownership renounce, hidden admin) and watches Aegis catch every red flag:
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: BLOCKTools
MCP Server (TypeScript) - 6 tools available to any MCP-compatible agent:
Tool | Purpose |
| Pattern matching against 165 known exploit types |
| Dry-run on a forked chain |
| Anti-honeypot checks (sellability, concentrated holdings) |
| All-in-one risk assessment with signed attestation |
| Traces every internal call, scans each contract |
| Cross-references against 50K+ real audit findings |
Smart Contracts (Solidity) - deployed on Base mainnet:
Contract | Address | Purpose |
AegisGateway | Safety wrapper for any DeFi interaction. Verifies attestations, checks risk scores. | |
AegisSafetyHook | Uniswap v4 |
Docs
Agent Integration Guide - how to connect your agent
Project Integration Guide - how to integrate Aegis into a product
Flaunch Integration - safety checks for Flaunch memecoin trading
ElizaOS Plugin - native Aegis actions for ElizaOS agents
AgentKit Provider - Coinbase AgentKit ActionProvider for Aegis
llms.txt - machine-readable description for agentic search
Security
Built following Ethereum security best practices (informed by ethskills):
Signatures: Chain ID + contract address in all signed messages (no cross-chain replay). EIP-2 s-value malleability check. ecrecover validated against address(0).
Fee math: Multiply before divide. Explicit overflow guards. Basis points (not percentages).
Access control: OZ Ownable + ReentrancyGuard on Gateway. Immutable owner on Hook. Immutable fee recipient.
Deployment: Safe Singleton Factory CREATE2 deployer. Source verified on Basescan. Ownership transferred to Safe multisig.
Testing: 165 tests (42 contract + 123 TypeScript). Fork tests against real Base mainnet state.
Tests
npm test # TypeScript unit tests (123)
npm run test:contracts # Solidity contract tests (42)
npm run demo # Honeypot detection demoChangelog
v0.5.0 (Current)
Hook attestation support -
assess_risknow returns both gateway and hook attestations for Uniswap v4 protected poolsEVM address validation - all MCP tool inputs validate proper address format
Expanded well-known contracts - Paraswap, Balancer Vault, CoW Protocol, Permit2, Uniswap V4 PoolManager
SDK exports - attester and solodit modules now available for programmatic use
Hardened fetching - response.ok checks, 10s timeouts on all external requests
Security headers and SEO files for landing page
v0.4.0
Solodit integration -
search_solodittool queries 50K+ real audit findings from Cyfrin, Sherlock, Code4rena, Trail of Bits, and othersAuto-enrichment -
assess_riskcross-references detected patterns against real audit findings whenSOLODIT_API_KEYis setOpt-in API key model - each agent provisions their own Solodit key, no shared rate limits
v0.3.0
165 exploit patterns across 25 categories (up from 22)
Trace-level analysis -
trace_transactiontool follows every internal call and scans each contract
v0.2.0
22 exploit patterns (up from 12) - metamorphic contracts, oracle manipulation, MEV sandwich
Agent Skills - installable skill files for Claude Code
Flaunch SDK integration - safety scanning for memecoin launches on Uniswap v4 pools
License
MIT
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/StanleytheGoat/aegis'
If you have feedback or need assistance with the MCP directory API, please join our Discord server