insumer_buy_credits
Purchase verification credits using USDC, USDT, or BTC. Supports EVM, Solana, and Bitcoin; volume discounts up to 50% off. Minimum $5. Non-refundable; first purchase registers sender wallet.
Instructions
Buy verification credits with USDC, USDT, or BTC. Volume discounts: $5–$99 = $0.04/call (25 credits/$1), $100–$499 = $0.03 (33/$1, 25% off), $500+ = $0.02 (50/$1, 50% off). Minimum $5. USDC/USDT on EVM and Solana (auto-detected). BTC on Bitcoin (converted to USD at market rate, 1 confirmation required). Crypto sent on unsupported chains cannot be recovered. Non-refundable. First purchase registers the sender wallet to the API key. Subsequent purchases must come from the same sender. To change the registered wallet, set updateWallet to true.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| txHash | Yes | Transaction hash proving payment | |
| chainId | Yes | Payment chain: 1, 8453, 137, 42161, 10, 56, 43114, 'solana', or 'bitcoin'. EVM/Solana accept USDC and USDT (auto-detected). Bitcoin accepts BTC (converted to USD at market rate). | |
| amount | No | Stablecoin amount sent (minimum 5). Not required for BTC. | |
| updateWallet | No | Set true to update the registered sender wallet to this transaction's sender |
Implementation Reference
- src/index.ts:472-485 (registration)Tool registration for 'insumer_buy_credits' on the MCP server. Accepts txHash, chainId, amount (optional), updateWallet (optional). Calls POST /credits/buy via apiCall helper.
server.tool( "insumer_buy_credits", "Buy verification credits with USDC, USDT, or BTC. Volume discounts: $5–$99 = $0.04/call (25 credits/$1), $100–$499 = $0.03 (33/$1, 25% off), $500+ = $0.02 (50/$1, 50% off). Minimum $5. USDC/USDT on EVM and Solana (auto-detected). BTC on Bitcoin (converted to USD at market rate, 1 confirmation required). Crypto sent on unsupported chains cannot be recovered. Non-refundable. First purchase registers the sender wallet to the API key. Subsequent purchases must come from the same sender. To change the registered wallet, set updateWallet to true.", { txHash: z.string().describe("Transaction hash proving payment"), chainId: UsdcChainIdWithBitcoin, amount: z.number().min(5).optional().describe("Stablecoin amount sent (minimum 5). Not required for BTC."), updateWallet: z.boolean().optional().default(false).describe("Set true to update the registered sender wallet to this transaction's sender"), }, async (args) => { const result = await apiCall("POST", "/credits/buy", args); return formatResult(result); } ); - src/index.ts:481-484 (handler)Handler for 'insumer_buy_credits': sends POST to /credits/buy with args (txHash, chainId, amount, updateWallet) using the authenticated apiCall helper, then formats the response.
async (args) => { const result = await apiCall("POST", "/credits/buy", args); return formatResult(result); } - src/index.ts:475-479 (schema)Input schema for insumer_buy_credits: txHash (string), chainId (UsdcChainIdWithBitcoin union type supporting EVM chain IDs, solana, bitcoin), amount (optional number min 5), updateWallet (optional boolean, default false).
{ txHash: z.string().describe("Transaction hash proving payment"), chainId: UsdcChainIdWithBitcoin, amount: z.number().min(5).optional().describe("Stablecoin amount sent (minimum 5). Not required for BTC."), updateWallet: z.boolean().optional().default(false).describe("Set true to update the registered sender wallet to this transaction's sender"), - src/index.ts:17-40 (helper)Shared authenticated API helper used by the handler to make the POST /credits/buy request with the API key header.
async function apiCall( method: string, path: string, body?: Record<string, unknown> ): Promise<{ ok: boolean; data?: unknown; error?: unknown; meta?: unknown }> { if (!apiKey) { return { ok: false, error: "INSUMER_API_KEY is not set. Call the insumer_setup tool to generate a free API key instantly, then add it to your MCP config as INSUMER_API_KEY and restart." }; } const url = `${API_BASE}${path}`; const res = await fetch(url, { method, headers: { "Content-Type": "application/json", "X-API-Key": apiKey, }, body: body ? JSON.stringify(body) : undefined, }); return res.json() as Promise<{ ok: boolean; data?: unknown; error?: unknown; meta?: unknown; }>; } - src/index.ts:61-76 (helper)Shared formatResult helper used by the handler to format API responses into MCP content blocks.
function formatResult(result: { ok: boolean; data?: unknown; error?: unknown; meta?: unknown; }) { if (result.ok) { return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }], }; } return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }], isError: true, }; }