{
  "markdown": "# hive-mcp-barter\n\n[![srotzin/hive-mcp-barter MCP server](https://glama.ai/mcp/servers/srotzin/hive-mcp-barter/badges/score.svg)](https://glama.ai/mcp/servers/srotzin/hive-mcp-barter)\n\n**Outbound 402 arbitrage agent — Hive Civilization**\n\nProbes 402-enabled MCP endpoints, counter-offers below asking, and settles when the spread clears our resale floor. Pure protocol — no DMs, no spam. Attribution headers on every request.\n\n> Council provenance: Ad-hoc, user-promoted 2026-04-27 (Tier A position 1).\n\n---\n\n## What this is\n\n`hive-mcp-barter` is a Model Context Protocol server that runs an outbound arbitrage loop on top of the 402 payment surface. It scans public MCP registries for 402-enabled endpoints, probes them with standard quote requests, and — when target_asking × counter_pct still lands below our resale floor — issues a single-shot, pre-signed counter-offer. The target accepts by broadcasting our pre-signed transaction; there is no haggle, no second round, and no human-readable outreach.\n\n- **Protocol:** MCP 2024-11-05 over Streamable-HTTP / JSON-RPC 2.0\n- **Transport:** `POST /mcp`\n- **Discovery:** `GET /.well-known/mcp.json`\n- **Health:** `GET /health`\n- **Settlement:** USDC on Base L2 — real rails, no mock, no simulated\n- **Brand gold:** Pantone 1245 C / `#C08D23`\n\n## Tools\n\n| Tool | Tier | Description |\n|---|---|---|\n| `barter_discover` | 0 (free) | List 402-enabled MCP endpoints from a public registry (glama, smithery, mcp.so) with last-seen asking prices. |\n| `barter_quote_curve` | 0 (free) | Build a demand curve for a target by sending up to 5 probes at descending floor pcts. Returns the reservation-price estimate. |\n| `barter_arbitrage_book` | 0 (free) | Today's P&L: probes sent, counters accepted, USDC realized spread. |\n\n## REST endpoints\n\n| Method | Path | Purpose |\n|---|---|---|\n| `POST` | `/v1/barter/discover` | Scan registries for 402 endpoints. |\n| `POST` | `/v1/barter/probe` | Send a 402-style quote request to a target. |\n| `POST` | `/v1/barter/counter` | Build a signed counter-offer at the configured floor pct. |\n| `POST` | `/v1/barter/settle` | Resolve an accepted counter on-chain and book the spread. |\n| `GET` | `/v1/barter/ledger` | Running P&L, attempts, wins, spread. |\n| `GET` | `/v1/barter/today` | Today aggregate (Tier 0, free). |\n| `GET` | `/health` | Service health. |\n\n## Counter-offer envelope\n\n```json\n{\n  \"x402_version\": 1,\n  \"intent\": \"counter_offer\",\n  \"originator_did\": \"did:hive:morph\",\n  \"asking_seen_usd\": \"0.05\",\n  \"offer_usd\": \"0.0325\",\n  \"offer_atomic_usdc_base\": \"32500\",\n  \"tx_pre_signed\": \"0x...\",\n  \"expires\": \"2026-04-27T20:30:00Z\",\n  \"attribution\": {\n    \"agent\": \"hive-mcp-barter\",\n    \"attribution_id\": \"barter-{uuid}\",\n    \"policy\": \"single-shot-no-haggle\"\n  }\n}\n```\n\nThe pre-signed transaction is the entire commitment. The target accepts by broadcasting; we never have to re-sign on accept.\n\n## Resale floor\n\n| Category | Our buy floor | Our resell |\n|---|---|---|\n| LLM tokens | $0.000020 / token | $0.000040 / token |\n| Oracle reads | $0.0008 / read | $0.0015 / read |\n| Storage writes | $0.00012 / write | $0.00025 / write |\n| KYC checks | $0.04 / check | $0.08 / check |\n\nIf `target_asking × counter_pct ≤ our_resell × 0.95`, we counter. Otherwise we skip — there is no margin.\n\n## Risk controls\n\n| Cap | Value |\n|---|---|\n| Max single counter | $0.50 USDC |\n| Max daily outbound spend | $25 USDC |\n| Max probes per target / 24h | 1 |\n| Max distinct targets / hr | 30 |\n| Per-target blacklist | 3+ no-response |\n\nAll caps fail-closed. Configurable via env vars; missing or invalid env always falls back to the stricter default.\n\n## Configuration\n\n| Env | Required | Default | Notes |\n|---|---|---|---|\n| `PORT` | no | `3000` | |\n| `ENABLE_OUTBOUND` | no | `false` | Default-off. The 5-min cron loop only runs when set to `true`. |\n| `WALLET_ADDRESS` | no | `0x15184…436e` | W1 MONROE on Base. |\n| `USDC_BASE` | no | `0x833589…2913` | USDC contract on Base. |\n| `BASE_RPC` | no | `https://mainnet.base.org` | |\n| `HIVECOMPUTE_URL` | no | `https://hivecompute-g2g7.onrender.com/v1/compute/chat/completions` | Used twice daily for resale revaluation. |\n| `MAX_DAILY_SPEND_USD` | no | `25` | |\n| `MAX_SINGLE_COUNTER_USD` | no | `0.50` | |\n| `COUNTER_PCT` | no | `0.65` | |\n| `PRIVATE_KEY` | **yes (to sign)** | — | Hex private key for the wallet that funds counter-offers. **Never commit this.** Without it, `/v1/barter/counter` returns an unsigned envelope and the cron loop will not place real bids. |\n\n> Signing is opt-in. The repo does not include a key. To enable real counter-offers, set `PRIVATE_KEY` in the Render dashboard (or your deployment env). To enable the 5-min cron loop, set `ENABLE_OUTBOUND=true`.\n\n## Run locally\n\n```bash\ngit clone https://github.com/srotzin/hive-mcp-barter.git\ncd hive-mcp-barter\nnpm install\nnpm start\n# server up on http://localhost:3000/mcp\ncurl http://localhost:3000/health\ncurl http://localhost:3000/.well-known/mcp.json\ncurl http://localhost:3000/v1/barter/today\n```\n\n## Connect from an MCP client\n\n**Claude Desktop / Cursor / Manus** — add to your `mcp.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"hive_mcp_barter\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-remote@latest\", \"https://hive-mcp-barter.onrender.com/mcp\"]\n    }\n  }\n}\n```\n\n## Hive Civilization\n\nPart of the [Hive Civilization](https://www.thehiveryiq.com) — sovereign DID, USDC settlement, agent-to-agent rails. Companion shims include `hive-mcp-evaluator`, `hive-mcp-compute-grid`, `hive-mcp-depin`, `hive-mcp-agent-storage`, `hive-mcp-agent-kyc`, and `hive-mcp-trade`.\n\n## License\n\nMIT (c) 2026 Steve Rotzin / Hive Civilization\n\n## Hive Civilization Directory\n\nPart of the Hive Civilization — agent-native financial infrastructure.\n\n- Endpoint Directory: https://thehiveryiq.com\n- Live Leaderboard: https://hive-a2amev.onrender.com/leaderboard\n- Revenue Dashboard: https://hivemine-dashboard.onrender.com\n- Other MCP Servers: https://github.com/srotzin?tab=repositories&q=hive-mcp\n\nBrand: #C08D23\n<!-- /hive-footer -->\n",
  "bytes": 6027,
  "sha": "06cd591623431bfad972021309b13d42dfd04731761d80b1a5415af4c2dbe3df",
  "repo_slug": "srotzin/hive-mcp-barter",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_srotzin_hive_mcp_barter_f59f25b8/readme"
}