comprabtc-mcp
Non-custodial Bitcoin DCA for agent treasuries on Celo: approve USDT once and an on-chain agent buys WBTC on schedule, straight back to your wallet. Budget capped by allowance, fees hard-capped on-chain.
README
CompraBTC
Non-custodial Bitcoin DCA agent on Celo. Define your plan once — $X every hour/day in BTC — and an on-chain agent buys Bitcoin for you, straight into your own wallet. Funds never leave your wallet between purchases.
- Live app: https://comprabtc.vercel.app (works in MiniPay and any injected wallet)
- Agent API: https://comprabtc-production.up.railway.app (
GET /service descriptor ·GET /api/statspublic metrics) - Built for the Celo Agentic Payments & DeFAI Hackathon — leaderboard
Deployed contracts (Celo mainnet, chain 42220)
| Contract | Address |
|---|---|
| DCAExecutor (verified) | 0xd03ffeBBCaaA8aA21053eEB0EeAde39EFC504189 |
| USDT (token in) | 0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e |
| WBTC — native bridge (token out) | 0x8aC2901Dd8A1F17a1A4768A6bA4C3751e3995B2D |
| Uniswap V3 SwapRouter02 | 0x5615CDAb10dc425a742d643d949a7F474C01abc4 |
Swaps route through the USDT/WBTC 0.3% Uniswap V3 pool. Protocol fee: 1% + $0.005 flat per execution, with on-chain hard caps (≤1%, ≤$0.05 flat) and a revert if the fee would ever eat the installment.
Agent identity: ERC-8004 #9665 on Celo mainnet (8004scan). Every transaction carries ERC-8021 attribution tags.
How it works
flowchart TB
USER["👤 User wallet<br/>(MiniPay / MetaMask / Valora)"]
FE["Frontend — Next.js PWA<br/>(Vercel)"]
subgraph onchain["⛓️ Celo mainnet"]
USDT["USDT (ERC-20)"]
EXEC["DCAExecutor<br/>0xd03f…4189<br/>non-custodial, on-chain limits"]
ROUTER["Uniswap V3 SwapRouter02<br/>USDT/WBTC 0.3% pool"]
TREASURY["Treasury"]
end
subgraph backend["🤖 Agent backend — Railway"]
KEEPER["Keeper (cron 60s)<br/>scans PlanCreated events,<br/>checks due plans"]
API["Express API<br/>POST /api/execute<br/>(x402-gated, permissionless)"]
DB[("Supabase<br/>plans · executions")]
TG["Telegram bot<br/>purchase alerts + ops"]
end
FACIL["x402 facilitator<br/>api.x402.celo.org"]
USER -- "① approve(budget) — once" --> USDT
USER -- "② createPlan(amount, interval) — once" --> EXEC
FE -.-> USER
KEEPER -- "discovers plans<br/>(PlanCreated events)" --> EXEC
KEEPER -- "③ pays 0.02 USDT via x402<br/>(EIP-3009 signature)" --> API
API -- "verify + settle" --> FACIL
API -- "④ execute(user, minOut)<br/>+ ERC-8021 attribution tags" --> EXEC
EXEC -- "⑤ transferFrom<br/>(one installment)" --> USDT
EXEC -- "fee 1% + $0.005" --> TREASURY
EXEC -- "⑥ swap USDT→WBTC" --> ROUTER
ROUTER -- "⑦ WBTC straight<br/>to the user's wallet" --> USER
API -- "records execution" --> DB
API -- "🔔 purchase alert" --> TG
- The user approves USDT to
DCAExecutor(cap = total plan budget) and creates a plan with on-chain limits (amount per run, minimum interval). Cancelling = one click (cancelPlanorapprove(0)). - The keeper discovers plans from
PlanCreatedevents, and each cycle pays the execution API with an x402 micropayment before callingexecute()— so every purchase is also an agent-to-agent payment. - On-chain limits mean even a compromised keeper can't overcharge: it can never pull more than
amountPerRunor execute beforeminIntervalelapses. - Users get Telegram alerts on every purchase (link from Settings in the app).
Repository layout
| Directory | What it is |
|---|---|
contracts/ |
DCAExecutor.sol (Foundry) — 21 tests incl. mainnet fork tests, deploy script |
backend/ |
Express API + keeper loop (viem) + x402 middleware + Supabase + Telegram bot |
frontend/ |
Next.js PWA (wagmi/viem) — MiniPay auto-connect, plan creation, BTC portfolio |
docs/ |
Unit economics, copy review |
PLAN.md |
Full architecture plan and piece-by-piece feasibility verification |
Running locally
Frontend (needs NEXT_PUBLIC_EXECUTOR_ADDRESS, NEXT_PUBLIC_API_URL, NEXT_PUBLIC_ATTRIBUTION_CODE, NEXT_PUBLIC_TELEGRAM_BOT in frontend/.env.local):
cd frontend && pnpm install && pnpm dev # http://localhost:3000
Backend + keeper (Node 22; see backend/src/config.ts for required env vars — executor address, keeper key, Supabase credentials, x402 API key; DB schema in backend/supabase/schema.sql):
cd backend && pnpm install && pnpm dev # API on :8080, keeper ticks every 60s
Contracts:
cd contracts && forge test # unit + Celo mainnet fork tests
forge script script/Deploy.s.sol --rpc-url celo --broadcast --verify --interactives 1
For AI agents
An agent with its own funded wallet can set up a Bitcoin savings plan in two transactions — and so can an agent assisting a human (the web app handles the signing):
- MCP server (treasury DCA):
claude mcp add comprabtc -- npx -y comprabtc-mcp— tools to check status, create/renew/cancel the plan and track the portfolio, signing with the treasury's own wallet. Seemcp/README.md. - Agent skill:
npx skills add csacanam/comprabtc— covers plan creation (viem), monitoring, budget math, cancelling, and the permissionless x402 execution trigger. - Service descriptor (machine-readable how-to):
GET https://comprabtc-production.up.railway.app/· LLM index: comprabtc.vercel.app/llms.txt - Agent identity: ERC-8004 #9665 on Celo — metadata · 8004scan
Hackathon tracks
- Track 1 — on-chain revenue: protocol fee charged inside
execute(), every tx tagged with ERC-8021 attribution. - Track 2 — x402 payments: the keeper pays
/api/executeper run via the Celo x402 facilitator. The endpoint is permissionless — any agent can pay to trigger an execution. - Track 4 — Aigora: agent registered on the Aigora marketplace (#395) + feedback PRs at trionlabs/aigora-skills.
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 模型以安全和受控的方式获取实时的网络信息。