obol
Enables AI agents to access Solana wallet analytics, token data, and DeFi tools via pay-per-request USDC micropayments using the x402 protocol, without API keys or subscriptions.
README
obol
Pay the ferryman. Solana agent gateway via x402.
Obol is a pay-per-use Solana API for AI agents. No API keys, no subscriptions — agents pay per request in USDC using the x402 payment protocol. Solana's sub-cent transaction costs make micropayments viable for the first time.
Named after the coin placed on the tongue of the dead to pay Charon for passage across the River Styx. The original micropayment.
How it works
- Agent requests data from a paid endpoint
- Obol returns HTTP 402 with a payment requirement (amount, recipient, network)
- Agent sends USDC on Solana matching the requirement
- Agent retries with transaction proof in the
X-PAYMENTheader - Obol verifies on-chain and returns the data
No accounts. No tokens. No onboarding. Just pay and go.
Endpoints
Wallet Analytics
| Endpoint | Price | Description |
|---|---|---|
GET /api/v1/wallet/:addr/overview |
$0.01 | SOL balance, token count, total value |
GET /api/v1/wallet/:addr/portfolio |
$0.05 | Full holdings with prices, NFTs, breakdown |
GET /api/v1/wallet/:addr/activity |
$0.05 | Transaction history with categorization |
GET /api/v1/wallet/:addr/risk |
$0.10 | Multi-factor risk assessment |
GET /api/v1/wallet/:addr/pnl |
$0.15 | Token flow analysis, current values, P&L |
Token Data
| Endpoint | Price | Description |
|---|---|---|
GET /api/v1/token/:mint/price |
$0.005 | Real-time price via Jupiter |
GET /api/v1/token/:mint/metadata |
$0.01 | Name, symbol, supply, decimals |
DeFi
| Endpoint | Price | Description |
|---|---|---|
GET /api/v1/defi/swap/quote |
$0.005 | Jupiter swap quote with route planning |
POST /api/v1/defi/swap/execute |
$0.25 | Jupiter swap transaction builder |
GET /api/v1/defi/positions/:addr |
$0.10 | DeFi positions — LSTs, LPs, lending |
GET /api/v1/defi/lst/yields |
$0.02 | LST yield comparison across Solana |
Free
| Endpoint | Description |
|---|---|
GET / |
API info and pricing |
GET /health |
Service status |
POST /api/v1/rpc |
Proxied Helius RPC (allowlisted methods) |
Agent Example
See examples/agent-client.ts for a full reference implementation. The key flow:
import { ObolAgent } from './examples/agent-client';
const agent = new ObolAgent();
await agent.discover(); // fetch pricing
agent.loadWallet(process.env.AGENT_PRIVATE_KEY);
// Auto-discovers price, pays, and returns data
const price = await agent.fetch('/api/v1/token/USDC_MINT/price');
Run in discovery-only mode (no wallet needed):
npx tsx examples/agent-client.ts
MCP Server
Obol ships as an MCP server — any AI agent that supports the Model Context Protocol can discover and call Obol's tools natively.
Install from npm
npm install -g obol-mcp
Claude Desktop / Claude Code
Add to your MCP config:
{
"mcpServers": {
"obol": {
"command": "npx",
"args": ["-y", "obol-mcp"],
"env": {
"OBOL_URL": "https://obol-production.up.railway.app"
}
}
}
}
Or if developing locally:
{
"mcpServers": {
"obol": {
"command": "npx",
"args": ["tsx", "/path/to/obol/src/mcp.ts"],
"env": {
"OBOL_URL": "http://localhost:3000"
}
}
}
}
Available MCP Tools
| Tool | Description |
|---|---|
obol_wallet_overview |
SOL balance, token count, total value |
obol_wallet_portfolio |
Full holdings with prices and breakdown |
obol_wallet_activity |
Transaction history with categorization |
obol_wallet_risk |
Multi-factor risk assessment |
obol_wallet_pnl |
Token flow analysis and P&L |
obol_token_price |
Real-time price via Jupiter |
obol_token_metadata |
Name, symbol, supply, decimals |
obol_swap_quote |
Jupiter swap quote with routing |
obol_swap_execute |
Build swap transaction for signing |
obol_defi_positions |
LSTs, LPs, lending positions |
obol_lst_yields |
LST yield comparison |
obol_health |
API health check (free) |
obol_info |
Endpoint pricing and info (free) |
Run locally
npm run mcp
Stack
- Fastify 5 — high-performance HTTP
- @x402/svm — official x402 SDK for Solana
- Helius — RPC + DAS API
- Jupiter — token prices + swap execution
- Upstash Redis — cache + payment receipts
- TypeScript — full type safety
- Zod — runtime validation
Setup
git clone https://github.com/halfkey/obol.git
cd obol
npm install
cp .env.example .env
# Edit .env with your Helius key and merchant wallet address
npm run dev
Testing
# Unit + integration tests (46 tests)
npm test -- --run
# Smoke test against live deployment
npx tsx scripts/smoke-test.ts https://obol-production.up.railway.app
# Manual payment test
npx tsx scripts/test-payment.ts <tx-signature>
Environment
See .env.example. Key variables:
PAYMENT_MODE—mock(dev, auto-approve) oronchain(production)PAYMENT_RECIPIENT_ADDRESS— your Solana wallet that receives USDCHELIUS_API_KEY— Helius RPC accessUPSTASH_REDIS_REST_URL/TOKEN— cache layer
Roadmap
- [x] 11 paid endpoints (wallet, token, DeFi, LST, P&L)
- [x] On-chain USDC verification with replay prevention
- [x] Test suite (46 vitest + 20-point smoke test)
- [x] Agent client reference implementation
- [x] GitHub Actions CI
- [ ] WebSocket subscriptions for wallet monitoring
- [ ] Dynamic congestion-based pricing
- [ ] Multi-chain support
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 模型以安全和受控的方式获取实时的网络信息。