{
  "markdown": "# hive-mcp-flag\n\n[![srotzin/hive-mcp-flag MCP server](https://glama.ai/mcp/servers/srotzin/hive-mcp-flag/badges/score.svg)](https://glama.ai/mcp/servers/srotzin/hive-mcp-flag)\n\n**Feature flag service for the A2A network — Hive Civilization.** DID-keyed targeting, percentage rollouts, x402 USDC settlement on Base L2. MCP `2024-11-05`. Inbound only.\n\nDisable a runaway behavior, gate a new tool behind a DID-prefix canary, or ramp a config change to 25% of agents — without redeploying the agent. LaunchDarkly-shaped semantics, agent-native primitives.\n\n```\nbrand : Hive Civilization gold #C08D23 (Pantone 1245 C)\nspec  : MCP 2024-11-05 / Streamable-HTTP / JSON-RPC 2.0\nwallet: W1 MONROE 0x15184bf50b3d3f52b60434f8942b7d52f2eb436e (Base)\n```\n\n## Quick start\n\n```bash\ngit clone https://github.com/srotzin/hive-mcp-flag\ncd hive-mcp-flag\nnpm install\nnpm start\n# hive-mcp-flag on :3000\n```\n\nHosted endpoint: `https://hive-mcp-flag.onrender.com/mcp`\n\n## Tools and pricing\n\n| Tool | USD / call | Notes |\n|---|---|---|\n| `flag_eval`     | $0.0005 | Evaluate a flag for a DID; returns resolved value and matched rule. |\n| `flag_list`     | free    | List flags owned by a DID. |\n| `flag_describe` | free    | Full flag definition and recent evaluations. |\n| `flag_create`   | $0.001  | Create a flag with default value and targeting rules. |\n| `flag_update`   | $0.0005 | Update default value or targeting rules. Owner-only. |\n| `flag_delete`   | $0.001  | Tombstone a flag. Owner-only. |\n\nAll payments are inbound. Submit a Base USDC `tx_hash` (caller → W1) in the request body or `x402-tx-hash` header. The shim reads the receipt from Base RPC, decodes the USDC `Transfer` log, and verifies recipient and amount before serving the call.\n\n## Targeting rules\n\nRules evaluate in declared order. First match wins. If none match, the flag's `default_value` is returned.\n\n```json\n[\n  { \"type\": \"did_match\",  \"dids\": [\"did:hive:0xabc\"], \"value\": true },\n  { \"type\": \"did_prefix\", \"prefix\": \"did:hive:\",      \"value\": true },\n  { \"type\": \"rollout\",    \"percent\": 25,              \"value\": true }\n]\n```\n\n`rollout` uses `SHA256(did + flag_key) mod 100`, so the same `(did, flag_key)` pair always falls in the same bucket — sticky variant assignment with no extra storage.\n\n## REST API\n\n```\nPOST   /v1/flag/eval                # body: { flag_key, evaluating_did, tx_hash }\nGET    /v1/flag/list?owner_did=...\nGET    /v1/flag/{name}              # describe\nPOST   /v1/flag                     # create\nPATCH  /v1/flag/{name}              # update — owner-only\nDELETE /v1/flag/{name}              # tombstone — owner-only\nGET    /v1/flag/today               # revenue snapshot\nGET    /health                      # service health\nGET    /.well-known/mcp.json        # MCP discovery\nPOST   /mcp                         # JSON-RPC 2.0\n```\n\n## MCP example\n\n```json\n{\n  \"jsonrpc\": \"2.0\", \"id\": 1, \"method\": \"tools/call\",\n  \"params\": {\n    \"name\": \"flag_eval\",\n    \"arguments\": {\n      \"flag_key\": \"new_routing_v2\",\n      \"evaluating_did\": \"did:hive:0xabc\",\n      \"tx_hash\": \"0xBASE_TX_PAYING_$0.0005_USDC_TO_W1\"\n    }\n  }\n}\n```\n\n## Real rails\n\n| Surface | Library | Behavior |\n|---|---|---|\n| Persistence | `better-sqlite3` | SQLite at `/tmp/flag.db`, WAL mode, transactional create/update. |\n| Signature verification | `ethers.verifyMessage` | Recovers the signer of a message and compares against a claimed address. |\n| Payment verification | `ethers.JsonRpcProvider` | Reads tx receipt from Base RPC, decodes USDC `Transfer` logs, asserts `to == W1` and `amount >= asking_usd`. |\n\nSet `VERIFY_ONCHAIN=false` only for local development or testing — the default and the production deployment verify on-chain.\n\n## Environment\n\n| Var | Default | Purpose |\n|---|---|---|\n| `PORT`              | `3000` | HTTP port |\n| `ENABLE`            | `true` | Master switch (`false` to brown-out) |\n| `WALLET_ADDRESS`    | W1     | Base L2 receiver |\n| `BASE_RPC_URL`      | `https://mainnet.base.org` | RPC for receipt reads |\n| `VERIFY_ONCHAIN`    | `true` | Read receipts on Base before serving paid calls |\n| `MAX_FLAGS_PER_DID` | `500`  | Per-owner cap |\n| `DB_PATH`           | `/tmp/flag.db` | SQLite file |\n\n## Caps\n\n- `MAX_FLAGS_PER_DID = 500`\n- Max targeting rules per flag: 50\n- Request body limit: 256 KB\n\n## Out of scope (v1.1+)\n\nFlag prerequisites (B depends on A), auto-ramping rollouts, push notifications and change webhooks, multi-environment namespaces, dashboard UI.\n\nPermanently rejected: instruments, predictions, or derivatives based on flag states.\n\n---\n\nHive Civilization · MIT · [github.com/srotzin/hive-mcp-flag](https://github.com/srotzin/hive-mcp-flag)\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": 5036,
  "sha": "4324369a182ecbcea63f98f192819d18370e1387962747916b41883e496debab",
  "repo_slug": "srotzin/hive-mcp-flag",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_srotzin_hive_mcp_flag_15d87aaa/readme"
}