Hive Agent Quota

io.github.srotzin由 GitHub 账号 srotzin 发布v1.0.0更新于 Nov 2, 2026

Per-agent rate limits and quota enforcement for the Hive A2A economy

已验证Streamable HTTP可网页运行金融开发者工具

概览

AI 生成的概览

远程 MCP 端点,为 Hive A2A 网络按代理计量配额,每消耗一个配额单位以 Base 上的 USDC 结算。

可以做什么
  • 按代理 DID 查询并消耗配额单位,通过 x402 支付信封按单位付费
  • 读取某个 DID 的剩余配额余额
  • 估算指定单位数的报价与可接受的最低金额(USDC)
  • 通过 REST 端点提供同样的操作,包括 UTC 当日账本快照与健康检查
适用场景
适用于在 Hive A2A 网络上构建或运营代理、需要按代理做限流或配额核算并以 Base 上的 USDC 结算的场景。多数助手和通用用途并不需要它。
运行要求
远程 streamable-HTTP 端点,无需本地安装。消耗单位的调用需要一个有余额的 Base L2 钱包,能向公布的收款地址发送 USDC 并回传 X-Payment 证明头。服务器自身通过 RPC 地址读取 Base 主网。
安装前请注意
quota_check 会真实花钱:每个单位以 Base 主网 USDC 支付给运营方钱包地址,支付证明会在链上核验。公布的收款地址与价格属第三方声明,付款前请自行确认。该服务会在自己的数据库中保存按 DID 的使用记录。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Hive Agent Quota,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.srotzin%2Fhive-mcp-agent-quota/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "hive-agent-quota": {
      "type": "http",
      "url": "https://hive-mcp-agent-quota.onrender.com/mcp"
    }
  }
}

README

hive-mcp-agent-quota

[srotzin/hive-mcp-agent-quota MCP server]

Per-agent quota meter for the A2A network. Each call to quota_check consumes one or more units against an agent's DID and is settled at $0.001 USDC per unit on Base L2 via the x402 envelope. Inbound only. ENABLE=true by default.

Brand color: #C08D23 (Pantone 1245 C, Hive Civilization gold).

Surface

LayerEndpointDescription
MCPPOST /mcpJSON-RPC 2.0, Streamable-HTTP, protocol 2024-11-05.
DiscoveryGET /.well-known/mcp.jsonTool list and transport metadata.
RESTPOST /v1/quota/checkConsume units for a DID. 402 if no balance and no proof.
RESTGET /v1/quota/balance?did=…Read remaining quota for a DID.
RESTGET /v1/quota/todayUTC-day ledger snapshot.
RESTGET /v1/quota/estimate?units=NAsking and floor in USDC for N units.
HealthGET /healthLiveness, pricing, recipient address.
RootGET /HTML for browsers, JSON for agents (Accept-header sniff). JSON-LD SoftwareApplication.

Tools

NameTierCostDescription
quota_check1$0.001/unitConsume N units for a DID via x402.
quota_balance0freeRemaining quota for a DID.
quota_topup_estimate0freeAsking and floor for N units.

Pricing and the barter floor

Pricing inherits the hivemorph barter pattern. Every 402 envelope advertises both amount_usd (asking) and accept_min_usd (floor). A client may submit a proof whose on-chain paid amount is anywhere in [floor, asking] and the shim accepts it.

Defaults, all overridable by environment variable:

VariableDefaultNotes
QUOTA_CHECK_PRICE_USDC0.001Per-unit asking price.
HIVE_X402_FLOOR_PCT_DEFAULT0.70Floor as fraction of asking.
HIVE_X402_FLOOR_MIN_PCT0.30Hard lower clamp.
HIVE_X402_FLOOR_MAX_PCT0.95Hard upper clamp.

So a 1-unit check at the defaults advertises asking $0.0010 and accept-min $0.0007. A 100-unit check advertises asking $0.1000 and accept-min $0.0700. The floor never falls below MIN_PCT of asking and never exceeds MAX_PCT.

Settlement

