BaseSentinel
AI DeFi risk monitor for Base L2 that exposes MCP tools for real-time protocol health checks, anomaly detection, risk reporting, and threshold alerts.
README
BaseSentinel — AI DeFi Risk Monitor for Base L2
Unlike generic DeFi monitors, BaseSentinel uses MCP tool protocol for AI agent-native integration and focuses exclusively on Base L2 ecosystem protocols with real-time on-chain risk scoring.
Live demo: https://base-sentinel-agent.vercel.app Repo: https://github.com/0xConsole/base-sentinel-agent
Built for the Orion Agents Builder Hackathon — an AI agent for the Base ecosystem that monitors DeFi protocol risk in real time.
What it does
BaseSentinel continuously evaluates the health of Base-native protocols (Aerodrome, Moonwell, Seamless, Baseline, Aave V3) using statistical anomaly detection. Every monitoring capability is exposed as an MCP (Model Context Protocol) tool, so an AI agent can integrate and call them natively — the agent gets a risk report, detects anomalies, and raises alerts without a human in the loop.
Statistical anomaly detection
| Detector | Threshold | What it catches |
|---|---|---|
| Z-score | > 3σ | TVL / volume far from rolling mean |
| Velocity | > 15% | Single-step rate-of-change spike |
| Liquidity drain | > 3σ on returns | Coordinated withdrawal pattern |
| TVL risk score | 0-100 composite | Weighted liquidity + volume + reserve risk |
MCP Tool Registry
| Tool | Description |
|---|---|
check_pool_health |
TVL, volume, reserve, 0-100 risk score, status |
detect_anomalies |
z-score, velocity, liquidity drain across protocols |
generate_risk_report |
Per-protocol + ecosystem-wide risk report |
monitor_base_protocol |
Block-level monitoring with health deltas |
alert_on_threshold |
Threshold-driven alert generation |
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Dark-themed dashboard |
/api/health |
GET | Service + Base RPC status |
/api/agent/status |
GET | Agent config + MCP tool inventory |
/api/demo |
GET/POST | Full monitoring cycle (the demo flow) |
/api/tools/check_pool_health |
GET | MCP tool: check pool health |
/api/tools/detect_anomalies |
GET | MCP tool: detect anomalies |
/api/tools/generate_risk_report |
GET | MCP tool: risk report |
/api/tools/monitor_base_protocol |
GET | MCP tool: monitor protocol |
/api/tools/alert_on_threshold |
GET | MCP tool: alert evaluation |
/api/mcp/tools |
GET | MCP tools/list (JSON Schema) |
/api/mcp/call |
POST | MCP tools/call ({name, arguments}) |
Quick start (local)
git clone https://github.com/0xConsole/base-sentinel-agent.git
cd base-sentinel-agent
pip install -r requirements.txt
uvicorn app.main:app --reload
# open http://localhost:8000
Demo flow
Click "Run Monitoring Cycle" on the dashboard, or call the endpoint:
curl https://base-sentinel-agent.vercel.app/api/demo | jq .summary
This runs the full autonomous pipeline:
monitor_base_protocol → detect_anomalies → generate_risk_report → alert_on_threshold
and returns the ecosystem risk score, anomaly count, and active alerts.
Call an MCP tool (agent-native)
# List tools (MCP tools/list)
curl https://base-sentinel-agent.vercel.app/api/mcp/tools | jq .
# Call a tool (MCP tools/call)
curl -X POST https://base-sentinel-agent.vercel.app/api/mcp/call \
-H 'Content-Type: application/json' \
-d '{"name":"detect_anomalies","arguments":{"protocol_name":"all"}}' | jq .
Architecture
┌─────────────────────────────────────────────────┐
│ Dashboard (static/index.html — dark theme) │
│ Real-time fetch · 30s auto-refresh · risk gauge │
└────────────────────┬────────────────────────────┘
│ fetch /api/*
┌────────────────────▼────────────────────────────┐
│ FastAPI app (app/main.py) │
│ Routes: /, /api/health, /api/demo, /api/agent/* │
│ /api/tools/*, /api/mcp/* │
└────────────────────┬────────────────────────────┘
│
┌────────────────────▼────────────────────────────┐
│ Agent (app/agent.py) — MCP Tool Registry │
│ • check_pool_health • monitor_base_protocol │
│ • detect_anomalies • alert_on_threshold │
│ • generate_risk_report │
│ Statistical: z-score >3σ, velocity >15%, drain │
└────────────────────┬────────────────────────────┘
│ eth_blockNumber RPC
┌────────────────────▼────────────────────────────┐
│ Base L2 RPC (mainnet.base.org → sepolia → mock) │
│ Protocols: Aerodrome, Moonwell, Seamless, │
│ Baseline, Aave V3 │
└──────────────────────────────────────────────────┘
Tech stack
- Backend: FastAPI + Pydantic (Python)
- Chain data: Base L2 public RPC (free), deterministic mock fallback
- Frontend: Single-file dark dashboard (vanilla HTML/CSS/JS)
- Deploy: Vercel serverless free tier (
@vercel/python+@vercel/static) - MCP: JSON Schema tool definitions,
/api/mcp/tools+/api/mcp/call
What's real vs mocked
| Component | Status |
|---|---|
| FastAPI backend + 5 MCP tools | Real — fully implemented |
| Statistical anomaly detection | Real — z-score, velocity, drain |
| Base L2 RPC integration | Real — probes mainnet.base.org; falls back to mock telemetry if RPC unreachable |
| Protocol TVL series | Mock when RPC offline (deterministic, preserves statistical signal shape) — real contract addresses used as identity anchors |
| Dashboard + risk gauge | Real — live fetch + auto-refresh |
| Vercel deploy | Real — base-sentinel-agent.vercel.app |
Orion Agents Builder Hackathon
- Hackathon: orionagents.org/hackathon
- Track: AI agent on Base ecosystem
- Prize: $5K, 7 winners, Sep 2 deadline
- Repo: github.com/0xConsole/base-sentinel-agent
- Live: base-sentinel-agent.vercel.app
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。