{
  "markdown": "# hive-mcp-abtest\n\n[![srotzin/hive-mcp-abtest MCP server](https://glama.ai/mcp/servers/srotzin/hive-mcp-abtest/badges/score.svg)](https://glama.ai/mcp/servers/srotzin/hive-mcp-abtest)\n\nA/B experiment runner for the A2A network. An inbound-only MCP shim that gives autonomous agents a deterministic, sticky bucket assignment, a conversion-recording endpoint, and a two-proportion Z-test stat-sig calculator. Pricing is per call via x402 on Base USDC.\n\n- `$0.001` per `abtest_assign`\n- `$0.005` per `abtest_record_conversion`\n- `abtest_results` is free and read-only\n\nThe shim does not run experiments on behalf of the caller. It records assignments and conversions for experiments the caller registers, and returns aggregate counts and a Z-test on demand.\n\n## How bucket assignment works\n\nBucket is `SHA-256(experiment_id + \"|\" + agent_did)`, with the first four bytes read as an unsigned 32-bit integer, modulo the sum of variant weights. The first call writes the result. Subsequent calls return the same row, so assignment is sticky for the lifetime of the SQLite store.\n\nA variant list is `[{ id, weight? }, ...]`. Weight defaults to `1` per variant. Pass `[{id:\"control\"},{id:\"treatment\",weight:3}]` for a 25/75 split.\n\n## Stat-sig calculator\n\nTwo-proportion Z-test with pooled variance over the first two registered variants. Output includes `z_score`, two-sided `p_value`, `relative_lift`, and `significant_95` / `significant_99` boolean flags.\n\n## MCP\n\n- Transport: Streamable HTTP, JSON-RPC 2.0\n- Protocol: `2024-11-05`\n- Endpoint: `POST /mcp`\n\nTools:\n\n| Tool | Tier | Price |\n|---|---|---|\n| `abtest_assign` | 3 | $0.001 |\n| `abtest_record_conversion` | 3 | $0.005 |\n| `abtest_results` | 0 | free |\n\n## REST\n\n| Method | Path | Purpose |\n|---|---|---|\n| GET | `/v1/abtest` | List experiments |\n| POST | `/v1/abtest` | Create or upsert experiment `{ id, name?, variants }` |\n| GET | `/v1/abtest/:id` | Get experiment |\n| PUT | `/v1/abtest/:id` | Update experiment |\n| DELETE | `/v1/abtest/:id` | Delete experiment |\n| POST | `/v1/abtest/assign` | `{ experiment_id, agent_did, variants? }` — $0.001 |\n| POST | `/v1/abtest/convert` | `{ experiment_id, agent_did, metric?, value? }` — $0.005 |\n| GET | `/v1/abtest/results` | `?experiment_id=...&metric=...` — Z-test included |\n| GET | `/v1/abtest/today` | UTC-day assignment + conversion counts |\n| GET | `/health` | Liveness, version, and DB check |\n\n## Storage\n\nSQLite at `/tmp/abtest.db` with three tables: `experiments`, `assignments`, `conversions`. Override with `DB_PATH`.\n\n## Environment\n\n| Variable | Default |\n|---|---|\n| `PORT` | `3000` |\n| `ENABLE` | `true` |\n| `WALLET_ADDRESS` | `0x15184bf50b3d3f52b60434f8942b7d52f2eb436e` |\n| `PRICE_ASSIGN_USDC` | `0.001` |\n| `PRICE_CONVERT_USDC` | `0.005` |\n| `DB_PATH` | `/tmp/abtest.db` |\n| `X402_ENABLED` | `true` |\n\nSet `X402_ENABLED=false` to bypass payment gating in local development.\n\n## Quickstart\n\n```bash\nnpm install\nnpm start\n# in another shell\ncurl -s http://localhost:3000/health\ncurl -s -X POST http://localhost:3000/v1/abtest \\\n  -H 'content-type: application/json' \\\n  -d '{\"id\":\"prompt_v2\",\"name\":\"prompt v2\",\"variants\":[{\"id\":\"control\"},{\"id\":\"treatment\",\"weight\":3}]}'\ncurl -s -X POST http://localhost:3000/v1/abtest/assign \\\n  -H 'content-type: application/json' -H 'x-payment: {}' \\\n  -d '{\"experiment_id\":\"prompt_v2\",\"agent_did\":\"did:hive:demo:1\"}'\n```\n\nThe first call without a paid x402 envelope returns a `402` body with a fresh `nonce`. Submit a tx hash and payer to `/v1/x402/submit` to mint a short-lived access token, then retry.\n\n## License\n\nMIT. See `LICENSE`.\n\n## Author\n\nSteve Rotzin · steve@thehiveryiq.com · https://www.thehiveryiq.com\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": 4068,
  "sha": "046ca2e98c6561c7d66f55698f386ebdef900fab988d7351a16f2730ae89ba06",
  "repo_slug": "srotzin/hive-mcp-abtest",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_srotzin_hive_mcp_abtest_d61071bf/readme"
}