Skip to content

Reference for the MCP builder tools. Install, client configs, every tool with its key params, workflows, resources, and the CLI access path.

The MCP builder tools let an AI assistant build, review, simulate, and query BitBadges transactions. The CLI is the primary entry point; MCP adapts the shared tool registry for clients that prefer structured tool calls. The installed registry in bitbadgesjs-sdk/src/builder/tools/ is authoritative when this reference and an installed version differ.

bash
# Install globally
npm install -g bitbadges

# Start the MCP server from that same installation
bitbadges-builder

To build from your own Node code with the same tools and no MCP client, use the Programmatic Agent. For terminal workflows without an MCP client, use the CLI.

Schemas and Examples

bash
bb dev capabilities
bb dev capabilities build_subscription
bb dev tools call build_subscription --args-file subscription.json

The compact catalog lists operation IDs and CLI/MCP entry points. Requesting one ID includes its inputSchema; the standard builders also include a sample in inputSchema.examples. The equivalent MCP call is get_capabilities with {"id":"build_subscription"}. schemaVersion identifies the catalog format and catalogHash identifies its installed definitions.

Eighteen existing standard builders are exposed through this adapter, including subscriptions, auctions, bounties, crowdfunds, product catalogs, smart tokens, credits, and approval templates. They use the same core functions as the CLI. PaymentRequestV2 remains available as build_payment_request_v2, including invoice substandards. The catalog also exposes standard actions through the installed CLI, including standard_credit_tokens_quote for exact credit purchase units. Native Cosmos commands remain CLI-only; inspect the installed catalog rather than guessing a tool name.

The schemas enforce JSON shape and unknown-field rejection. Each builder also applies its existing runtime rules; schema validity alone does not prove a payment is authorized or will succeed on chain. IDs and integer base-unit amounts use strings where declared; older display-unit builder parameters use numbers. Returned approval amounts are encoded as decimal strings. Examples are unsigned proposals with sample addresses, IDs and metadata URLs; replace them, set the real signer, review, and simulate before requesting a signature.

Client Configuration

Claude Desktop

Add to claude_desktop_config.json:

json
{
  "mcpServers": {
    "bitbadges-builder": {
      "command": "bitbadges-builder",
      "args": [],
      "env": {
        "BITBADGES_API_KEY": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
      }
    }
  }
}

The key is a fake example. Configure your own key from bitbadges.io/developer locally. Building proposals does not require a mnemonic. Use main-wallet requests for browser signing.

Claude Code