FieldValue
ChainBase L2
AssetUSDC
Contract0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
RecipientWALLET_ADDRESS env, default 0x15184bf50b3d3f52b60434f8942b7d52f2eb436e
Verificationprovider.getTransactionReceipt(tx_hash) against BASE_RPC_URL, decode USDC Transfer logs to recipient, sum amount in 6-decimal units, compare to accept_min_usd.
Signature (optional)ethers.verifyMessage(message, signature) recovers payer; rejected if it disagrees with the on-chain from.

No mocks. The on-chain check is a real RPC read against Base mainnet.

Storage

SQLite at QUOTA_DB_PATH (default /tmp/quota.db), three tables:

  • quotas (did, units_purchased, units_consumed, first_seen, last_seen)
  • checks (id, did, unit_count, granted, remaining, tx_hash, paid_usdc, ts)
  • topups (id, did, units, paid_usdc, tx_hash UNIQUE, payer, ts)

tx_hash is UNIQUE on topups to make replay a 409.

x402 envelope

A quota_check call with no prepaid balance and no proof returns:

json
{  "error": "payment_required",  "x402_version": 1,  "payment": {    "nonce": "…",    "amount_usd": 0.001,    "accept_min_usd": 0.0007,    "accepts": [{      "chain": "base",      "asset": "USDC",      "contract": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",      "decimals": 6,      "recipient": "0x15184bf50b3d3f52b60434f8942b7d52f2eb436e",      "scheme": "exact"    }],    "expires_at": 1761600000,    "tier": 1,    "product": "agent_quota_check",    "unit_count": 1,    "price_per_unit_usd": 0.001,    "floor_pct": 0.70  }}

The client sends USDC to the recipient on Base, then resubmits the same request with an X-Payment header containing the proof:

X-Payment: {"nonce":"…","chain":"base","tx_hash":"0x…","payer":"0x…","signature":"0x…","message":"hive-quota:<nonce>"}

signature and message are optional. If supplied, the recovered address must match payer and the on-chain from.

Environment

VariableDefaultNotes
PORT3000
ENABLEtrueSet to false to disable tools/call.
WALLET_ADDRESS0x15184bf50b3d3f52b60434f8942b7d52f2eb436eUSDC recipient on Base.
QUOTA_CHECK_PRICE_USDC0.001Per-unit asking.
HIVE_X402_FLOOR_PCT_DEFAULT0.70
HIVE_X402_FLOOR_MIN_PCT0.30
HIVE_X402_FLOOR_MAX_PCT0.95
BASE_RPC_URLhttps://mainnet.base.org
DEFAULT_QUOTA_UNITS0Free units credited on first sight of a DID.
QUOTA_DB_PATH/tmp/quota.db

Running locally

npm installnode server.js

Then:

curl -s http://localhost:3000/healthcurl -s -X POST http://localhost:3000/mcp \  -H 'content-type: application/json' \  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'curl -s 'http://localhost:3000/v1/quota/today'

Hard rules

  • Inbound only. The shim never originates an outbound payment.
  • No private key in the repo. Verification is read-only.
  • No custody. The recipient address belongs to the operator, not the shim.
  • Returns are advisory until the on-chain receipt is confirmed by BASE_RPC_URL.

Council provenance

Tier A position 3. 2026-04-27. Inbound metering surface, symmetric to hive-mcp-barter (outbound counter-offer) and hive-mcp-auction (inbound reverse-Dutch).

License

MIT. See LICENSE.

Hive Gamification

This MCP server is part of the Hive Civilization gamification surface (10-mechanic capability taxonomy).

Surface tags: gamification.spec.v1 · gamification.surface.public · gamification.signal.read-only · gamification.settlement.real-rails

Real rails on Base L2 (USDC 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913). Read-only signal layer. Brand gold #C08D23.

Hive Civilization Directory

Part of the Hive Civilization — agent-native financial infrastructure.

Brand: #C08D23

来源:README.md,提交 8e8cd29

工具

0
SourceWeft 尚未读取此服务器的工具。

版本历史

1
  1. v1.0.0最新Sep 16, 2026

评分

已满足适用检查项的 85%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具必需15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分