Web3 Condition-Action Trigger Agent
Autonomous Web3 Security & Governance Auditor with Two-Stage Hybrid LLM Pipeline & x402 Bazaar Micropayments
[Python 3.11+]
[Base]
[x402 Protocol]
[MCP Server]
[Glama MCP]
[mcptry]
[M8ven Score]
[Gemini 2.5/3.5]
[License: Apache 2.0]
An autonomous Web3 agent engineered for real-time smart contract monitoring, DEX honeypot detection, and DAO governance security. Features a two-stage hybrid architecture that combines zero-cost deterministic on-chain gatekeeping with structured Gemini LLM evaluations, monetized Agent-to-Agent (A2A) via x402 gasless USDC micropayments on Base.
Operates natively as both a high-throughput FastAPI REST Service and a Model Context Protocol (MCP) Server compatible with Claude Desktop, Cursor, Smithery, Glama, and Coinbase AgentKit.
🌐 Live Production Service
The service is continuously deployed and operational in production on Render:
Canonical API Endpoints
🔌 Model Context Protocol (MCP) Server
The agent provides a first-class Model Context Protocol (MCP) server (src/mcp_server.py) implementing protocol specification 2024-11-05. It serves 3 free Stage 1 on-chain analysis tools to discover and qualify threats, and 1 paid Stage 2 tool for deep semantic auditing:
1. Free Stage 1 Tools
scan_contract_selectors
- Purpose: Free deterministic bytecode inspection on Base or any EVM network. Discovers 4-byte function selectors and flags high-privilege administrative backdoors (
transferOwnership, upgradeTo, mint, selfdestruct).
- Parameters:
target_address (string, required): Hex EVM smart contract address.
chain_id (integer, default 8453): EVM Chain ID (8453 for Base Mainnet, 84532 for Base Sepolia).
bytecode_override (string, optional): Raw contract runtime bytecode hex string for offline analysis.
- Returns: Contract status, bytecode size, extracted selectors, flagged high-risk capabilities, risk level (
HIGH, LOW, EOA), and upsell recommendation.
check_token_honeypot
- Purpose: Free static bytecode analysis for DEX honeypots, rugpull traps, and malicious token contracts:
- Blacklist manipulation (
isBlacklisted, setBlacklist, addToBlacklist)
- Arbitrary transfer taxes & 100% sell fee traps (
setTax, setFee, setSellFee)
- Trading freeze and pause backdoors (
pause, setTrading, enableTrading)
- EVM
SELFDESTRUCT (opcode 0xff) drainage traps
- Parameters:
token_address (string, required): Hex EVM address of token contract.
chain_id (integer, default 8453): EVM Chain ID.
bytecode_override (string, optional): Raw token runtime bytecode for offline analysis.
- Returns:
is_honeypot_suspect boolean, numeric risk_score (0.0 to 10.0), active threat categories, detailed risk flags, and audit upsell guidance.
scan_dao_proposals
- Purpose: Free scanner for recent Snapshot DAO governance proposals (Arbitrum, Aave, ENS, etc.). Extracts proposed execution targets, native Wei value transfers, and 4-byte calldata to detect governance hijack attempts.
- Parameters:
space_id (string, default "arbitrumfoundation.eth"): Snapshot DAO space ENS domain.
limit (integer, default 3): Maximum proposals to fetch.
use_curated_offline (boolean, default false): If true, returns verified realistic curated proposals without outbound network calls.
- Returns: Proposal IDs, natural language titles, execution targets, calldata payloads, and audit recommendations.
2. Paid Stage 2 Tool
deep_semantic_audit
- Purpose: Two-stage autonomous security and governance audit. Executes deterministic on-chain gatekeeping followed by structured Google Gemini LLM reasoning crossing natural language claims with actual bytecode and calldata reality.
- Parameters:
target_address (string, required): Hex EVM smart contract address.
proposal_description (string, required): Natural language claim or governance proposal explanation.
policy_prompt (string, optional): Security policy or criteria to audit against.
calldata (string, default "0x"): Transaction hex calldata being executed.
chain_id (integer, default 8453): EVM Chain ID.
risk_threshold (number, default 7.0): Threshold (0.0 to 10.0) above which intervention is warranted.
x402_payment_header (string, optional): Base64-encoded EIP-3009 transfer authorization satisfying $0.05 USDC payment.
- Pricing & Micropayment Flow:
- If invoked without payment credentials, returns a structured HTTP 402 payment challenge with the exact recipient address, amount ($0.05 USDC), and instructions.
- If
x402_payment_header is supplied (or X402_BUYER_PRIVATE_KEY is configured in the environment), the audit executes immediately and returns a deterministic policy result (APPROVE, MANUAL_REVIEW, or REJECT) with risk scores and flagged issues.
🛠️ MCP Client Configuration & Installation
Claude Desktop
Add the server to your claude_desktop_config.json:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
Cursor IDE
Create or edit .cursor/mcp.json in your project root or user config:
Smithery (smithery.yaml)
Install directly via Smithery.ai:
Or reference the local manifest:
Glama (glama.json)
Verified for the Glama MCP Directory:
Coinbase AgentKit / Streamable-HTTP
Connect via HTTP streaming to the remote MCP endpoint without local installation:
🏗️ Two-Stage Architecture & x402 Micropayments
Proven Live On-Chain Settlements (Base Sepolia)
The x402 A2A settlement cycle using EIP-3009 (transferWithAuthorization) has been verified and settled on Base Sepolia (Chain ID: 84532) with zero gas ETH consumed by the buyer or agent:
📁 Repository Structure
⚡ Quickstart & Setup
1. Installation
2. Configuration (.env)
Copy the template and provide your API keys:
Key environment variables:
3. Verify MCP Server Offline
Expected output:
4. Run the Full Test Suite
📜 License
This project is licensed under the Apache License 2.0 (SPDX-License-Identifier: Apache-2.0).
- Copyright: Copyright (c) 2026 RafaCoelho33. All rights reserved under Apache-2.0 terms (including trademark protection under Section 6 and mandatory attribution under Section 4).