After the chain and CLI install (curl -fsSL https://install.bitbadges.io | sh), add the server by hand:

bash
claude mcp add bitbadges-builder -- bitbadges-builder

Or install the Claude Code Plugin, which wires the same server and adds 8 workflow skills plus /bitbadges:setup and /bitbadges:status:

text
/plugin marketplace add BitBadges/bitbadges-plugin
/plugin install bitbadges

The plugin is a convenience layer. The CLI install is what runs underneath.

Cursor

Add to .cursor/mcp.json:

json
{
  "mcpServers": {
    "bitbadges-builder": {
      "command": "bitbadges-builder",
      "args": [],
      "env": {
        "BITBADGES_API_KEY": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
      }
    }
  }
}

Environment Variables

VariableRequiredDescription
BITBADGES_API_KEYFor queries, simulation, broadcast, and review linksYour BitBadges API key (get one)
BITBADGES_API_URLNoOverride the API base (default https://api.bitbadges.io)
BITBADGES_FRONTEND_URLNoOverride the site base used in review links (default https://bitbadges.io)
BITBADGES_CONFIG_DIRNoSeparate CLI configuration, sessions, and signing-request files; useful for isolated agent environments
BITBADGES_CLI_PATHNoTrusted installed CLI executable for standard actions; defaults to bitbadges-cli on PATH

The MCP server does not need wallet private keys or mnemonics. Signing happens through the separately authorized CLI or wallet flow. It does not read ANTHROPIC_API_KEY or OPENAI_API_KEY; your client provides the model.

Tools

Params marked * are required. Session tools also accept sessionId and creatorAddress (bb1 or 0x form) for per-request isolation; those two are omitted from the tables.

A complete call, as the client sends it and as bb dev tools call add_approval --args-file ./approval.json reads it. This adds a public mint of Demo Coin (collection token ID 1) with at most 10 units per address:

json
{
  "sessionId": "demo-coin",
  "creatorAddress": "bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d",
  "approvalId": "public-mint",
  "fromListId": "Mint",
  "toListId": "All",
  "initiatedByListId": "All",
  "tokenIds": [{ "start": "1", "end": "1" }],
  "transferTimes": [{ "start": "1", "end": "18446744073709551615" }],
  "ownershipTimes": [{ "start": "1", "end": "18446744073709551615" }],
  "approvalCriteria": {
    "overridesFromOutgoingApprovals": true,
    "overridesToIncomingApprovals": true,
    "approvalAmounts": {
      "overallApprovalAmount": "0",
      "perToAddressApprovalAmount": "10",
      "perFromAddressApprovalAmount": "0",
      "perInitiatedByAddressApprovalAmount": "0",
      "amountTrackerId": "public-mint",
      "resetTimeIntervals": { "startTime": "0", "intervalLength": "0" }
    }
  }
}

The tool answers with the approval as stored in the session plus any validation notes.

Standard Actions

Prefer the high-level builder or action when it fits. The standard_* tools cover payment requests, subscriptions, smart tokens, credits, products, auctions, crowdfunds, bounties, and prediction markets. Inputs come from the CLI command definitions, and results preserve the CLI JSON envelope. They query state or prepare unsigned messages; they never sign or broadcast.

bash
bb dev capabilities standard_pay_requests_pay
bb pay-requests pay 46 --creator "$PAYER" --obligation payment-1 --units 1 --mainnet

Equivalent MCP arguments for standard_pay_requests_pay:

json
{
  "collectionId": "46",
  "creator": "bb1zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zql3w7",
  "obligation": "payment-1",
  "units": "1",
  "mainnet": true
}

Replace the sample collection and payer. Action amounts are strings, preserving CLI decimal text; units follow that command's help. Signing, credential, endpoint, shell, and file-output arguments are excluded. The adapter starts bitbadges-cli directly with literal arguments and checks its capability hash before running the action. Install CLI and MCP from the same SDK version. BITBADGES_CLI_PATH can select a trusted installed CLI executable when the client cannot find it on PATH; it is operator configuration, not a tool argument.

For subscriptions, standard_subscriptions_claim prepares one payment; standard_subscriptions_subscribe also requests recurring consent. Renewal and cancellation require a successful read of existing approvals so unrelated consent is preserved. Do not infer refunds or prorations from cancellation.

For browser handoff use the CLI's --browser flow. list_signing_requests lists local request IDs; signing_request_status accepts requestId and optional resume: true. Resume returns the original signing URL only while its listener is active. These tools do not initiate payment or verify chain execution. See request recovery.

Session Builders

Each tool sets one field on a session-scoped transaction. Calls in the same round can run in parallel. Tools that need the API key say so.

ToolWhat it doesKey params
set_standardsSet the collection's standards array, which selects the site's dedicated viewsstandards* (array, e.g. ["Subscriptions"], ["NFTs"], ["Smart Token"])
set_valid_token_idsSet which token ID ranges exist. Fungible tokens and subscriptions use one ID; NFTs use a rangetokenIds* (array of ranges)
set_default_balancesSet default balances for all users. Almost always empty balances with every auto-approve flag true. Mint recipients need a matching incoming approval, an auto-approve flag, or an explicit collection-level overridedefaultBalances* (object)
set_permissionsSet collection permissions from a preset or a custom object. Fields are frozen (permanentlyForbiddenTimes: FOREVER) or neutral ([])preset (fully-immutable, manager-controlled, locked-approvals default), permissions (object, overrides preset)
set_invariantsSet on-chain invariants. They cannot be removed after creationinvariants* (object or null; keys noCustomOwnershipTimes, maxSupplyPerId, cosmosCoinBackedPath)
set_managerSet the manager address. Defaults to the creatormanager*
set_collection_metadataSet name, description, and image. Auto-creates a metadata placeholder URIname*, description*, image* (IMAGE_N, an https:// or ipfs:// URL, or a data:image/svg+xml;base64 URI)
set_token_metadataSet metadata for token ID ranges. {id} works in the URI onlytokenIds*, name*, description*, image*
set_custom_dataSet the on-chain custom data string (any JSON or text)customData*
set_mint_escrow_coinsFund the mint escrow address at creation. Required for quest rewards and escrow payouts where coinTransfers use overrideFromWithApproverAddresscoins* (array; for quests rewardAmount * maxClaims)
add_approvalAdd a collection approval: who can transfer what, when, under which conditions. Remove and re-add with the same approvalId to replace in placeapprovalId*, fromListId* (Mint, !Mint, or an address), toListId (default All), initiatedByListId, tokenIds, transferTimes, ownershipTimes, approvalCriteria (object, non-default fields only; overridesFromOutgoingApprovals must be true for Mint approvals)
add_preset_approvalAdd a collection approval from a named preset instead of hand-writing the approval criteria. Output is identical in shape to add_approvalpresetId* (e.g. credit-token.scaled), params* (per-preset schema), overrides (deep merge; arrays replace, objects merge)
list_presetsList named approval presets with presetId, name, description, and paramsSchemaskill (filter by skill id, e.g. credit-token)
remove_approvalRemove a collection approval by id. Order is preserved on re-addapprovalId*
set_approval_metadataSet a name and description on an approval. Image is always empty for approvalsapprovalId*, name*, description*
add_alias_pathAdd an alias path for ICS20-backed tokens or liquidity pools. Required for smart tokens. Decimals must match the IBC denomaliasPath* (object), pathName, pathDescription, pathImage, denomUnitName, denomUnitDescription, denomUnitImage (off-chain, routed to metadataPlaceholders)
remove_alias_pathRemove an alias path by denomdenom*
add_cosmos_wrapper_pathAdd a wrapper path that mints and burns a new ICS20 coin from collection tokens. Advanced; most cases want smart tokens, pools, or coinTransfers. Approvals for the wrapper address need allowSpecialWrapping: true and mustPrioritize: truewrapperPath* (object), plus the same off-chain pathName, pathDescription, pathImage, denomUnitName, denomUnitDescription, and denomUnitImage params as add_alias_path
remove_cosmos_wrapper_pathRemove a wrapper path by denomdenom*
add_transferAppend a MsgTransferTokens after the collection message for auto-mint at creation. collectionId is set to "0" (the new collection). Needs a matching mint approvaltransfers* (array of from, to, balances, prioritized approval)
remove_transferRemove a transfer message by index. messages[0] is the collection and cannot be removedindex* (>= 1)
set_is_archivedArchive or unarchive. Archived collections stay on-chain but are hidden from browsingisArchived*
get_transactionReturn the assembled transaction JSON with metadataPlaceholders. Numbers become strings. Blank image fields are auto-filled with a deterministic SVG seeded by the collection namenone
get_review_urlFinal step: upload the transaction to the open preview endpoint and return a short bitbadges.io link the user opens to review and sign. Needs the API key to upload; the person opening the link needs none. Links expire after 1 hour.transaction (defaults to the session), frontendUrl
reset_sessionClear all session state and start from a blank collection. Call it before building a second collection in the same conversation; session state is global and persists, so the new collection would otherwise inherit the previous approvals, metadata, alias paths, and transferssessionId (omit for the default session)

generate_placeholder_art (seed*, style, monogram) still exists in source but is not in the MCP catalog: get_transaction fills blank images for you.

Helper Builders

ToolWhat it doesKey params
build_claimBuild a claim document for POST /api/v0/claims: code-gated, password-gated, whitelist-gated, or openclaimType*, name*, maxUses*, description, numCodes, password, whitelist, maxUsesPerAddress, action (links a collection approval), showInSearchResults, categories
build_transferBuild a MsgTransferTokens by querying the collection and constructing the right prioritizedApprovals and coinTransfers. Supports mint, transfer, deposit (IBC to token), withdraw (token to IBC). Needs the API keycollectionId*, fromAddress* (Mint to mint), toAddress*, tokenIds, amount (default "1"), intent (mint, transfer, deposit, withdraw)
build_dynamic_storeBuild transaction JSON for dynamic stores: create, update, delete, set values. Dynamic stores are on-chain allowlists usable in dynamicStoreChallengesaction* (create, update, delete, set_value, batch_set_values), creator*, storeId, defaultValue, globalEnabled, uri, customData, address, value, entries

Review and Analysis

ToolWhat it doesKey params
review_collectionDeterministic review of a transaction or on-chain collection. Merges audit, standards, and UX findings into one ReviewResult with one verdict. Each finding has code, severity, source, category, and localized title, detail, recommendationcollection* (message, its value, a { messages } transaction, or a raw collection), context (onChainCollection, skipSources, hideAgentOnly)
flag_review_itemFlag an assumption, substitution, or unsupported request for the user to check before broadcast. Flags surface in the review-and-sign flowkind* (assumption, substitution, unsupported_request, clarification_needed, design_choice, other), severity* (low, medium, high), message*, chosen*, alternative, fieldPath
explain_collectionHuman-readable explanation with optional Q&A. Covers what it is, how to get tokens, what the manager can change, trust signals, and risk. No API keycollection*, question, audience (user default, developer, auditor)
analyze_collectionStructured analysis of transferability, approvals, permissions, and how to obtain or transfer tokens. Feeds MsgTransferTokens construction. Needs the API keycollectionId*

Simulation and Validation

ToolWhat it doesKey params
simulate_transactionDry-run without broadcasting. Returns raw events, parsed transfer events (coin, token, IBC), and per-address net balance changes. Defaults to the session transaction. Needs the API keytransaction or transactionJson
validate_transactionCheck a transaction against the critical rules: numbers as strings, required fields, list IDs. Defaults to the session transactiontransaction or transactionJson

Queries

All query tools need BITBADGES_API_KEY.

ToolWhat it doesKey params
query_collectionFetch a collection. Use fields to shrink the responsecollectionId*, includeMetadata (default true), fields (array of top-level fields)
query_balanceFetch the balance array, or one amount at the current time when tokenId is setcollectionId*, address*, tokenId
query_dynamic_storeRead a dynamic store: details, one address value, a paginated value list, or all stores by creatoraction* (get_store, get_value, list_values, list_by_creator), storeId, address, bookmark
verify_ownershipCheck that an address meets ownership requirements. Shorthand for one collection, or a full AssetConditionGroup for $and / $or / $notaddress*, collectionId, tokenId (default "1"), tokenIdEnd, minAmount (default "1"), requirements (JSON string)
searchSearch collections, accounts, and tokensquery*
search_pluginsFind off-chain claim plugins by text, fetch by id, or list a creator's public plugins. Any plugin is fetchable by id without authsearchValue, pluginIds, creatorAddress, bookmark
lookup_token_infoSymbol, IBC denom, decimals, and pre-generated backing address for a tokenquery* (symbol like USDC or an ibc/... denom)

Component Generators

Stateless helpers that return one piece of a collection.

ToolWhat it doesKey params
generate_approvalBuild an approval by patternapprovalType* (public-mint, manager-mint, smart-token-backing, smart-token-unbacking, subscription, free-transfer, restricted-transfer), approvalId*, tokenIds, backingAddress, paymentAmount, paymentDenom, paymentRecipient, maxPerUser, totalMax, fromListId, toListId, initiatedByListId
generate_permissionsBuild a permissions object from a presetpreset* (fully-immutable, manager-controlled, token-locked, custom), customPermissions
generate_backing_addressDeterministic IBC backing address for a denom, plus list IDs for smart token approvalsibcDenom* (denom or symbol)
generate_alias_pathAlias path config for swappable tokens and DEX displaysymbol*, decimals*, tokenId (default "1"), metadataUri, name, description
generate_wrapper_addressDeterministic wrapper address for a wrapper path denom. No private key; protocol-controlleddenom*
generate_unique_idCollision-free IDs like prefix_a1b2c3d4 for new approvals and trackers. Keep original IDs on updatesprefix*, count (default 1)

Utilities

ToolWhat it doesKey params
validate_addressCheck an address and detect its chain typeaddress*
convert_addressConvert between 0x and bb1 formatsaddress*, targetFormat (eth, bitbadges)
get_current_timestampCurrent time in milliseconds with common offsets and durationsoffsetMs, offsetDays, offsetHours
diagnose_errorMap a transaction error to a diagnosis and fixerror*, context
search_knowledge_baseRanked snippets across embedded docs, learnings, recipes, error patterns, and critical rulesquery*, category (all, docs, learnings, recipes, errors, rules)

Instructions and Docs

ToolWhat it doesKey params
get_skill_instructionsBuild instructions for one skill. Skill ids: address-list, auction, auto-mint, bb-402, bounty, burnable, credit-token, crowdfund, custom-2fa, fungible-token, immutability, liquidity-pools, minting, multi-sig-voting, nft-collection, payment-protocol, payment-request, prediction-market, product-catalog, quest, smart-token, subscription, tradableskillId*
fetch_docsKeyword search over the live docs export on docs.bitbadges.io. Returns the top matching sectionstopic*

Rendered skill pages: Skills.

Workflows

Session-Based Build

Ask your agent:

text
Build a fungible token called Demo Coin with a 1,000,000 supply cap and a public mint of up to 10 per address. Use the session tools, run validate, review, and simulate in parallel, fix any critical findings, then call get_review_url and give me the link.

The prompt above produces this chain:

text
set_standards + set_valid_token_ids + set_invariants + add_approval + set_permissions + set_default_balances + set_collection_metadata + set_token_metadata
  -> (optional) add_transfer (auto-mint at creation)
  -> validate_transaction + review_collection + simulate_transaction (in parallel)
  -> fix errors with remove_approval + re-add (max 3 attempts)
  -> get_transaction (final JSON)
  -> get_review_url (link the user opens to review and sign)
  1. Build. Call the per-field tools in parallel: standards, token IDs, invariants, approvals, permissions, metadata, balances.
  2. Auto-mint (optional). Call add_transfer to append a MsgTransferTokens next to the collection creation.
  3. Verify. Call validate_transaction, review_collection, and simulate_transaction in parallel. Fix errors with a targeted remove_approval and re-add.
  4. Export. Call get_transaction for the final JSON.
  5. Hand off. Call get_review_url and give the user reviewUrl. Prefer the link over pasting JSON: it is short and cannot be corrupted in transit.

Query and Verification (No Signing)

text
query_collection -> verify_ownership -> (act on the result)

Auto-Mint at Creation

add_transfer mints to specific addresses in the same transaction as the collection creation. The transaction then holds two messages: MsgCreateCollection and MsgTransferTokens. (The session holds it as MsgUniversalUpdateCollection; get_transaction narrows it on the way out.) Use it for "mint 100 tokens to myself", "distribute tokens to the team", or "auto-mint at creation".

  1. Build the collection with a mint approval (add_approval with fromListId: "Mint" and initiatedByListId: <creator address>).
  2. Call add_transfer with the recipient addresses, balances, and prioritizedApprovals that reference the mint approval.
  3. Verify and export as normal. The transaction contains both messages.

Maximum 4 transfer messages per transaction.

Hand Off to the Browser

The builder never signs or broadcasts. Three exits:

  • get_review_url returns reviewUrl, where the user reviews and signs with a browser wallet. It is backed by a prv_ code from POST /api/v0/builder/preview. Uploading the preview needs BITBADGES_API_KEY; opening the returned link needs none, because the unguessable code is the secret. The code expires in 1 hour. BITBADGES_FRONTEND_URL or the frontendUrl param points the link at testnet or a local site; a testnet BITBADGES_API_URL infers https://testnet.bitbadges.io.
  • Save get_transaction output to a file and run bb preview tx.json --open, or bb deploy --browser / --burner from the CLI.
  • Sign with the SDK signing client.

Resources

The server also exposes embedded documents as MCP resources. Read them with your client's resource support or with bb dev resources read bitbadges://recipes/all.

Resource URINameDescription
bitbadges://tokens/registryToken registryIBC denoms, symbols, decimals, and pre-generated backing addresses
bitbadges://rules/criticalCritical rulesRules every transaction must follow
bitbadges://skills/allSkill instructionsInstructions for all builder skills
bitbadges://docs/conceptsCore conceptsTransferability, approvals, permissions, balances, address lists
bitbadges://docs/examplesFull examplesComplete transaction JSON for NFT collections, fungible tokens, and smart tokens
bitbadges://recipes/allCode recipes and decision matricesSnippets and decision matrices for common operations
bitbadges://learnings/allLearnings and gotchasKnown gotchas, tips, and discoveries
bitbadges://errors/patternsError patternsError messages mapped to diagnoses and fixes
bitbadges://docs/frontendReference frontend patternsPatterns from the reference site (Next.js and Ant Design)
bitbadges://workflows/allWorkflow chainsStep-by-step tool chains for multi-step operations
bitbadges://schema/token-builderToken builder schemaAnnotated schema for the session builders: design axes, field reference, approval patterns, validation checklist

Call Tools from the CLI

The same registry is reachable from bb dev as plain function calls, with no MCP round-trip.

bash
bb dev tools list                              # full schemas, as JSON
bb dev tools list --names                      # `{ ok, data: { names: [...] } }` envelope; pipe to jq -r '.data.names[]'
bb dev tools call get_current_timestamp
bb dev tools call get_skill_instructions --args '{"skillId":"smart-token"}'
bb dev tools call set_collection_metadata --args-file ./metadata.json --session demo
FlagDescription
--args <json>Tool arguments as inline JSON
--args-file <path>Tool arguments from a JSON file
--session <id>Session id for stateful tools, persisted to ~/.bitbadges/sessions/<id>.json. Defaults to --args.sessionId or the built-in default session
--rawPrint the structured result instead of the formatted text block

Stateful tools (set_*, add_*, remove_*, get_transaction) read and write the named session. Sessions survive across invocations, so an agent can compose a collection across many calls:

bash
SESSION=demo-coin
bb dev tools call set_standards --session $SESSION --args '{"standards":["Fungible Tokens"]}'
bb dev tools call set_valid_token_ids --session $SESSION --args '{"tokenIds":[{"start":"1","end":"1"}]}'
bb dev tools call set_collection_metadata --session $SESSION --args '{"name":"Demo Coin","description":"One million units of token ID 1.","image":"ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/coin.png"}'
bb dev tools call add_approval --session $SESSION --args-file ./approval.json     # the public-mint call from the Tools section
bb dev tools call get_transaction --session $SESSION

Unknown tool names exit 1 and print the available tools on stderr.

bash
bb session list                       # session ids on disk
bb session show demo                  # snapshot as JSON
bb session reset demo                 # delete the file

bb dev resources list                 # full metadata as JSON
bb dev resources list --uris          # URIs only
bb dev resources read bitbadges://recipes/all

Flag-based template builders (bb build <template>) are faster than composing tool calls when a template fits: Build.

Edit this page on GitHub

For agents

How agents read these docs