DeFi Sentinel X MCP Server
Monitors DeFi protocols on X Layer (OKX's EVM-compatible L2), detecting price manipulation, liquidity drains, and unusual trading activity, with severity-classified alerts and on-chain risk scores.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@DeFi Sentinel X MCP Serverscan the WETH/USDC pool on X Layer for anomalies"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
π°οΈ DeFi Sentinel X
Autonomous AI Agent for X Layer DeFi Protocol Monitoring
An autonomous AI agent that monitors X Layer (OKX's EVM-compatible L2, chainId 196) DeFi protocols in real-time β detecting price manipulation, liquidity drains, and unusual trading activity, then generating severity-classified alerts with on-chain risk scores.
Built for the OKX BuildX AI Season Hackathon ($300K prize pool).
π― Problem
DeFi protocols on X Layer are vulnerable to attacks that execute in seconds:
Price manipulation via sandwich attacks and oracle manipulation
Liquidity drains from pool imbalances and rug pulls
Unusual trading from MEV bots and exploit frontrunning
Users have no real-time early warning system. By the time a human notices a pool's reserves dropping, the damage is done. Existing monitoring tools are either centralized alerts (slow) or static dashboards (passive).
Related MCP server: BlueAgent x402 Services
π‘ Solution
DeFi Sentinel X is an autonomous AI agent that:
Continuously scans X Layer DeFi pools via real on-chain RPC calls
Detects anomalies using statistical heuristics (reserve imbalance, liquidity drain, unusual activity)
Computes risk scores (0-100 composite score) factoring anomaly severity, confidence, and type diversity
Generates alerts with severity classification and recommended actions
Checks position health for Aave V3 lending positions (health factor, liquidation distance)
The agent uses an MCP-style tool architecture β each capability is a
discrete tool with a JSON Schema input definition, orchestrated by an
agent layer that chains: scan_pool β detect_anomaly β calculate_risk_score β generate_alert.
π Unique Angle
Unlike passive monitoring dashboards, DeFi Sentinel X is an active AI agent that:
Uses real X Layer RPC (live block numbers, gas prices, eth_call against pool contracts)
Follows the MCP (Model Context Protocol) tool pattern β 7 tools, each with name, description, and JSON Schema input, callable individually or orchestrated by the agent
Runs fully on free-tier infrastructure (Vercel serverless + SQLite /tmp + public RPCs)
Provides deterministic, reproducible agent orchestration (no LLM API key needed for the demo β the tool-chaining logic is the AI layer)
Deploys as a Vercel serverless function β no servers, no cost, scales to zero
ποΈ Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DeFi Sentinel X Agent β
β (Autonomous Tool Orchestrator) β
β β
β scan_pool β detect_anomaly β risk_score β alert β
β β
β Additional: get_position_health, get_chain_status β
β get_audit_trail β
ββββββββββββββββ¬βββββββββββββββββββββββ¬βββββββββββββββββ
β β
βββββββββΌββββββββ ββββββββββΌβββββββββ
β X Layer RPC β β SQLite (/tmp) β
β (real data) β β (audit trail) β
β β β β
β eth_chainId β β scans table β
β eth_blockNum β β anomalies tbl β
β eth_call β β alerts table β
β eth_getBalanceβ β risk_assess tbl β
βββββββββββββββββ βββββββββββββββββββ
β
βββββββββΌββββββββ
β Vercel β
β Serverless β
β (@vercel/py) β
βββββββββββββββββMCP Tool Architecture (7 Tools)
# | Tool | Method | Description |
1 |
| GET | Scan a DeFi pool for live reserves & TVL from X Layer RPC |
2 |
| GET | Run anomaly detection heuristics on pool data |
3 |
| GET | Compute composite risk score (0-100) for a pool |
4 |
| GET/POST | Generate a severity-classified alert from an anomaly |
5 |
| GET | Check Aave V3 lending position health factor |
6 |
| GET | Get live X Layer chain metadata (block, gas) |
7 |
| GET | Retrieve stored scan/anomaly/alert history |
All tools are also exposed via MCP protocol endpoints:
GET /mcp/toolsβ MCP tools/listPOST /mcp/callβ MCP tools/call (body:{"name": "...", "arguments": {...}})
π οΈ Tech Stack
Component | Technology | Why |
API Framework | FastAPI 0.115 | Async, auto-docs, Pydantic validation |
Hosting | Vercel (serverless) | Free tier, auto-scaling, zero config |
Chain Data | X Layer RPC (real) | Live on-chain data, no API key needed |
Persistence | SQLite (/tmp) | Serverless-friendly, no external DB |
Agent Pattern | MCP-style tools | Standardized tool interface |
Frontend | Vanilla HTML/CSS/JS | No framework, fast load, simple deploy |
Language | Python 3.12 | Vercel Python runtime |
β What's Real vs β οΈ Mocked
β Real (Live On-Chain)
X Layer RPC calls β
eth_chainId,eth_blockNumber,eth_gasPricereturn live data (chainId 196, current block ~67M)eth_call against pool contracts β
getReserves(),totalSupply()selectors sent to real X Layer contractseth_getBalance β real native balance reads for wallet health checks
SQLite persistence β scans, anomalies, alerts, and risk assessments stored in
/tmp/defi_sentinel_x.db(survives across warm serverless invocations)Anomaly detection heuristics β reserve imbalance, liquidity drain, zero liquidity, unusual activity detection run on real pool data
Composite risk scoring β 0-100 score with severity classification (CRITICAL/HIGH/MODERATE/LOW/MINIMAL)
Agent orchestration β tool-chaining logic: scan β detect β score β alert (the AI layer)
β οΈ Mocked / Simulated
Pool reserve values β if
eth_callreturns zeros (demo pool addresses aren't real Uniswap pairs on X Layer), falls back to deterministic simulation based on pool name + block number (reproducible, varies as blocks advance)Aave V3 health factor β derived from address hash (real Aave integration requires
Pool.getUserAccountData()which needs a funded position; theeth_getBalancecall IS real)Baseline reserve ratios β hardcoded (production would use a time-series DB like TimescaleDB)
"Unusual activity" heuristic β uses block-number parity as a proxy for tx volume (production would use mempool/trace data)
No LLM API key β the agent orchestration is deterministic (reproducible in serverless without external API dependencies)
π Quick Start
Local Development
cd defi-sentinel-x
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000
# Open http://localhost:8000API Endpoints
Endpoint | Method | Description |
| GET | Dashboard UI |
| GET | Health check + RPC status |
| GET | Agent config + tool inventory |
| GET | Full autonomous agent demo (sweeps all pools) |
| POST | Single-pool monitoring sweep |
| GET | MCP tools/list |
| POST | MCP tools/call |
| GET | Scan a pool |
| GET | Detect anomalies |
| GET | Compute risk score |
| GET/POST | Generate alert |
| GET | Check position health |
| GET | Live chain metadata |
| GET | Stored history |
| GET | Full audit trail |
| GET | Aggregate stats |
| GET | Swagger UI |
Deploy to Vercel
vercel --prod --yes --token "$VERCEL_TOKEN"π Links
Live Demo: https://defi-sentinel-x.vercel.app
X Layer: https://www.okx.com/xlayer
Hackathon: OKX BuildX AI Season ($300K)
π Project Structure
defi-sentinel-x/
βββ api/
β βββ index.py # Vercel entry point
βββ app/
β βββ __init__.py
β βββ main.py # FastAPI app + routes
β βββ tools.py # MCP tool registry + handlers (7 tools)
β βββ agent.py # Agent orchestrator (tool-chaining)
β βββ xlayer_client.py # X Layer RPC client (real on-chain reads)
β βββ store.py # SQLite persistence layer
βββ static/
β βββ index.html # Dark-theme dashboard UI
βββ vercel.json # Vercel config
βββ requirements.txt # Python deps
βββ SUBMISSION.md # Hackathon submission fields
βββ README.md # This fileπ License
MIT License β see LICENSE
Built by 0xConsole for the OKX BuildX AI Season Hackathon.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityCmaintenanceCross-chain DeFi intelligence MCP server for AI agents. 7 tools for yield discovery, pool analysis, profit simulation, risk scoring, whale tracking, impermanent loss calculation, and DeFi overview across 86 chains and 6,500+ liquidity pools.71AGPL 3.0
- Flicense-qualityDmaintenancePay-per-use AI security and research tools for autonomous agents on Base, enabling honeypot detection, risk assessment, wallet analysis, and yield optimization via the x402 protocol.
- AlicenseAqualityDmaintenanceReal-time DeFi analytics MCP server for AI agents. Provides token risk analysis, yield scanning, and wallet exposure checking across Base, Ethereum, and Arbitrum.381MIT

Syeniteofficial
Flicense-qualityDmaintenanceA DeFi MCP server enabling AI agents to query lending rates, execute swaps/bridges, monitor positions, and access prediction markets across 30+ chains with a trust layer for calldata verification.
Related MCP Connectors
AI-native settlement rail + intelligence oracle for autonomous agents. x402, Base mainnet, 81 tools.
Rug-check & launch radar for trading agents: composite honeypot score, EVM+Solana, keyless x402.
Token swaps and honeypot/rug checks for AI agents on 8 chains, paid per-call in USDC via x402.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/0xConsole/defi-sentinel-x'
If you have feedback or need assistance with the MCP directory API, please join our Discord server