Build with Claude Code
Security: BetPlug's official Claude Code plugin (
version: "0.1.0") lives in./claude-plugin("private": true) and intentionally ships zerohooks/so it never runs background shell commands without explicit developer approval. Do not install lookalike plugins or third-party marketplaces; load the plugin directly from your verified repository checkout.
The official BetPlug Claude Code plugin bundles verified integration skills (betrail-integrate, betrail-embed, betrail-verify), slash commands, and the pinned remote Streamable HTTP MCP endpoint so your coding agent can wire a complete sandbox integration in TypeScript (./sdk/ts), Go (./sdk/go), Python (./sdk/python), or PHP (./sdk/php) — matching the reference casinos in ./examples/, ./examples/, and ./examples/ (Official SDKs).
Pinned manifest identity#
Verify these exact values before loading the plugin:
| Field | Pinned value | Defined in |
|---|---|---|
| Marketplace name | betrail | claude-plugin/ |
| Plugin install identifier | betrail@betrail | claude-plugin/ |
| Plugin directory / source | ./claude-plugin (source: "./") | claude-plugin/ |
| Pinned version | 0.1.0 | claude-plugin/ & marketplace.json |
Remote MCP server (betrail) | https://mcp. (${BETRAIL_MCP_URL:) | claude-plugin/ |
| Homepage | https://betrail. | claude-plugin/ |
Loading the official plugin locally#
Launch Claude Code directly from your verified repository checkout:
claude --plugin-dir ./claude-pluginOr register the local checkout as a development marketplace inside an interactive Claude Code session:
/plugin marketplace add ./claude-plugin
/plugin install betrail@betrailConnecting to a local BetPlug stack#
When developing against your local BetPlug stack — PostgreSQL/Valkey/Mailpit, betrail-api, betrail-worker, Operator Console (http://127.0.0.1:, with BETRAIL_MCP_JWT_SECRET), and the local MCP server (node ./mcp/src/cli.ts with BETRAIL_MCP_JWT_SECRET, BETRAIL_MCP_CONSOLE_ORIGIN=, BETRAIL_MCP_CONSOLE_BFF_URL=, BETRAIL_, and BETRAIL_MCP_API_BASE_URL=; see Getting started and Remote MCP server) — export BETRAIL_MCP_URL= before launching claude.
Claude Code opens /mcp/authorize in your browser so you can approve sandbox scopes under your 2FA-enrolled Console session and revoke them anytime from /security. When BETRAIL_MCP_URL is unset, .mcp.json connects exclusively to https://mcp. via OAuth 2.1 + PKCE.
Included slash commands & skills#
| Command / skill | Purpose |
|---|---|
/betrail-integrate (betrail-integrate) | Wires a full sandbox integration: .env.example, betrail-v1 / betrail-v1-answer signing, seamless wallet callbacks, webhook receiver, launch/headless calls, and conformance tests. |
/betrail-embed (betrail-embed) | Mounts <betrail-game> (with SHA-384 SRI from manifest.json) or the isolated play host iframe with strict betrail:v1 origin locking and CSP headers. |
/betrail-verify (betrail-verify) | Audits and replays settled or post-draw void rounds across every legacy recipe, FairRandom, and live hash chain with redacted dispute exports. |
End-to-end sandbox workflow with /betrail-integrate#
Run /betrail-integrate inside your project (never pass secrets as command arguments):
/betrail-integrateThe betrail-integrate skill walks through seven verified stages:
- Detect stack & scaffold
.env.examplewith placeholder variables (BETRAIL_API_BASE_URL,BETRAIL_BRAND_ID,BETRAIL_,API_ KEY= btr_ test_<key> BETRAIL_SIGNING_SECRET,BETRAIL_WALLET_SECRET,BETRAIL_WEBHOOK_SECRET, and optional 24-hour rotation overlapBETRAIL_,WALLET_ PREV_ SECRET BETRAIL_) — obtaining one-time sandbox credentials from Console Onboarding's one-time key vault and never committing secrets.WEBHOOK_ PREV_ SECRET - Implement
betrail-v1&betrail-v1-answersigning verified againstapi/(plus optional RFC 8032testdata/ signing-vectors. json ed25519=wallet answers). - Mount seamless wallet routes (
POST /balance,/debit,/credit,/rollback) keyed ontransaction_id, returning unsigned401on bad auth, signed4xxrefusals on insufficient funds, rollback tombstones, and unconditional200on/credit(including"0.00000000"and blocked players). - Mount webhook receiver (
round.settled,credits.low,credits.exhausted) verifyingbetrail-v1over raw bytes beforeJSON.parseand deduplicating onBetrail-Webhook-Id. - Wire launch/embed (
POST /v1/launch) or headless rounds (POST /v1/rounds) using exact decimal strings (Amount) and integer-atom math. - Verify provable fairness via seed rotation (
POST /v1/) andplayers/ {player_ref}/ seeds/ {game}/ rotate GET /v1/.rounds/ {id}/ verify - Run automated conformance tests covering forged signatures, replay nonces, idempotent retries, rollback tombstones, and deterministic round replay.
Tip: Pair
/betrail-integratewith the remote MCP server'stest_wallet_endpoint(6-step conformance probe) andsend_test_webhooktools to verify your local or staging sandbox endpoints before running the Console's 29-check go-live suite.