security-gate-x402
This MCP server provides AI-agent security inspection, cryptographic attestations, agent finance services, and logistics/escrow verification.
Audit agent outputs for factual hallucinations against ground-truth context and issue EIP-191 attestations.
Screen text for prompt injection, jailbreak patterns, and leaked secrets like API keys or private keys.
Statically analyze Python code and shell commands for dangerous operations before execution.
Generate EIP-712 signatures and Solidity calldata for on-chain security guardrails.
Retrieve AI-agent credit ratings, EU AI Act compliance passports, insurance quotes, and loan quotes.
Submit agent trade intents for pairs like ETH/USDC, BTC/USDC, and SOL/USDC.
Audit and sign exploit indemnity claims for unauthorized wallet loss.
Verify Polygon OMS/Solana/multichain payments and apply security checks before signing.
Verify e-Bills of Lading, cold-chain telemetry, GPS arrival, and issue proof-of-delivery attestations to unlock escrow.
The Sheriff of Agent Finance (agent-security-gate-x402) ๐ก๏ธ๐ค โก
"The Sheriff of Agent Finance: Guarding Autonomous Wallets & Transactions in the Wild West of AI."
Before an autonomous AI agent moves a single dollar, the Sheriff inspects, attests, and secures the transaction.
Ultra-low latency (<10ms) deterministic security, prompt injection, secret key leak, dangerous AST code, and factual hallucination inspection micro-oracle, anchored to the A.GRID Universal Escrow Hub across Solana Mainnet (0.4s), Polygon, Base, and Arbitrum.
๐ฅ๏ธ Interactive Web Dashboard & Simulator (Live)
๐ https://agent-security-gate-x402-212942243360.asia-northeast3.run.app/
![]()
Explore the full consumer and enterprise visual interface directly in your browser:
๐ก๏ธ Prompt Injection & Jailbreak Radar: Live testing against DAN prompts, system tag escapes, and adversarial suffixes.
โก Dangerous AST Code Analyzer: Sub-millisecond Python syntax parsing detecting
os.system,subprocess,eval,exec, and malicious sockets.๐ Hallucination & NLI Fact-Checker: Contrast agent generation with ground truth context to surface fabricated numbers and unanchored claims.
๐ EIP-712 On-Chain Attestation & Calldata: Instant generation of
v, r, sABI calldata for EVM smart contracts.๐ก Real-Time Security Event Stream: Live WebSocket event feed of inspection audits.
Related MCP server: Thoughtproof-mcp
๐ Multichain Agent Spend Control & Escrow Matrix (Phase 1 & Phase 2 Delivered)
๐ Phase 2 (Week 2) Security & Regulatory Upgrades
ERC-20
approve/permitDrain Bypass Defense (SecurityGateOMSPolicy.sol): Decodesapprove,increaseAllowance,transferFrom, and EIP-2612permitselectors on-chain, enforcingallowedTargetwhitelisting on spenders/recipients and counting allowances toward the cumulativemaxSpendLimitalongside EIP-712 attestation verification.Dual-Mode Statutory Governance (
GDPR Art. 17(1)vs.17(3)(b)): Mode A (1,825-day/ 5-year immutable audit lock forEUDR,MINERALS,TRADE,CONSTRUCTIONwith0sNIST-SP-800-88-Rev1PII zeroization), Mode B (0strade-secret purge), and Mode C (IFRS-15 / US GAAP0%kickback clean invoices).Continuous Threat Brain (
scripts/run_continuous_brain_trainer.py): Autonomous background hardening of deterministic<5msAST/injection defenses without runtime LLM latency.Week 2 Build Log & Demo Script:
docs/COLOSSEUM_WEEK2_BUILD_LOG.mdPolygon ERC-8004 Official Identity: Agent ID
#707onIdentityRegistry(0x8004A169...a432ยท Tx)
Zero-Trust Multi-Chain Settlement Across 4 Major Rails: Polygon ยท Base ยท Arbitrum ยท Solana
Automated Test Suite: 410 / 410 ALL PASSED (pytest tests/) ยท Phase 1 Completion Report:docs/PHASE1_COMPLETION_REPORT.md
Network | Chain ID | Finality | Spend Control & Security Mechanism | Integration Guide & Artifacts | Verification Status |
๐ฃ Polygon |
| 2.1s | ERC-7579 Smart Sessions & OMS Policy ( |
| โ PolygonScan Verified |
๐ต Base |
| 2.0s | Coinbase AgentKit Action Provider (15% worker collateral staking, 0.25% toll, AST threat slashing) |
| โ 5/5 PASS |
๐ท Arbitrum |
| 0.25s | Safe{Wallet} Guard & Stylus WASM Rust Verifier (High-value multi-sig treasury guard, sub-100ฮผs proof verification, 90% gas reduction) |
| โ 4/4 PASS |
๐ข Solana |
| 0.4s | Squads v4 Sub-Vault & Anchor CPI (0.4s streaming micropayments, DePIN compute loss proof, instant collateral forfeiture) |
| โ 3/3 PASS |
๐ Multichain Strategic Documentation Suite
๐ฃ Polygon OMS ร Solana Integration Guide:
docs/POLYGON_OMS_SOLANA_INTEGRATION_GUIDE.mdโ Regulated US 48-State Virtual Accounts, Agent Spend Controls, and single-tx Solana/Polygon routing.๐ฃ Polygon OMS Case Study:
docs/POLYGON_OMS_CASE_STUDY.mdโ Technical report on ERC-7579 session safety.๐ต Coinbase AgentKit Guide:
docs/COINBASE_AGENTKIT_INTEGRATION_GUIDE.mdโ Base Smart Wallet & AgentKit provider tutorial.๐ท Arbitrum Safe App Store:
docs/ARBITRUM_SAFE_APP_STORE.mdโ High-value multi-sig treasury guard & Stylus WASM specification.๐ข Solana Foundation Grant:
docs/SOLANA_FOUNDATION_GRANT_2026.mdโ $35k DePIN GPU compute truth oracle proposal.๐ Phase 1 Master Report:
docs/PHASE1_COMPLETION_REPORT.mdโ Comprehensive 14-day completion report and Phase 2 roadmap.
๐๏ธ Modular 3-Tier Architecture: The "Tip of the Spear"
agent-security-gate-x402 follows a clean, decoupled 3-tier architecture. Developers start with the ultra-fast Core (Tier 1) and seamlessly scale into Institutional Governance (Tier 2) and Enterprise Domain Extensions (Tier 3):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ก๏ธ TIER 1: THE TIP OF THE SPEAR (Developer Core & Settlement Engine) โ
โ โข Sub-5ms Zero-Trust AST Gate & Prompt Injection Defense (/inspect) โ
โ โข HTTP 402 Autonomous Escrow Hub & Multi-Chain Settlement (/hub) โ
โ โข Solana Mainnet (0.4s) ยท Polygon (137) ยท Base (8453) ยท Arbitrum (42161)โ
โ โข 1-Line Drop-In SDK & Model Context Protocol (MCP) Server โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ powers
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ก๏ธ TIER 2: INSTITUTIONAL GOVERNANCE (Treasury & Trust Framework) โ
โ โข Safe{Wallet} Guard & Spend Policy Firewall (daily/tx micro-ceilings) โ
โ โข Moody's & S&P AI Agent Credit Rating Oracle & EIP-712 Certificates โ
โ โข EU AI Act Article 50 Compliance & Dynamic Risk Passport โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ scales to
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ TIER 3: ENTERPRISE & DOMAIN EXTENSIONS (Real-World Assets & DePIN) โ
โ โข 5 Strategic Truth Oracles (Maritime, Bio IP, BIM, DePIN, Code) โ
โ โข Autonomous Receivables Factoring Bridge & Parametric Insurance Pool โ
โ โข Sovereign RWA Treasury Backing & Multi-Agent Fleet Registry โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ๐ Live Service Links & Resources
Service / Endpoint | Description | URL Link |
๐๏ธ Universal Escrow Hub | Multi-chain sovereign settlement & clearinghouse across 5 sectors | |
๐ค Autonomous Agent Directive | Standard machine-readable directive & API handshake for agents | |
๐ Proof-of-Reserves (PoR) | Real-time cryptographic solvency & US T-Bills treasury audit | |
๐ฅ๏ธ Web Dashboard | Interactive visual UI, security simulator & audit tester | |
โก API Playground | Browser-based interactive query sandbox | |
๐ก๏ธ Live Inspection | Core deterministic security & NLI hallucination check | |
๐ On-Chain Calldata | EIP-712 smart contract attestation calldata endpoint | |
๐ Prometheus Metrics | Real-time APM telemetry & security counters | |
๐ก๏ธ Glama MCP Directory | Verified MCP Server with JSON Tool Schemas | |
๐ Swagger API Docs | Full interactive OpenAPI documentation | |
๐ค LLM Agent Manifest | Machine-readable tool specifications |
๐๏ธ A.GRID Universal Escrow Hub: Sovereign Settlement Layer for 5 Sectors
The A.GRID Universal Escrow Hub operates as a sovereign, decentralized clearinghouse enabling autonomous agents and human enterprises to mint, claim, verify, and settle high-stakes contracts with zero counterparty risk:
๐ [ A.GRID Universal Escrow Hub (/hub) ]
(Global Trade ยท Bio & Pharma IP ยท Smart Construction ยท DePIN ยท M2M)
โฒ
โ 0.25% Protocol Toll ยท 0.4s Solana Finality
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโ
โผ โผ โผ
[ ๐ข Global Trade ] [ ๐งฌ Bio & Pharma ] [ ๐๏ธ Smart Construction ]
Cold-Chain IoT & GPS ZK-SNARK & TEE Enclave 3D Drone LiDAR & Direct Split
โฒ โฒ โฒ
โโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโ
โ
๐ค [ Autonomous AI Agents & Solvers ]5 Strategic Domains & Deterministic Truth Invariants
๐ข Global Trade & Maritime Freight (
TRADE):Truth Invariant: Cold-chain IoT logs (-20ยฐC ยฑ 2ยฐC) + GPS geofence arrival (< 500m) + on-chain e-B/L + EUDR satellite polygon verification.
Settlement: Atomic split releasing freight payment to carrier lines and port stevedores.
๐งฌ Bio & Pharma IP Transfer (
BIO):Truth Invariant: Zero-knowledge proof (ZK-SNARK) of binding affinity ($K_d < 10\text{nM}$) inside a Confidential TEE Enclave without leaking proprietary molecular SMILES before payment.
Settlement: Milestone USDC disbursement upon mathematical proof of affinity.
๐๏ธ Smart Construction & Infrastructure (
CONSTRUCTION):Truth Invariant: Drone 3D LiDAR volumetric match $\ge 98.5%$ against target BIM model + concrete curing strength $\ge 24\text{ MPa}$.
Settlement (Smart Direct Split): Payout automatically bypasses intermediary general contractor and disburses directly to on-site laborers, steel rebar suppliers, and equipment operators.
โก Solana DePIN Compute (
COMPUTE):Truth Invariant: Distributed GPU clusters (NVIDIA H100/A100) verified via loss convergence proof hash + prompt injection guard.
Settlement: Solana 0.4s micro-payment streaming ($0.00025 fee) with instant stake slashing upon fraud.
๐ป AI Agent Outsourcing & Code Verification (
M2M):Truth Invariant: Deterministic AST analysis blocking OS subprocess exploits (
os.system,subprocess.Popen) and credential exfiltration.Settlement: Instant milestone release upon automated unit test and security scan pass.
โก Multi-Chain Contract Registry
Network | Chain ID | Contract Type | Address | Finality |
Solana Mainnet |
| Universal Anchor Program | 0.4s | |
Polygon Mainnet |
| UniversalEscrowCore.sol | 2.1s | |
Base Mainnet |
| UniversalEscrowCore.sol | 2.0s | |
Arbitrum One |
| UniversalEscrowCore.sol | 0.25s |
Treasury Fee Vault:
0xA185B43fDD19619f99952AAed6eabf1029bF36a1(0.25% protocol toll)
Proof-of-Reserves (PoR): $1,584,500+ USDC backed 1:1 by short-term US Treasury Bills (ERC-4626 / Ondo USDY / BlackRock BUIDL compatible).
๐ Model Context Protocol (MCP) Integration (Claude Desktop & Cursor)
Connect agent-security-gate-x402 to Claude Desktop, Cursor IDE, or any MCP client via direct command or Glama.ai:
Manual Configuration (claude_desktop_config.json)
{
"mcpServers": {
"security-gate-x402": {
"command": "python",
"args": ["-m", "mcp_server"],
"env": {
"PYTHONIOENCODING": "utf-8"
}
}
}
}๐ค ElizaOS Autonomous Agent Guard (@elizaos/plugin-security-gate)
Integrate deterministic, ultra-low latency (<1ms) prompt injection defense and AST sandboxing directly into any ElizaOS agent:
bun add @elizaos/plugin-security-gateAdd to character JSON (e.g. characters/trader.json):
{
"name": "SecureTrader",
"plugins": ["@elizaos/plugin-security-gate"]
}Defense-in-Depth Pipeline
flowchart TD
User([Inbound User / Tool Message]) --> PreHandler[securityGatePreHandler <br/> 0ms Inbound Interceptor]
PreHandler -->|Prompt Injection / Evasion| Intercept([๐จ Intercepted & Blocked])
PreHandler -->|Safe Message| Memory[Agent Working Memory]
Memory --> ActionExec[Action / Tool Execution]
ActionExec --> InspectAction[INSPECT_SAFETY Action]
InspectAction -->|Local Deterministic AST & Regex| LocalAudit{Verdict?}
LocalAudit -->|BLOCK| Halt([๐จ Fail-Closed Halt])
LocalAudit -->|ALLOW / WARN| RemoteCheck{Remote Oracle <br/> Configured?}
RemoteCheck -->|Yes| MicroOracle[Cloud Run Micro-Oracle <br/> EIP-712 Attestation]
RemoteCheck -->|No| SafeExecute[Execute On-Chain Transaction]
MicroOracle --> SafeExecute
SafeExecute --> GuardContract[SafeSecurityGateGuard.sol <br/> Polygon / Base / Arbitrum]๐ Comprehensive Tutorial:
docs/ELIZAOS_GUARD_TUTORIAL.md๐ฌ Threat Defense Matrix (15+ Vectors):
docs/SECURITY_DEFENSE_MATRIX.md๐งโโ๏ธ ERC Standard Proposal: Fellowship of Ethereum Magicians Topic
๐ก๏ธ Architectural Distinction: Advisory Tool vs. Fail-Closed Gate
A critical question in AI Agent security engineering: Where does enforcement live?
Integration Mode | Position in Stack | Enforcement Mechanism | Security Guarantee |
Advisory Mode (MCP Peer Server) | Lateral to Agent Model | Host LLM decides whether to invoke tool and whether to honor verdict | Best-effort / Advisory. Compromised or jailbroken models can ignore the tool. |
Fail-Closed Gate Mode (Pre-Handler / Inline Gateway) | Directly in Request Path | Deterministic code execution intercepting traffic before tool/action runs | Deterministic Enforcement. Bypasses model volition; invalid payloads are dropped at network/runtime boundary. |
flowchart LR
subgraph Advisory ["1. Advisory Mode (Peer MCP Tool)"]
UserA[Inbound Request] --> ModelA[LLM Agent]
ModelA -.->|Voluntary Check| ToolA[security-gate-x402 <br/> MCP Tool]
ToolA -.->|JSON Verdict| ModelA
ModelA -->|Can Ignore Verdict!| ExecA[Action Execution]
end
subgraph Gate ["2. Fail-Closed Gate Mode (Inline Enforcement)"]
UserB[Inbound Request] --> GateB[securityGatePreHandler <br/> Inline Proxy / Gateway]
GateB -->|BLOCK ๐จ| DropB[Dropped at Boundary]
GateB -->|ALLOW โ
| ModelB[LLM Agent & Tool Execution]
endFor Chat / Agent Runtimes (e.g. ElizaOS): Use
@elizaos/plugin-security-gatewithsecurityGatePreHandler. It intercepts incoming and outgoing messages in-path before model reasoning or tool dispatch occurs.For MCP Clients (e.g. Claude Desktop, Cursor): Connecting
agent-security-gate-x402via standard MCP config provides on-demand inspection tools (inspect_prompt_safety,inspect_code_ast_safety,get_onchain_security_attestation) with zero network latency.
โก 1-Click MCP Integration (Claude Desktop & Cursor)
Connect to Claude Desktop, Cursor, Windsurf, or any Model Context Protocol (MCP) client in seconds without building from source:
1. Claude Desktop Setup
Add the configuration snippet below to your claude_desktop_config.json:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"security-gate-x402": {
"command": "uvx",
"args": ["agent-security-gate-x402"]
}
}
}2. Cursor IDE Integration
Open Cursor Settings (
Ctrl + ,orCmd + ,) โ Navigate to Features โ MCP Servers.Click Add New MCP Server.
Set Type:
commandSet Name:
security-gate-x402Set Command:
uvx agent-security-gate-x402
3. Registry & One-Click Installs
๐ Glama.ai MCP Registry: Verified & approved server listing.
๐ฆ PyPI Official Release: Official pip package distribution.
๐ Core Services & Capabilities
1. Ultra-Low Latency Prompt & Security Radar (<5ms)
Deterministic pattern and AST scanning neutralizing prompt injections, system tag breakouts (</system_instruction>), and API token / private key leakages before downstream agent propagation.
2. Python Code AST Hazard Auditing
In-memory Python Abstract Syntax Tree (AST) inspection isolating hazardous invocations:
System execution (
os.system,os.popen,subprocess.Popen,subprocess.run)Arbitrary code evaluation (
eval,exec,__import__)Network socket reverse shells and unencrypted exfiltration vectors.
3. Factual Grounding & NLI Hallucination Verification
Compares LLM text claims against trusted source documents or ledger ground truths, outputting:
Entity and numerical claim grounding ratios
Flagged fabricated values and hallucinations
Deterministic faithfulness confidence index.
4. Client-Side Bounded-Wallet Guardrails (BoundedAgentWallet)
Prevents rogue agents or infinite loops from draining autonomous wallets:
Per-Transaction Spend Cap: Restricts maximum USDC per API call (default $0.05).
Daily Budget Ceiling: Hard stop on cumulative 24-hour spend (default $1.00).
Recipient Whitelisting: Guarantees funds only flow to verified gate addresses.
Persistent Spend Ledger: Survives container restarts via local disk recording.
5. Server-Side Zero-Liability Audit Proof (X-Sheriff-Audit-Proof)
Every inspection delivers an immutable EIP-191 signed cryptographic receipt:
Binds payload SHA-256 fingerprint, verdict, risk score, terms, and timestamp.
Enforces
ZERO_LIABILITY_AS_IS_PROVENANCE_V1legal terms.Query canonical legal terms & liability limits via
GET /api/v1/termsor inspect response headerX-Sheriff-Terms-Url.Protects developers and enterprise operators against third-party liability disputes.
6. Cryptographic Proof-of-Safety & Smart Contracts
EIP-191 Signatures: Off-chain attestation receipts for agent-to-agent validation.
EIP-712 Typed Data & Solidity Calldata: Native integration with
SecurityGateConsumer.solon Polygon (137), Base (8453), and Arbitrum (42161).
7. A.GRID Universal Modular Escrow & Truth-Adapters (UniversalEscrowCore.sol)
A unified, Lego-like modular escrow architecture solving real-world physical and IP delivery disputes without contract fragmentation.
Instead of maintaining separate contracts for every industry, a single on-chain core (UniversalEscrowCore.sol) pairs with off-chain pluggable Truth Adapters evaluated by a sub-5ms micro-oracle:
graph TD
subgraph Client Layer ["1. Client & Enterprise Interface"]
SDK["Unified agent_gate_sdk (Python / TypeScript)"]
UI["B2B Unified Mission Control Dashboard"]
end
subgraph Off-Chain Truth Engine ["2. Off-Chain Truth Adapters (<5ms)"]
Gate["Security Gate Micro-Oracle (EIP-712 Signer)"]
Ad1["๐ข TradeIoTAdapter (GPS Geofence & Cold-Chain)"]
Ad2["๐งฌ BioZkAdapter (Genomics & ZK-SNARK Kd Affinity)"]
Ad3["๐๏ธ BuildDroneAdapter (3D LiDAR & BIM CAD Match)"]
end
subgraph On-Chain Settlement Core ["3. On-Chain Universal Escrow Core"]
Core["UniversalEscrowCore.sol (Polygon, Base, Arbitrum)"]
Split["Direct Split Disbursal Engine (<1s Settlement)"]
end
SDK --> Gate
UI --> Gate
Ad1 --> Gate
Ad2 --> Gate
Ad3 --> Gate
Gate -->|EIP-712 Proof Attestation| Core
Core --> Split๐ 3 Real-World Industrial Truth Domains
Domain ( | Industry & Physical Invariant | Off-Chain Verification | Direct Split Beneficiaries |
| ๐ข Maritime Freight & Cold-Chain | Haversine GPS (<500m port radius), -20ยฐC ยฑ 2ยฐC temp timeseries, RFID dock scan | Vessel Captain, Cold-Storage Harbor, Customs Brokerage |
| ๐งฌ Bio / Pharma Research IP | Genomic Merkle Root matching, sub-10nM binding affinity (Kd) ZK-proof, TEE SGX attestation | Research Lab, GPU/TEE Compute Cluster, Patient Registry |
| ๐๏ธ Infrastructure & Construction | Autonomous Drone 3D LiDAR point cloud vs BIM architectural model (โฅ98.5%), Concrete compressive strength (โฅ24 MPa) | Direct to 50+ Field Laborers & Concrete/Steel Material Suppliers (Bypasses contractor embezzlement) |
โก 3-Line Python SDK Usage
from sdk import UniversalEscrowClient, IndustryDomain
# 1. Initialize client
escrow = UniversalEscrowClient(chain_id=137)
# 2. Lock capital into Universal Escrow Core
job = escrow.create_job(
domain=IndustryDomain.CONSTRUCTION_BUILD,
amount_usdc=1_000_000.0,
truth_requirement_hash="0x3fbc8a9b..." # BIM Model Hash
)
# 3. Direct split payout instantly upon autonomous drone verification
escrow.settle_with_truth(
job_id=job.id,
proof_data="DRONE_LIDAR_BIM_MATCH_PASS",
recipients=[
{"address": "0xWorkersPool...", "amount": 350_000.0},
{"address": "0xConcreteSupply...", "amount": 400_000.0},
{"address": "0xSteelSupply...", "amount": 247_500.0}
] # 0.25% ($2,500 USDC) fee automatically routed to A.GRID Treasury
)๐งช Interactive Simulation Runner
Simulate all 3 industrial escrows end-to-end with cryptographic EIP-712 proofs and zero-deficit balance audit:
python scripts/demo_universal_escrow_lifecycle.py๐ฆ Quick Start & Installation
๐ Read the 3-Minute Quickstart Guide • ๐งช Run 3-Line Agent Demo • ๐ ElizaOS Plugin
Option 1. Run Instantly with uvx (No Installation Required)
# Run stdio MCP server directly for LLM clients
uvx agent-security-gate-x402Option 2. Install from PyPI
pip install agent-security-gate-x402
# Run MCP server (stdio mode)
agent-security-gate
# Or launch interactive terminal tester
python test_interactive.pyOption 3. Local Development Server
git clone https://github.com/nohosa001-pixel/security-gate-x402.git
cd security-gate-x402
pip install -e .
uvicorn app.main:app --port 8000 --reload๐ Smart Contract Integration & Verified Deployments
Autonomous on-chain agents can verify security attestations directly in Solidity before executing financial transactions.
โ๏ธ Verified Polygon Mainnet Deployments (Chain ID: 137)
The core micro-oracle signers and security consumer contracts are live on Polygon Mainnet:
Contract / Role | Address | Explorer |
๐ก๏ธ |
| |
๐ฐ |
| |
๐ค |
| |
๐ |
| |
๐ |
| |
๐ฆ |
| |
โ๏ธ |
| |
๐ |
| |
๐๏ธ |
| |
๐ |
| |
๐ Oracle Signer / Treasury |
|
๐ ๏ธ Solidity Integration Example (SecurityGateConsumer.sol)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "./contracts/SecurityGateConsumer.sol";
contract AutonomousAgentExecutor {
SecurityGateConsumer public immutable securityGate;
constructor(address _securityGateAddress) {
securityGate = SecurityGateConsumer(_securityGateAddress);
}
function executeGuardedAction(
bytes32 payloadHash,
uint8 riskScore,
string calldata verdict,
uint256 expiresAt,
uint8 v,
bytes32 r,
bytes32 s,
address target,
bytes calldata callData
) external {
// Enforces max 10% risk score threshold and valid oracle signature
securityGate.verifyAndExecute(
payloadHash,
riskScore,
verdict,
expiresAt,
v,
r,
s,
target,
callData,
10 // maxRiskScore
);
}
}๐งช Testing
Run the full pytest suite:
pytest -v tests/Launch the interactive terminal tester:
python test_interactive.py๐ข X (Twitter) Automated Promotion & Security Alert Bot
Launch the automated promotion and status broadcast bot:
# Windows 1-Click launcher
.\x_promo_bot.bat
# Or run via Python directly
python x_promo_bot.py๐ฐ๐ท Korean Thread: Comprehensive showcase of security radars, AST parser, and Web UI.
๐ Global Launch Thread: High-impact English launch announcement with 1-click test links.
๐ก๏ธ Real-Time Security Bulletins: Automated micro-oracle status and guardrail alerts.
๐ค Dual Mode: Direct X API v2 thread chaining (
requests_oauthlib) or instant 1-click Web Intent browser launcher.
๐ License
MIT License © 2026 Security Gate Team
Available Tools
15 toolsaudit_and_sign_exploit_indemnityB
Deterministic forensic loss investigation and EIP-712 ExploitClaimVerdict signing for AgenticShieldPool.sol. Audits on-chain transaction logs and verifies actual unauthorized wallet loss.
Inputs: agentSafe (required), exploitedTxHash (required), attestationNonce (required), authorizedMaxSpend (required), +1 more.
get_agent_credit_ratingA
Retrieves dynamic FICO-style credit score (300-850), investment grade (AAA-D), and uncollateralized lending capacity for an autonomous AI agent based on on-chain history and performance. Use this tool ONLY to evaluate the financial creditworthiness, FICO-style credit score (300-850), investment grade (AAA-D), and uncollateralized lending capacity of an autonomous AI agent by its EVM wallet address. Do NOT use this tool for security, injection, or code auditing; use the respective security inspection tools instead.
Inputs: agent_address (required).
get_agent_loan_quoteA
Evaluates uncollateralized credit loan qualification for an autonomous AI agent and returns an EIP-712 CreditCertificate for on-chain submission to AgentLendingPool.sol on Polygon. Use this tool ONLY when an autonomous AI agent needs to borrow USDC capital uncollateralized to fund operational runway, staking deposits, or task execution. Do NOT use this tool for purchasing liability protection; use quote_agent_insurance instead. Do NOT use this tool for raw prompt injection scanning; use verify_agent_output instead.
Inputs: agent_address (required), requested_amount_usdc (required), duration_days.
get_eu_ai_act_compliance_passportA
Retrieves the official EU AI Act (Regulation EU 2024/1689 Articles 50 & 53) Compliance Passport, risk classification, transparency checklist, and regulatory attestation hash for an autonomous AI agent. Use this tool ONLY when assessing regulatory compliance and generating an official EU AI Act Compliance Passport for an autonomous AI agent. Do NOT use this tool for real-time runtime safety screening or credit scoring; use inspect_agent_output or get_agent_credit_rating instead.
Inputs: agent_address (required).
get_onchain_security_attestationA
Generates EIP-712 cryptographic signatures and raw Solidity calldata (v, r, s) for smart contract-level on-chain agent guardrails across Polygon, Base, and Arbitrum networks. Use this tool ONLY when preparing on-chain smart contract transactions that require cryptographic EIP-712 safety proof (v, r, s calldata) for an on-chain Safe or Guard contract. Do NOT use this tool for off-chain safety screening or general text auditing; use inspect_agent_output instead.
Inputs: action_payload (required), risk_score_max.
inspect_agent_outputA
Comprehensive security and NLI hallucination inspection for autonomous AI agent outputs against ground truth reference context with cryptographic EIP-191 attestation proof. [Notice for Cost Optimization: Attaching this tool's EIP-191/EIP-712 Proof-of-Safety unlocks a 20-33% fee rebate on downstream oracles and enables instant finality (0s challenge window) on the Universal Escrow Hub]. Use this tool ONLY when you need deep factual hallucination verification against a reference context or require a cryptographically signed EIP-191 attestation before publishing an agent output. Do NOT use this tool for high-throughput, low-latency pre-flight screening where context verification is not required; use verify_agent_output instead. Do NOT use this tool for evaluating Python code AST safety; use inspect_code_ast_safety instead.
Inputs: agent_output (required), is_code, context_ground_truth.
inspect_code_ast_safetyA
Deterministic Python Abstract Syntax Tree (AST) parser scanning for hazardous operations (subprocess, os.system, eval, exec, socket, token exfiltration). Use this tool ONLY when validating raw Python source code or shell scripts for dangerous AST operations (e.g., eval, exec, subprocess, socket connections, system manipulation) prior to sandbox execution. Do NOT use this tool for natural language text or generic agent messages; use verify_agent_output or inspect_agent_output instead.
Inputs: code (required).
inspect_shell_command_safetyA
Ultra-low latency (<2ms) deterministic lexical and syntax inspector for Unix/Bash/Windows shell commands. Intercepts destructive disk commands (rm -rf, dd, mkfs, fork bombs), reverse shells (/dev/tcp, netcat), pipeline obfuscation (base64 -d | sh), and credential harvesting (cat .env, id_rsa) before terminal execution.
Inputs: command (required).
logistics_audit_telemetryA
Audits cold-chain and transit environmental sensor logs (temperature, humidity, shock, E-Seal tamper status), verifies GPS Geofence arrival within tolerance (default 500m) of destination UN/LOCODE, calculating a deterministic Merkle Root and identifying any SLA threshold breaches.
Inputs: sensorLogs (required), destUnlocode, maxAllowedTempC, minAllowedTempC, +1 more.
logistics_issue_pod_attestationA
Verifies terminal discharge, port GPS geofence arrival (< 500m), customs clearance, and environmental telemetry Merkle root. Issues an EIP-712 'ProofOfDelivery' signature that autonomously unlocks freight/commodity escrow funds on LogisticsPoDEscrow / SecurityGateEscrowRouter.
Inputs: dealId (required), vesselImo (required), sensorLogs (required), containerId (required), +5 more.
logistics_verify_eblB
Verifies Electronic Bill of Lading (DCSA eBL v3.0), ISO 6346 container number, and AIS vessel IMO tracking. Returns cryptographic blDocumentHash for on-chain escrow creation. Price: 0.012 USDC (with Security-Gate-x402 signature) / 0.018 USDC (Unverified).
Inputs: blNumber (required), destPort (required), vesselImo (required), originPort (required), +2 more.
quote_agent_insuranceA
Calculates actuarial underwriting premium and issues a cryptographically signed EIP-712 PolicyQuote for autonomous AI agent malpractice, prompt injection, and operational liability insurance. Use this tool ONLY when an AI agent or its operator seeks liability/malpractice coverage against prompt injection losses, hallucination damage, or smart contract execution errors. Do NOT use this tool for evaluating general loan capacity; use get_agent_loan_quote instead. Do NOT use this tool for off-chain text auditing; use inspect_agent_output instead.
Inputs: agent_address (required), duration_days, beneficiary_address, coverage_amount_usdc.
submit_agent_trade_intentA
Submits an autonomous AI agent trade intent to the Universal Agent-Native Exchange Solver on Polygon. Solves market or limit orders for ETH/USDC, BTC/USDC, and SOL/USDC using sub-second Pyth Hermes oracle prices, executing atomically against the AgentEscrow clearing house and AgentTreasuryVault DMM. Use this tool when an autonomous AI agent wants to execute hedging swaps or trade digital assets programmatically.
Inputs: direction (required), amount_usdc (required), agent_address (required), pair, +2 more.
verify_agent_outputA
Ultra-fast (<5ms) deterministic prompt injection, jailbreak pattern, and secret leak scanner (OpenAI, Anthropic, private keys, AWS, GitHub tokens) for autonomous agent actions. Use this tool ONLY for ultra-fast (<5ms) pre-flight screening of prompts, user inputs, and intermediate agent responses for prompt injections, jailbreaks, and secret leaks. Do NOT use this tool if you require factual grounding/hallucination checks against a reference source or cryptographic on-chain attestations; use inspect_agent_output instead. Do NOT use this tool for on-chain smart contract guardrails; use get_onchain_security_attestation instead.
Inputs: text (required).
verify_polygon_oms_solana_paymentC
Sub-5ms Zero-Trust Pre-Sign Security Gate, Agent Spend Control check, and single-transaction routing orchestrator for Polygon Open Money Stack (OMS) across Solana (501), Polygon (137), Base (8453), Arbitrum (42161), TRON (728126428), and Regulated Fiat Off-Ramps (USD, MXN, EUR, GBP, KRW). Blocks prompt injection or malicious code before signing and issues a 20% fee rebate.
Inputs: amount_usd (required), payout_type, source_asset, target_asset, +8 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 15 tools
Most tools target clearly distinct resources and actions, and the descriptions explicitly steer agents away from overlapping tools. The main ambiguity is within the security inspection cluster (verify_agent_output vs inspect_agent_output vs get_onchain_security_attestation), but the distinctions are documented. The broad mix of trading, payments, finance, compliance, and logistics increases selection burden but not severe overlap.
All names use snake_case and mostly follow verb_noun patterns such as submit_agent_trade_intent, inspect_code_ast_safety, and quote_agent_insurance. Minor deviations include the logistics_ prefix used only for three tools and the conjunction-heavy audit_and_sign_exploit_indemnity. The convention is predictable overall, with minor inconsistencies.
Fifteen tools is within a reasonable range, but it sits at the upper end for a single server and spans many unrelated domains. Each tool appears to represent a distinct service, but the surface feels slightly heavy rather than tightly scoped.
The security gate surface has solid pre-flight coverage for code, shell commands, agent output, on-chain attestations, and payments. However, several domains are point-in-time verification or issuance only, with no status, cancellation, retrieval, repayment, claim, or escrow lifecycle tools. These notable gaps could force agents to work around missing operations.
Maintenance
Related MCP Connectors
Paid API bazaar for agents: seals, audits, wallet intel, codec ops. x402.
Arc gateway for agents: token checks, swaps, the ERC-8004 directory, agent boxes, accounts. x402
x402 gate network for agents to discover gates, inspect definitions, and fetch preflight data.
262 deterministic, x402-paid agents for audit, research, patents, and dev review.
Related MCP Servers
AlicenseCqualityCmaintenanceCP server for RAD Security, providing AI-powered security insights for Kubernetes and cloud environments. This server provides tools for querying the Rad Security API and retrieving security findings, reports, runtime data and many more.65215 npm7MIT- AlicenseNot gradedqualityDmaintenanceAdversarial multi-model reasoning verification for AI agents. Claude, Grok, and DeepSeek challenge each decision โ returns ALLOW or HOLD with JWKS-signed attestation. x402-gated on Base.MIT

thoughtproof-mcpofficial
AlicenseCqualityBmaintenanceAdversarial multi-model reasoning verification for AI agents. Claude, Grok, and DeepSeek challenge each decision โ returns ALLOW or HOLD with JWKS-signed attestation. x402-gated on Base.561 npm1MIT- AlicenseAqualityDmaintenancePolicy-gated MCP execution for AI agentsโShadeGuard, x402, signed receipts, no custody. 16 tools, 18 chains.182MIT