Skip to main content
Glama

k402-mcp — pay-per-call APIs for AI agents, settled in Kaspa

An MCP server that gives any agent (Claude Code, Claude Desktop, agent SDKs) a catalog of agent-payable APIs: text tools (summarize, schema-guaranteed extraction, classify, rewrite), web reading, embeddings + semantic search, live Kaspa mainnet chain data, GPU model tiers, covenants-as-a-service (compile/derive/inspect/build/check/broadcast Silverscript covenants), and RISC Zero attestation-as-a-service (upload a guest, preflight for a cycle-exact quote, prove, verify). No account, no card, no API key — the agent opens a session, gets a personal KAS deposit address, and every call meters against the prepaid balance. Prices are USD-pegged, fractions of a cent per call, settled on Kaspa L1 (sub-second, ~zero fees).

The payment loop is agent-native: an unfunded call returns instructions ("send KAS to this address, this call costs X"), so an agent can discover the service, learn how to pay, and use it autonomously — the x402 idea, on Kaspa.

Hosted endpoint — zero install

The same server runs hosted at the public gateway (streamable HTTP):

https://x402-compute.68cxgfyr0.workers.dev/mcp

Claude Code:

claude mcp add --transport http k402 https://x402-compute.68cxgfyr0.workers.dev/mcp

Hosted sessions are per-connection: open_session binds the payment session to your MCP connection and returns the key — save it, and re-attach with use_session(<key>) after a reconnect. Nothing is shared between connections.

Related MCP server: x402engine-mcp

Install (local stdio)

pip install k402-mcp

Claude Code:

claude mcp add k402 -- k402-mcp

Claude Desktop / generic MCP config:

{ "mcpServers": { "k402": { "command": "k402-mcp" } } }

Env (all optional): K402_GATEWAY (defaults to the public gateway), K402_SESSION (pin a funded session key), K402_STATE (where the auto-opened session persists, default ~/.k402/session.json).

Use

  1. catalog — see every service and its live KAS/USD price (free)

  2. open_session — get a session + personal Kaspa mainnet deposit address (free); fund it from any wallet (min 0.25 KAS — confirmed in seconds)

  3. Call anything: summarize, extract, classify, rewrite, read_url, embed_text, search_index/search_query, kaspa_balance, kaspa_utxos, kaspa_tx_status, kaspa_fee_estimate, kaspa_network, generate (tiers: chat / llama / reason / think / code / kaspa-expert), covenant_compile/covenant_address/covenant_utxos/covenant_build/covenant_check/covenant_broadcast, prove_guest_upload/prove_preflight/prove_submit/job_status/job_result/attest_verify, payment_options, pay_per_call

  4. session_status — watch the balance draw down (free)

New here? Start with open_session — one funded deposit address, and every call meters against it. That's the whole loop. The other schemes (per-call coins, or trustless payment channels) are for when you want them; payment_options explains each.

The kUSD market (pay_kusd)

Services can also be priced in kUSD, the covenant-native dollar on Kaspa. registry_search(currency="kUSD") lists them (price_cents, ranked by settled cents); pay_kusd(capability, request_body, max_price_cents) pays the best one from your own kUSD wallet and returns the result; kusd_balance shows the wallet. The payment is a kUSD box of exactly the quoted cents to the provider, on the x402 wire (PAYMENT-REQUIRED / PAYMENT-SIGNATURE, kUSD as the asset) or k402's kusd-utxo header — the same money either way. Each box also carries 1.5 KAS (the provider's to recover) plus ~0.1 KAS fee; pay_kusd reports the full outlay. Short on kUSD? It buys the shortfall + 50¢ through the kUSD PSM with your KAS.

Local (stdio) install only — it spends the key behind KUSD_KEY_FILE, which the hosted endpoint never holds. Needs pip install 'k402-mcp[kusd]', the kusd_pay binary from kusd-framework (contracts/v2/harness), and env KUSD_PAY_BIN, KUSD_KEY_FILE (mode 600), KUSD_AUTHORITY (the kUSD authority covenant id — pins the family), optional KUSD_NODE_URL, KUSD_RELAY_URL, KUSD_NETWORK (default testnet-10), K402_REGISTRY. TN10 only today.

Trustless payment channels (kaspa-channel)

