k402-mcp
You can discover paid APIs, open and fund a prepaid Kaspa session, and call metered text, web, embedding/search, Kaspa-chain, and GPU LLM tools.
Browse all services and live KAS/USD prices with
catalog.Open a session with
open_sessionto get a personal Kaspa mainnet deposit address; check balance/spend withsession_status.Process text with
summarize,extract(schema-guaranteed JSON),rewrite, andclassify.Read public web pages as clean markdown with
read_url.Create embeddings (
embed_text) and run server-side semantic search (search_index,search_query).Query Kaspa mainnet data: address balance, UTXOs, tx mempool status, fee estimates, and network status.
Run prompts on GPU model tiers (
chat,reason,code,kaspa-expert) withgenerate.Paid calls are metered against the prepaid session; unfunded calls return payment instructions.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@k402-mcp Check Kaspa network status and summarize https://kaspa.org"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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/mcpClaude Code:
claude mcp add --transport http k402 https://x402-compute.68cxgfyr0.workers.dev/mcpHosted 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-mcpClaude Code:
claude mcp add k402 -- k402-mcpClaude 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
catalog— see every service and its live KAS/USD price (free)open_session— get a session + personal Kaspa mainnet deposit address (free); fund it from any wallet (min 0.25 KAS — confirmed in seconds)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_callsession_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.
The whole loop, as tools. registry_search(currency="kUSD") / registry_provider / registry_activity
(the Kaspa Agent Market at K402_REGISTRY, default https://market.kaspa-402.org) to discover; get_quote
to see exactly what a call costs with nothing paid (the kUSD requirement off the provider's 402, the per-offer
payee key, the outlay, the checks, what your policy has left); pay_kusd to pay; verify_settlement(txid) to
prove it counted — the registry's node-verified row, and with the offer's payee/cents/payment_id a second check
on your own wallet's node; list_service / delist_service to sell (a listing signed with your wallet key, the
10¢ kUSD fee paid through k402). These are the machine interfaces behind
www.kaspa-402.org/market.
The operator sets the bounds, not the agent. pay_kusd only spends inside a SpendPolicy written by
whoever funds the wallet, measured against a sqlite ledger so a restart never resets a budget:
KUSD_SPEND_POLICY (JSON file) and KUSD_SPEND_LEDGER (default ~/.kusd-market/spend.db). Without a
policy file the server applies a conservative default — 25¢ per call, 200¢ and 20 calls per hour, 100¢ of
PSM top-ups per hour, stop after 2 unserved payments in an hour. Fields (all optional): max_per_call_cents,
max_total_cents, window_seconds, max_window_cents, max_window_calls, max_window_topup_cents (0 =
never convert KAS), max_window_failures, allow_payees, allow_capabilities, require_listed_payee. The
agent's own max_price_cents can only tighten the per-call ceiling. A refused call returns
{"error", "code", "spend"} and paid nothing; kusd_spend_status (free) shows what is left. The kill
switch and the policy are the operator's alone, from the k402-spend CLI in the k402 package:
k402-spend --ledger ~/.kusd-market/spend.db --policy ~/.kusd-market/policy.json status
k402-spend --ledger ~/.kusd-market/spend.db freeze # every pay_kusd refused until unfreezeTrustless 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-channelcovenant 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
catalogshows 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 toolscatalogA
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
Scored across 17 tools
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.
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.
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.
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
Related MCP Connectors
Pay-per-use tool marketplace for AI agents. Search, price-check, and call APIs via MCP.
Hosted MCP server for live public-data APIs and Skills for AI agents.
Remote MCP server exposing 330 production AI-agent services for web/data processing, validation, AI utilities, blockchain/crypto utilities, and x402 pay-per-use access.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceMCP 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 npm1MIT
- AlicenseBqualityCmaintenanceMCP server providing AI agents access to 38 pay-per-call APIs (LLM, image, code, audio, crypto, web, IPFS) via HTTP 402 micropayments in USDC/USDm.22140 npm1MIT
- AlicenseBqualityDmaintenanceAn 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.1753 npm1MIT
- AlicenseNot gradedqualityDmaintenanceMCP 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