hive-mcp-cdn
A caching MCP server for A2A capabilities that stores and retrieves arbitrary objects with ETag support, two-tier LRU/SQLite storage, and x402 pay-per-use billing in USDC.
README
hive-mcp-cdn
Edge cache for A2A capabilities — Hive Civilization
A small, inbound-only MCP server that caches arbitrary objects (agent cards, capability manifests, signed envelopes, anything an A2A pipeline reads more than once). Two-tier storage with an in-memory LRU and a SQLite warm tier, ETag and If-None-Match support, a purge endpoint, and per-request and per-GB metering through x402.
Council provenance: Ad-hoc, user-promoted 2026-04-27.
What this is
Most A2A traffic is reads — the same agent card, the same capability list, the same signed proof — fanned out across a fleet that has no shared cache. hive-mcp-cdn is the missing edge cache. Agents put objects under a key and fetch them back through a cheap, ETag-aware GET.
- Protocol: MCP 2024-11-05 over Streamable-HTTP / JSON-RPC 2.0
- Transport:
POST /mcp - Discovery:
GET /.well-known/mcp.json - Health:
GET /health - Settlement: USDC on Base L2
- Brand gold: Pantone 1245 C /
#C08D23 - Mode: Inbound only.
ENABLE=truedefault.
Pricing
| Surface | Price | Charged on |
|---|---|---|
| Per request | $0.0002 USDC | Every /v1/cdn/get, hit or miss. |
| Per GB egress | $0.05 USDC | Body bytes returned in 200 responses. 304 responses do not bill egress. |
| Prepay bundle | $1.00 USDC | Buys an access token; reads draw from the prepaid balance until depletion. |
Settlement on Base L2 USDC. The recipient is the WALLET_ADDRESS env var.
Tools
| Tool | Tier | Description |
|---|---|---|
cdn_cache_get |
2 ($0.0002/req + $0.05/GB) | Read a cached object by key. Honors if_none_match. |
cdn_cache_put |
0 (free) | Store under a key with optional Cache-Control: max-age=.... |
cdn_purge |
0 (free) | Purge a single key. Idempotent. |
REST endpoints
| Method | Path | Purpose |
|---|---|---|
GET |
/v1/cdn/get?key=... |
Read. Sends ETag, Cache-Control, X-Cache, Age. Honors If-None-Match. |
POST |
/v1/cdn/put |
Write { key, body, content_type?, cache_control? }. |
POST |
/v1/cdn/purge |
Purge { key }. |
GET |
/v1/cdn/today |
Daily counters: requests, hits, misses, bytes served, revenue. |
POST |
/v1/x402/proof/submit |
Submit on-chain proof, mint access token. |
GET |
/v1/x402/pricing |
Pricing schedule. |
GET |
/v1/x402/stats |
Open nonces and active tokens. |
GET |
/health |
Service health and cache stats. |
GET |
/.well-known/mcp.json |
MCP discovery descriptor. |
GET |
/ |
Landing page. |
Storage model
Two tiers, both managed by the shim:
- Hot (LRU): an in-process
Mapwith insertion-order recency. Bounded byCDN_LRU_MAX_ENTRIESandCDN_LRU_MAX_BYTES. Misses fall through to warm and promote on read. - Warm (SQLite):
better-sqlite3atCDN_DB_PATH(default/tmp/cdn.db). Onecachetable with body, ETag, content type, size in bytes, created and expiry timestamps. A secondegresstable aggregates daily counters.
size_bytes is tracked per row and is the basis for the egress meter. ETags are computed once at write time as the SHA-256 hex of the body, truncated to 32 chars and double-quoted.
x402 flow
The first call to /v1/cdn/get without a token returns:
{
"error": "payment_required",
"payment": {
"nonce": "<uuid>",
"amount_usd": 1.0,
"pricing": {
"per_request_usd": 0.0002,
"per_gb_egress_usd": 0.05
},
"accepts": [{ "chain": "base", "asset": "USDC", "recipient": "0x15184b..." }],
"expires_at": 1777220000,
"tier": 2,
"product": "cdn_prepaid_bundle"
}
}
Submit proof to /v1/x402/proof/submit:
{ "nonce": "...", "payer": "0x...", "chain": "base", "tx_hash": "0x..." }
…then call /v1/cdn/get with X-Hive-Access: hive_<token>. Each request decrements the prepaid balance by per_request + (bytes / 1GB) * per_gb_egress. The residual balance rides the X-Hive-Balance-USD response header.
Cache semantics
Cache-Control: max-age=<s>onPUTsets the TTL. Default300seconds. Capped at 7 days.- ETag is a strong validator (SHA-256 prefix in quotes).
If-None-Match: <etag>onGETreturns304 Not Modifiedwith no body and no egress charge.- Expired entries are dropped lazily on read and on a 60-second sweep.
- A
PUTover an existing key replaces the body, ETag, content type, TTL, and resets the hit counter.
Environment
| Var | Default | Purpose |
|---|---|---|
PORT |
3000 |
HTTP port. |
ENABLE |
true |
Master switch. false runs /health only. |
WALLET_ADDRESS |
0x15184bf50b3d3f52b60434f8942b7d52f2eb436e |
Recipient for x402 fees. |
CDN_PRICE_PER_REQUEST_USD |
0.0002 |
Per-request fee. |
CDN_PRICE_PER_GB_EGRESS_USD |
0.05 |
Per-GB egress fee. |
CDN_PREPAY_BUNDLE_USD |
1.0 |
Default prepay bundle size. |
CDN_DEFAULT_TTL_S |
300 |
Default TTL for objects without explicit max-age. |
CDN_LRU_MAX_ENTRIES |
1024 |
Hot-tier entry cap. |
CDN_LRU_MAX_BYTES |
67108864 |
Hot-tier byte cap (64 MiB). |
CDN_MAX_OBJECT_BYTES |
4194304 |
Per-object size limit (4 MiB). |
CDN_DB_PATH |
/tmp/cdn.db |
SQLite warm-tier path. |
What this server will not do
- Make outbound requests of any kind. The cache only holds what was put into it.
- Resolve URLs, fetch origins, or revalidate against a backing store.
- Enforce per-key access control. Treat keys as opaque namespaces and gate them upstream if you need privacy.
- Persist beyond the SQLite file. On a fresh container with a new
/tmp, the cache is empty.
License
MIT.
<!-- HIVE-GAMIFICATION-META-START -->
Hive Gamification
This MCP server is part of the Hive Civilization gamification surface (10-mechanic capability taxonomy).
- Capability taxonomy: https://hive-gamification.onrender.com/.well-known/hive-gamification.json
- Centrifuge dashboard: https://hive-gamification.onrender.com/.well-known/hive-centrifuge.json
- Consolidated OpenAPI: https://hive-gamification.onrender.com/.well-known/openapi.json
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-GAMIFICATION-META-END -->
Hive Civilization Directory
Part of the Hive Civilization — agent-native financial infrastructure.
- Endpoint Directory: https://thehiveryiq.com
- Live Leaderboard: https://hive-a2amev.onrender.com/leaderboard
- Revenue Dashboard: https://hivemine-dashboard.onrender.com
- Other MCP Servers: https://github.com/srotzin?tab=repositories&q=hive-mcp
Brand: #C08D23 <!-- /hive-footer -->
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。