Where the gateway offers it, channel_config/channel_status expose a covenant payment channel: your KAS sits in a Kaspa L1 covenant (not the merchant's wallet), and you pay per call with signed vouchers — the merchant can only ever claim what you signed, and you reclaim the rest. Opening and funding a channel needs your Kaspa key, so that part runs in the k402 Python client (k402.channel); these MCP tools cover discovery and status.

Example, in Claude Code after claude mcp add:

"Use the k402 tools to check the current Kaspa network status and summarize https://kaspa.org"

The first call returns how-to-pay instructions; fund the deposit address it gives you and retry.

Notes & honest caveats

  • Prototype. Payments settle either custodial-prepaid (sessions) or trustlessly via kaspa-channel covenant payment channels (live on mainnet, covenant unaudited — channel sizes are capped). Keep balances small: a few KAS covers thousands of calls.

  • Paid tools return payment_required + instructions instead of failing opaquely.

  • The gateway rate-limits per IP; prices float with KAS/USD, so catalog shows current numbers.

  • Need KAS? Any exchange or wallet works — deposits are plain mainnet transfers.


mcp-name: io.github.Kali123411/k402

MIT © Kaspa Lab

Available Tools

17 tools
catalogA

List every service this gateway sells (text tools, Kaspa chain data, LLM tiers) with live prices in KAS and USD. Free. Start here to see what's available and what calls cost.

Inputs: no named parameters.

classifyA

Classify text into one (or multiple, if multi=true) of 2-32 labels; the result is constrained to your label set. Paid (~$0.0003 in KAS).

Inputs: text (required), labels (required), multi.

embed_textA

Embed up to 64 texts (768-dim vectors, nomic-embed-text). Paid (~$0.0003 in KAS).

Inputs: texts (required).

extractA

Extract structured data from text as JSON guaranteed to match your JSON schema (schema-constrained decoding, not best-effort). Paid (~$0.0015 in KAS).

Inputs: text (required), schema (required), instruction.

generateC

Run a prompt on a GPU model tier: 'chat' (fast 7B, ~$0.0015), 'reason' (35B, ~$0.004), 'code' (coder model, ~$0.0025), or 'kaspa-expert' (RAG-grounded, current Kaspa knowledge, ~$0.0015). Returns the completion text.

Inputs: prompt (required), tier, system, max_tokens.

kaspa_balanceA

Balance of any Kaspa MAINNET address, straight from a node (no indexer, no API key). Paid (~$0.00015 in KAS).

Inputs: address (required).

kaspa_fee_estimateA

Current Kaspa mainnet feerate buckets (sompi per gram of tx mass). Paid (~$0.00015).

Inputs: no named parameters.

kaspa_networkA

Kaspa mainnet status: DAA score, block count, difficulty, node sync state. Paid (~$0.00015 in KAS).

Inputs: no named parameters.

kaspa_tx_statusA

Mempool status of a Kaspa transaction. Absent from mempool means accepted-or-unknown — confirm acceptance by checking one of its outputs with kaspa_utxos. Paid (~$0.00015).

Inputs: txid (required).

kaspa_utxosB

UTXO set of a Kaspa mainnet address, including scriptPublicKey and covenant_id where set. Paid (~$0.0003 in KAS).

Inputs: address (required).

open_sessionA

Open a prepaid payment session: returns a session key and a personal Kaspa MAINNET deposit address. Send KAS to the address from any wallet (min 0.25 KAS); confirmed deposits become spendable balance within seconds and every paid tool call meters against it. Free. The session is saved locally so subsequent calls use it automatically.

Inputs: no named parameters.

read_urlA

Fetch a public web page and return its title + clean markdown; distill=true adds key-fact bullets. Useful when you have no web access of your own. Paid (~$0.0012 in KAS).

Inputs: url (required), distill.

rewriteA

Rewrite text per an instruction (tone, format, length...). Paid (~$0.001 in KAS).

Inputs: text (required), instruction (required).

search_indexA

Store documents [{id, text, meta?}] in a named server-side collection for semantic search. Use an unguessable collection name and keep it secret. Paid (~$0.0015 in KAS).

Inputs: documents (required), collection (required), replace.

search_queryA

Semantic-search a collection you indexed earlier; returns top-k matches with scores. Paid (~$0.0003 in KAS).

Inputs: q (required), collection (required), top_k.

session_statusA

Check the current payment session: deposit address, deposited / spent / remaining KAS. Free.

Inputs: no named parameters.

summarizeB

Summarize text or a public URL in at most max_words. Paid (~$0.001 in KAS).

Inputs: url, text, max_words.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 17 tools

    Disambiguation5/5

    Every tool has a clearly distinct purpose, targeting either text processing (classify, embed, extract, generate, rewrite, summarize, read_url, search), Kaspa blockchain data (balance, fee, network, tx status, UTXOs), or session management (open, status). No significant overlap; descriptions clarify any potential confusion.

    Naming Consistency4/5

    Most tools follow a verb_noun pattern in snake_case (e.g., embed_text, kaspa_balance, open_session). There are minor deviations like 'catalog' (noun used as command) and 'read_url' (verb_noun), but overall the pattern is consistent and readable.

    Tool Count4/5

    17 tools is slightly above the ideal range but still reasonable for a gateway that combines text AI services and blockchain data. Each tool serves a distinct function, and the count matches the breadth of the server's purpose.

    Completeness4/5

    The tool set covers a wide range of text operations (classification, embedding, extraction, generation, summarization, semantic search) and essential Kaspa blockchain queries (balance, fees, network status, transactions, UTXOs). Minor gaps like transaction broadcasting or session closure are acceptable for the stated scope.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      MCP server for AgentPay — the payment gateway for autonomous AI agents. Fund a wallet once, give your agent the key, and it discovers, provisions, and pays for tool APIs on its own. One key, every tool.
      112 npm
      1
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      An MCP server providing 22 pay-per-call utility tools for AI agents (scrape, validate, embed, store, moderate, notify, convert, prevent loops) without accounts or API keys, using USDC payments via the x402 protocol.
      17
      53 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server providing 17 keyless, pay-per-use web-data tools with signed-provenance receipts, enabling AI agents to autonomously fetch, extract, and verify web content on Base mainnet.
      MIT