{
  "markdown": "# obol\n\nPay the ferryman. Solana agent gateway via x402.\n\nObol 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](https://x402.org). Solana's sub-cent transaction costs make micropayments viable for the first time.\n\nNamed after the coin placed on the tongue of the dead to pay Charon for passage across the River Styx. The original micropayment.\n\n## How it works\n\n1. Agent requests data from a paid endpoint\n2. Obol returns HTTP 402 with a payment requirement (amount, recipient, network)\n3. Agent sends USDC on Solana matching the requirement\n4. Agent retries with transaction proof in the `X-PAYMENT` header\n5. Obol verifies on-chain and returns the data\n\nNo accounts. No tokens. No onboarding. Just pay and go.\n\n## Endpoints\n\n### Wallet Analytics\n| Endpoint | Price | Description |\n|----------|-------|-------------|\n| `GET /api/v1/wallet/:addr/overview` | $0.01 | SOL balance, token count, total value |\n| `GET /api/v1/wallet/:addr/portfolio` | $0.05 | Full holdings with prices, NFTs, breakdown |\n| `GET /api/v1/wallet/:addr/activity` | $0.05 | Transaction history with categorization |\n| `GET /api/v1/wallet/:addr/risk` | $0.10 | Multi-factor risk assessment |\n| `GET /api/v1/wallet/:addr/pnl` | $0.15 | Token flow analysis, current values, P&L |\n\n### Token Data\n| Endpoint | Price | Description |\n|----------|-------|-------------|\n| `GET /api/v1/token/:mint/price` | $0.005 | Real-time price via Jupiter |\n| `GET /api/v1/token/:mint/metadata` | $0.01 | Name, symbol, supply, decimals |\n\n### DeFi\n| Endpoint | Price | Description |\n|----------|-------|-------------|\n| `GET /api/v1/defi/swap/quote` | $0.005 | Jupiter swap quote with route planning |\n| `POST /api/v1/defi/swap/execute` | $0.25 | Jupiter swap transaction builder |\n| `GET /api/v1/defi/positions/:addr` | $0.10 | DeFi positions — LSTs, LPs, lending |\n| `GET /api/v1/defi/lst/yields` | $0.02 | LST yield comparison across Solana |\n\n### Free\n| Endpoint | Description |\n|----------|-------------|\n| `GET /` | API info and pricing |\n| `GET /health` | Service status |\n| `POST /api/v1/rpc` | Proxied Helius RPC (allowlisted methods) |\n\n## Agent Example\n\nSee `examples/agent-client.ts` for a full reference implementation. The key flow:\n\n```typescript\nimport { ObolAgent } from './examples/agent-client';\n\nconst agent = new ObolAgent();\nawait agent.discover();  // fetch pricing\nagent.loadWallet(process.env.AGENT_PRIVATE_KEY);\n\n// Auto-discovers price, pays, and returns data\nconst price = await agent.fetch('/api/v1/token/USDC_MINT/price');\n```\n\nRun in discovery-only mode (no wallet needed):\n```bash\nnpx tsx examples/agent-client.ts\n```\n\n## MCP Server\n\nObol ships as an MCP server — any AI agent that supports the [Model Context Protocol](https://modelcontextprotocol.io) can discover and call Obol's tools natively.\n\n### Install from npm\n\n```bash\nnpm install -g obol-mcp\n```\n\n### Claude Desktop / Claude Code\n\nAdd to your MCP config:\n\n```json\n{\n  \"mcpServers\": {\n    \"obol\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"obol-mcp\"],\n      \"env\": {\n        \"OBOL_URL\": \"https://obol-production.up.railway.app\"\n      }\n    }\n  }\n}\n```\n\nOr if developing locally:\n\n```json\n{\n  \"mcpServers\": {\n    \"obol\": {\n      \"command\": \"npx\",\n      \"args\": [\"tsx\", \"/path/to/obol/src/mcp.ts\"],\n      \"env\": {\n        \"OBOL_URL\": \"http://localhost:3000\"\n      }\n    }\n  }\n}\n```\n\n### Available MCP Tools\n\n| Tool | Description |\n|------|-------------|\n| `obol_wallet_overview` | SOL balance, token count, total value |\n| `obol_wallet_portfolio` | Full holdings with prices and breakdown |\n| `obol_wallet_activity` | Transaction history with categorization |\n| `obol_wallet_risk` | Multi-factor risk assessment |\n| `obol_wallet_pnl` | Token flow analysis and P&L |\n| `obol_token_price` | Real-time price via Jupiter |\n| `obol_token_metadata` | Name, symbol, supply, decimals |\n| `obol_swap_quote` | Jupiter swap quote with routing |\n| `obol_swap_execute` | Build swap transaction for signing |\n| `obol_defi_positions` | LSTs, LPs, lending positions |\n| `obol_lst_yields` | LST yield comparison |\n| `obol_health` | API health check (free) |\n| `obol_info` | Endpoint pricing and info (free) |\n\n### Run locally\n\n```bash\nnpm run mcp\n```\n\n## Stack\n\n- **Fastify 5** — high-performance HTTP\n- **@x402/svm** — official x402 SDK for Solana\n- **Helius** — RPC + DAS API\n- **Jupiter** — token prices + swap execution\n- **Upstash Redis** — cache + payment receipts\n- **TypeScript** — full type safety\n- **Zod** — runtime validation\n\n## Setup\n\n```bash\ngit clone https://github.com/halfkey/obol.git\ncd obol\nnpm install\ncp .env.example .env\n# Edit .env with your Helius key and merchant wallet address\nnpm run dev\n```\n\n## Testing\n\n```bash\n# Unit + integration tests (46 tests)\nnpm test -- --run\n\n# Smoke test against live deployment\nnpx tsx scripts/smoke-test.ts https://obol-production.up.railway.app\n\n# Manual payment test\nnpx tsx scripts/test-payment.ts <tx-signature>\n```\n\n## Environment\n\nSee `.env.example`. Key variables:\n\n- `PAYMENT_MODE` — `mock` (dev, auto-approve) or `onchain` (production)\n- `PAYMENT_RECIPIENT_ADDRESS` — your Solana wallet that receives USDC\n- `HELIUS_API_KEY` — Helius RPC access\n- `UPSTASH_REDIS_REST_URL` / `TOKEN` — cache layer\n\n## Roadmap\n\n- [x] 11 paid endpoints (wallet, token, DeFi, LST, P&L)\n- [x] On-chain USDC verification with replay prevention\n- [x] Test suite (46 vitest + 20-point smoke test)\n- [x] Agent client reference implementation\n- [x] GitHub Actions CI\n- [ ] WebSocket subscriptions for wallet monitoring\n- [ ] Dynamic congestion-based pricing\n- [ ] Multi-chain support\n\n## License\n\nMIT\n",
  "bytes": 5665,
  "sha": "28edaf3a3c002043cf53d73c95c5f8656a93af51de5acddd50a5f95cf26e7c87",
  "repo_slug": "halfkey/obol",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_halfkey_obol_58cf0c25/readme"
}