Skip to main content
Glama

obol

付钱给摆渡人。通过 x402 实现的 Solana 智能体网关。

Obol 是一个面向 AI 智能体的按次付费 Solana API。无需 API 密钥,无需订阅——智能体使用 x402 支付协议 以 USDC 按请求付费。Solana 低于一美分的交易成本使微支付首次成为可能。

名字来源于放在死者舌头上、用来付给卡戎以渡过冥河的硬币。这就是最初的微支付。

工作原理

  1. 智能体向付费端点请求数据

  2. Obol 返回 HTTP 402,附带支付要求(金额、收款方、网络)

  3. 智能体在 Solana 上发送匹配要求的 USDC

  4. 智能体在 X-PAYMENT 头中携带交易证明重试

  5. Obol 在链上验证并返回数据

无需账户。无需代币。无需注册。付钱即走。

Related MCP server: AgentWallet MCP Server

端点

钱包分析

端点

价格

描述

GET /api/v1/wallet/:addr/overview

$0.01

SOL 余额、代币数量、总价值

GET /api/v1/wallet/:addr/portfolio

$0.05

完整持仓,含价格、NFT、明细拆分

GET /api/v1/wallet/:addr/activity

$0.05

交易历史,含分类

GET /api/v1/wallet/:addr/risk

$0.10

多因素风险评估

GET /api/v1/wallet/:addr/pnl

$0.15

代币流向分析、当前价值、盈亏

代币数据

端点

价格

描述

GET /api/v1/token/:mint/price

$0.005

通过 Jupiter 获取实时价格

GET /api/v1/token/:mint/metadata

$0.01

名称、符号、供应量、精度

DeFi

端点

价格

描述

GET /api/v1/defi/swap/quote

$0.005

Jupiter 兑换报价,含路由规划

POST /api/v1/defi/swap/execute

$0.25

Jupiter 兑换交易构建器

GET /api/v1/defi/positions/:addr

$0.10

DeFi 持仓——LST、LP、借贷

GET /api/v1/defi/lst/yields

$0.02

Solana 上 LST 收益率对比

免费

端点

描述

GET /

API 信息和定价

GET /health

服务状态

POST /api/v1/rpc

代理的 Helius RPC(白名单方法)

智能体示例

完整参考实现见 examples/agent-client.ts。关键流程:

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');

以仅发现模式运行(无需钱包):

npx tsx examples/agent-client.ts

MCP 服务器

Obol 以 MCP 服务器形式提供——任何支持 Model Context Protocol 的 AI 智能体都可以原生发现并调用 Obol 的工具。

从 npm 安装

npm install -g obol-mcp

Claude Desktop / Claude Code

添加到你的 MCP 配置中:

{
  "mcpServers": {
    "obol": {
      "command": "npx",
      "args": ["-y", "obol-mcp"],
      "env": {
        "OBOL_URL": "https://obol-production.up.railway.app"
      }
    }
  }
}

或者在本地开发时:

{
  "mcpServers": {
    "obol": {
      "command": "npx",
      "args": ["tsx", "/path/to/obol/src/mcp.ts"],
      "env": {
        "OBOL_URL": "http://localhost:3000"
      }
    }
  }
}

可用的 MCP 工具

工具

描述

obol_wallet_overview

SOL 余额、代币数量、总价值

obol_wallet_portfolio

完整持仓,含价格和明细拆分

obol_wallet_activity

交易历史,含分类

obol_wallet_risk

多因素风险评估

obol_wallet_pnl

代币流向分析和盈亏

obol_token_price

通过 Jupiter 获取实时价格

obol_token_metadata

名称、符号、供应量、精度

obol_swap_quote

Jupiter 兑换报价,含路由

obol_swap_execute

构建兑换交易以供签名

obol_defi_positions

LST、LP、借贷持仓

obol_lst_yields

LST 收益率对比

obol_health

API 健康检查(免费)

obol_info

端点定价和信息(免费)

本地运行

npm run mcp

技术栈

  • Fastify 5 — 高性能 HTTP

  • @x402/svm — 官方 Solana x402 SDK

  • Helius — RPC + DAS API

  • Jupiter — 代币价格 + 兑换执行

  • Upstash Redis — 缓存 + 支付回执

  • TypeScript — 完整类型安全

  • Zod — 运行时验证

设置

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

测试

# 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>

环境变量

参见 .env.example。关键变量:

  • PAYMENT_MODEmock(开发环境,自动批准)或 onchain(生产环境)

  • PAYMENT_RECIPIENT_ADDRESS — 接收 USDC 的 Solana 钱包地址

  • HELIUS_API_KEY — Helius RPC 访问

  • UPSTASH_REDIS_REST_URL / TOKEN — 缓存层

路线图

  • 11 个付费端点(钱包、代币、DeFi、LST、盈亏)

  • 链上 USDC 验证,带重放防护

  • 测试套件(46 个 vitest + 20 点冒烟测试)

  • 智能体客户端参考实现

  • GitHub Actions CI

  • 钱包监控的 WebSocket 订阅

  • 基于拥塞的动态定价

  • 多链支持

许可证

MIT

Install Server
A
license - permissive license
A
quality
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    A
    quality
    D
    maintenance
    Provides permissionless wallet infrastructure for AI agents to manage wallets, sign transactions, and handle tokens across Solana and all EVM-compatible chains. It includes 29 specialized tools for on-chain operations, featuring built-in security guards and automated x402 payment processing without KYC requirements.
    29
    334
    3
    MIT
  • A
    license
    B
    quality
    C
    maintenance
    Provides 13 Solana DeFi intelligence tools for AI agents, paid per-call via micropayments (USDC). Enables pulling live DeFi data and automatic payment settlement.
    13
    63
    1
    MIT

View all related MCP servers

Related MCP Connectors

  • Pay-per-use weather, environment, finance, and on-chain intelligence tools for AI agents via x402.

  • Token swaps and honeypot/rug checks for AI agents on 8 chains, paid per-call in USDC via x402.

  • 63 pay-per-call tools for agents: vision, text, data, web, blockchain. USDC on Base via x402.

View all MCP Connectors

Latest Blog Posts

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/halfkey/obol'

If you have feedback or need assistance with the MCP directory API, please join our Discord server