ମୁଖ୍ୟ ବିଷୟବସ୍ତୁକୁ ଛାଡ଼ନ୍ତୁ
MCP ଇଣ୍ଟେଗ୍ରେସନ୍

MCP ଉପରେ Blockchain0x।

କୌଣସି MCP ହୋଷ୍ଟକୁ - Claude Desktop, Cursor, VS Code - ଏକ କନଫିଗ୍ ବ୍ଲକ୍ ସହିତ ଏଜେଣ୍ଟ ୱାଲେଟ୍ ଟୁଲ୍ ଦିଅନ୍ତୁ। ଏବଂ ଯେତେବେଳେ ଆପଣ ଆପଣଙ୍କର ନିଜ ଟୁଲ୍ ପାଇଁ ଚାର୍ଜ୍ କରିବାକୁ ଚାହାଁନ୍ତି, ଆସଲ requirePayment x402 ବିଲ୍ଡର୍ ବ୍ୟବହାର କରନ୍ତୁ।

ସଂକ୍ଷିପ୍ତ ଉତ୍ତର

@blockchain0x/mcp server ଗୋଟିଏ MCP host କୁ ପାଞ୍ଚଟି agent-wallet tool ଦିଏ: wallet ପଢ଼ନ୍ତୁ, wallets ତାଲିକା କରନ୍ତୁ, transaction ଯାଞ୍ଚ କରନ୍ତୁ, USDC payment ପଠାନ୍ତୁ, ଏବଂ x402 invoice settle କରନ୍ତୁ। ଏହାକୁ npx @blockchain0x/mcp ସହ ଚଳାନ୍ତୁ (ଆପଣଙ୍କ key ଆପଣଙ୍କ machine ରେ ରହେ) କିମ୍ବା hosted URL କୁ point କରନ୍ତୁ। ଅଲଗା ଭାବରେ, package requirePayment export କରେ ଯାହାଦ୍ୱାରା ଆପଣ x402 402 challenge ସହ ଆପଣଙ୍କ ନିଜ MCP tools ପାଇଁ ମୂଲ୍ୟ ଧାର୍ଯ୍ୟ କରିପାରିବେ।

ଦୁଇଟି କାମ, ଗୋଟିଏ package

MCP ମାଧ୍ୟମରେ spend କରନ୍ତୁ। MCP ମାଧ୍ୟମରେ charge କରନ୍ତୁ।

ପ୍ରଥମ କାମ: agent କୁ ତାହାର host ଭିତରୁ ଏକ wallet USE କରିବାକୁ ଦିଅନ୍ତୁ। @blockchain0x/mcp server @blockchain0x/node SDK ଉପରେ ଏକ ପତଳା, stateless proxy। ଏହା Claude Desktop, Cursor, କିମ୍ବା VS Code କୁ ପାଞ୍ଚଟି wallet tool ଦେଖାଏ, ଏବଂ ଆପଣଙ୍କ API key ର scope, allowance, ଏବଂ per-period caps backend ଦ୍ୱାରା ଅନ୍ୟ କୌଣସି API call ପରି ନିର୍ଦ୍ଦିଷ୍ଟ ଭାବରେ enforced ହୁଏ। server କୌଣସି key ଧରିନଥାଏ ଏବଂ କିଛି ସଂରକ୍ଷଣ କରେ ନାହିଁ।

ଦ୍ୱିତୀୟ କାମ: agents କୁ ଆପଣଙ୍କ tools କଲ୍ କରିବା ପାଇଁ charge କରନ୍ତୁ। MCP tool invocation କୁ frictionless କରିଦେଲା, ଯାହା ଭଲ, ଯେପର୍ଯ୍ୟନ୍ତ ଆପଣଙ୍କ server ମାଗଣାରେ egress, tokens, ଏବଂ third-party API costs ବୋହିବାକୁ ଲାଗେ। 402 Payment Required pattern ଏଠାରେ ସଠିକ୍ ମେଳ ଖାଏ। requirePayment hosted checkout URL ସହିତ structured x402 challenge mint କରେ; tool unpaid ଥିଲେ ଆପଣ ଏହାକୁ ଫେରାନ୍ତି ଏବଂ payment settle ହେଲେ call କୁ ଚାଲିଯିବାକୁ ଦିଅନ୍ତି। x402 କଥା କହୁଥିବା clients ସ୍ୱୟଂଚାଳିତ ଭାବରେ pay କରନ୍ତି; ଅନ୍ୟମାନଙ୍କ ପାଇଁ URL କୁ human ନିକଟରେ ଦେଖାଯାଏ।

SERVER ଚଲାନ୍ତୁ

ଏହାକୁ ଚାଲାଇବାରେ ଦୁଇଟି ଉପାୟ। ହୋଷ୍ଟ କରାଯାଇଥିବା ଏକ ପାଇଁ କୌଣସି ସ୍ଥାପନ ନାହିଁ।

npx ସହ stdio ମାଧ୍ୟମରେ ଏହାକୁ ସ୍ଥାନୀୟଭାବେ ଚଳାନ୍ତୁ (ଆପଣଙ୍କ key ଆପଣଙ୍କ machine ରେ ରହେ), କିମ୍ବା ଯେକୌଣସି MCP host କୁ hosted Streamable HTTP URL ଉପରେ point କରନ୍ତୁ ଏବଂ key କୁ Bearer token ଭାବେ ପାସ୍ କରନ୍ତୁ। ଦୁଇଟି ମଧ୍ୟ host ର MCP config ଭିତରେ ସିଧାସଳଖ ଯାଇପଡ଼େ। ସ୍ଥାନୀୟ path ପାଇଁ Node 20+ ଆବଶ୍ୟକ।

LOCAL - STDIO (npx)
{
  "mcpServers": {
    "blockchain0x": {
      "command": "npx",
      "args": ["-y", "@blockchain0x/mcp"],
      "env": {
        "BLOCKCHAIN0X_API_KEY": "sk_live_...",
        "BLOCKCHAIN0X_API_BASE_URL": "https://api.blockchain0x.com"
      }
    }
  }
}
HOSTED - STREAMABLE HTTP
{
  "mcpServers": {
    "blockchain0x": {
      "url": "https://mcp.blockchain0x.com/mcp",
      "headers": { "Authorization": "Bearer sk_live_..." }
    }
  }
}

BLOCKCHAIN0X_API_KEY ହେଉଛି ଆପଣଙ୍କ dashboard ରୁ ମିଳୁଥିବା sk_test_ testnet କିମ୍ବା sk_live_ mainnet key; BLOCKCHAIN0X_API_BASE_URL ର default https://api.blockchain0x.com। server ଆପଣଙ୍କ key କୁ backend କୁ ପଠାଏ ଏବଂ କିଛି ସଞ୍ଚୟ କରେନାହିଁ, ସେଥିପାଇଁ ସେଇ key ର scope ଏବଂ caps ହିଁ agent କ’ଣ କରିପାରିବ ତାହା ନିର୍ଦ୍ଧାରଣ କରେ। ଏହା ପ୍ରଦର୍ଶନ କରୁଥିବା ପାଞ୍ଚଟି tools: get_wallet, list_wallets, get_transaction, send_payment, ଏବଂ settle_payment_request।

ଆପଣଙ୍କର ନିଜ ଟୁଲ୍ ମୂଲ୍ୟ ନିର୍ଦ୍ଧାରଣ କରନ୍ତୁ

ଗେଟ୍ ଏକ ଟୁଲ୍ ସହିତ ଆସଲ requirePayment ବିଲ୍ଡର୍।

requirePayment @blockchain0x/mcp ର ଗୋଟିଏ pure function। ଯେତେବେଳେ tool unpaid ଥାଏ ଆପଣ ଏହାକୁ call କରନ୍ତି, ଏହା ଗୋଟିଏ x402 402 challenge (price, ଆପଣଙ୍କ wallet, ଗୋଟିଏ hosted checkout URL) ସୃଷ୍ଟି କରେ, ଏବଂ ଆପଣ ସେ body କୁ standard MCP error shape ରେ ଫେରାନ୍ତୁ। ଏହା ଆପଣଙ୍କ handler କୁ wrap କରେ ନାହିଁ ଏବଂ କିଏ pay କଲା ତାହା track କରେ ନାହିଁ - ସେ ଅଂଶ ଆପଣଙ୍କ, ଯାହା helper କୁ ଛୋଟ ଏବଂ ସତ୍ୟନିଷ୍ଠ ରଖେ।

SERVER.TS
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { requirePayment } from "@blockchain0x/mcp";
import { z } from "zod";

const server = new McpServer({ name: "docs-search-mcp", version: "1.0.0" });

server.tool(
  "search_docs",
  "Semantic search across our private docs",
  { query: z.string() },
  async ({ query }, extra) => {
    if (!hasPaid(extra)) {
      // Mint an x402 402 challenge and hand it back to the caller.
      const { body } = requirePayment({
        amountUsdc: "0.10",
        payTo: "0xYourWallet",
        hostedUrl: "https://pay.blockchain0x.com/checkout/abc",
      });
      return { content: [{ type: "text", text: JSON.stringify(body) }], isError: true };
    }
    const results = await runVectorSearch(query);
    return { content: [{ type: "text", text: JSON.stringify(results) }] };
  },
);

agent search_docs unpaid call କଲେ, ଏହା 402 body ପାଏ। x402 କଥା କହୁଥିବା clients ଏହାକୁ ସ୍ୱୟଂଚାଳିତ ଭାବେ ଦେଇଦେଉଛନ୍ତି; Claude Desktop ଏବଂ Cursor ଏକ human ପାଇଁ checkout URL surface କରନ୍ତି। ପେମେଣ୍ଟ ସେଟଲ୍ ହେଲେ ଆପଣ ସେ caller paid ବୋଲି ଚିହ୍ନଟ କରନ୍ତୁ (ପରବର୍ତ୍ତୀ ଅଂଶ) ଏବଂ call ଚାଲିଯାଏ। MCP ର ଠାରୁ plain HTTP server ଭଲ ଲାଗୁଛି? receive-side x402 adapter - Express ପାଇଁ createX402Middleware, Fastify ପାଇଁ createX402Plugin - framework layer ରେ ସେଇ gating କରେ।

ଦେୟ ନିଶ୍ଚୟ କରନ୍ତୁ

Webhook ଆସିଲେ caller କୁ paid ଭାବରେ ଚିହ୍ନଟ କରନ୍ତୁ।

ପେମେଣ୍ଟ ସେଟଲ୍ ହେଲେ, Blockchain0x ଆପଣଙ୍କ webhook URL କୁ signed payment.received event POST କରେ। Node SDK ର webhooks.verify ସହିତ ଏହାକୁ verify କରନ୍ତୁ, ତାପରେ caller paid ବୋଲି ଆପଣ ଯେଉଁ store ପୂର୍ବରୁ ଚଳାଉଛନ୍ତି ସେଠାରେ record କରନ୍ତୁ। କନଫିଗର୍ କରିବାକୁ shipped receipt cache କିଛି ନାହିଁ - ସେ ଅଂଶଟି ଆପଣଙ୍କ, ଯାହାର ଅର୍ଥ surprise infrastructure ନାହିଁ।

ୱେବ୍‌ହୁକ୍.TS
import express from "express";
import { webhooks } from "@blockchain0x/node";

const app = express();
// Capture the RAW body. The HMAC is over the exact bytes on the wire.
app.use(express.raw({ type: "application/json" }));

app.post("/webhooks/payment", (req, res) => {
  const result = webhooks.verify({
    headers: req.headers,
    rawBody: req.body, // Buffer, raw bytes
    secret: process.env.BLOCKCHAIN0X_WEBHOOK_SECRET!,
  });
  if (!result.ok) return res.status(400).json({ code: result.code });

  if (result.eventType === "payment.received") {
    // Mark this payer paid however you like - a DB row, a Redis key, your call.
    markPaid(result.eventId);
  }
  res.status(200).send("ok");
});

webhooks.verify constant time ରେ HMAC-SHA256 କରେ ଏବଂ discriminated union ଫେରାଏ, ସେଥିପାଇଁ ଆପଣ try/catch ବିନା result.ok ଉପରେ branch କରନ୍ତୁ। raw body ପଢ଼ନ୍ତୁ, parsed copy ନୁହେଁ, କାରଣ signature ସଠିକ bytes କୁ ଆବରଣ କରେ। shipped events ହେଉଛି payment.received, payment.sent, wallet.deployed, ଏବଂ webhook.test; ଆପଣଙ୍କ wallet କୁ ହେଉଥିବା payment ହେଉଛି payment.received। 'this caller paid' କୁ କେଉଁଠି persist କରିବେ - database row, Redis key, single process ପାଇଁ in-memory map - ସେଟି ଆପଣଙ୍କ ଇଚ୍ଛା।

ସୋର୍ସ ଏବଂ ଡକ୍ସ

serverଟି open ଏବଂ stateless। ଏହାକୁ ପଢ଼ନ୍ତୁ।

MCP server ଏବଂ requirePayment builder Node SDK ଉପରେ ଏକ thin pass-through ଅଟେ, ଯେଉଁଥିରେ କୌଣସି database କିମ୍ବା volumes ନାହିଁ, ସେହିପରି audit କରିବାକୁ ଅଧିକ କିଛି ନାହିଁ - ଏହାই point। Native MCP OAuth 2.1 ଏକ planned follow-up; pasted-key path ପ୍ରଥମେ ship ହୁଏ କାରଣ ଏହା existing API-key trust model କୁ reuse କରେ।

github.com/tosh-labs/blockchain0x-node

Full tool list, scopes, ଏବଂ hosted environment URLs the docs ରେ documented ଅଛି। ପ୍ରକୃତ key point କରିବା ପୂର୍ବରୁ testing ପାଇଁ production ସହିତ staging ଏବଂ dev hosted endpoints ମଧ୍ୟ ଅଛି।

ସାଧାରଣ ବିପଦ

MCP-ନିର୍ଦ୍ଦିଷ୍ଟ ଜାଲକୁ ଏଡାଇବାକୁ ପାଞ୍ଚ ଜାଲ।

ଏହାଗୁଡିକ ଦେଖାଯାଇଛି ଯେଉଁଥିରେ ପ୍ରଯୋଜନାରେ ପ୍ରଦାନ କରାଯାଇଥିବା MCP ସର୍ଭର ଚାଳନା କରୁଥିବା ଓପରେଟରଙ୍କରୁ ଆସିଛି। ଅଧିକାଂଶ କ୍ୟାସ୍ ଆର୍କିଟେକ୍ଚର ଏବଂ MCP ପ୍ରୋଟୋକଲର ବିଶେଷ ତ୍ରୁଟି ଫର୍ମାଟ ସହିତ ସମ୍ପର୍କିତ।

PITFALL 1

requirePayment ଗୋଟିଏ builder, middleware ନୁହେଁ

requirePayment ଗୋଟିଏ pure function: ଆପଣ ଏହାକୁ call କରନ୍ତି, ଏହା { status: 402, body } ଫେରାଏ, ଏବଂ tool unpaid ଥିଲେ ଆପଣ ସେ body କୁ ଫେରାନ୍ତୁ। ଏହା ଆପଣଙ୍କ handler କୁ wrap କରେ ନାହିଁ, କିଏ pay କଲା ତାହା track କରେ ନାହିଁ, ଏବଂ କୌଣସି reason କିମ୍ବା cache-window options ନେଇନାହିଁ - କେବଳ amountUsdc, payTo, hostedUrl, ଏବଂ ଏକ ଐଚ୍ଛିକ network ଏବଂ description। payment state track କରିବା ଆପଣଙ୍କ କାମ: ଆପଣଙ୍କ database ରେ ଗୋଟିଏ row, ନିଜ Redis ରେ ଗୋଟିଏ key, ଯାହା ଖାପ ଖାଏ ସେହିଟି। Blockchain0x challenge builder ଏବଂ settlement webhook ପ୍ରଦାନ କରେ, receipt cache ନୁହେଁ।

PITFALL 2

stdio ଆପଣଙ୍କ key କୁ ଆପଣଙ୍କ machine ରେ ରଖିଥାଏ

npx ଏବଂ environment ଭିତରେ BLOCKCHAIN0X_API_KEY ସହ server କୁ ଚଳାନ୍ତୁ, ଏବଂ key କେବେ ମଧ୍ୟ ଆପଣଙ୍କ box ଛାଡ଼େ ନାହିଁ - ଏହା local ଭାବରେ ପଢ଼ାଯାଏ, network header ଭାବେ ପଠାଯାଏ ନାହିଁ। Hosted URL ହେଉଛି ଉଲ୍ଟା trade: install ଶୂନ୍ୟ, କିନ୍ତୁ ଆପଣ key କୁ Bearer token ଭାବେ mcp.blockchain0x.com କୁ paste କରନ୍ତି। ଡେଭେଲପର ଙ୍କ ନିଜ machine ପାଇଁ stdio ବାଛନ୍ତୁ, shared deployment ପାଇଁ hosted ବାଛନ୍ତୁ।

PITFALL 3

ଡ୍ୟାସ୍‌ବୋର୍ଡ-ମାତ୍ର ସର୍ଫେସ୍ ଖୋଲା ନୁହେଁ

serverଟି @blockchain0x/node ଉପରେ ଏକ ସଂକୀର୍ଣ୍ଣ, stateless proxy। ଏହା ସଠିକ୍ ପାଞ୍ଚଟି tool surface କରେ: get_wallet, list_wallets, get_transaction, send_payment, settle_payment_request। Identity changes, API-key ଏବଂ webhook CRUD, withdrawals, ଏବଂ billing କୁ API-key auth ତଳେ କଠୋରଭାବେ ଅବରୋଧ କରାଯାଇଛି ଏବଂ server କେବେ ମଧ୍ୟ SDK ପାର୍ ହୋଇ ସେଠାକୁ ଯାଏ ନାହିଁ। ସେହିଗୁଡ଼ିକ ପାଇଁ tool ଆଶା କରନ୍ତୁ ନାହିଁ - ସେମାନେ ଡିଜାଇନ୍ ଅନୁସାରେ dashboard ରେ ଅଛନ୍ତି।

PITFALL 4

send_payment idempotent ଅଟେ ଏବଂ retry କରେ ନାହିଁ

The send_payment tool wraps payments.create: it auto-mints an Idempotency-Key so a retried call collapses to one transfer, and it does not retry on its own. It can also answer 503 until the chain adapter is wired for your network. If the model gets a 503, do not let it hammer the tool - surface the state and move on. amountWei is USDC base units (6 decimals), so 0.01 USDC is the string "10000".

PITFALL 5

requirePayment ରେ amountUsdc ହେଉଛି 6-decimal string

requirePayment validates amountUsdc as a USDC decimal with at most six fractional digits, so "0.10" is fine and "0.1234567" throws. payTo and hostedUrl are required; network defaults to mainnet. Keep the hostedUrl pointing at a real checkout you control (the pattern is https://pay.blockchain0x.com/checkout/<id>). A malformed amount fails fast rather than minting a broken challenge.

ପ୍ରାୟତଃ ପ୍ରଶ୍ନ

ତିନି MCP-ନିର୍ଦ୍ଦିଷ୍ଟ ପ୍ରଶ୍ନ।

କି ଏହା Claude Desktop, Cursor, ଏବଂ VS Code ସହିତ ବାହାରେ କାମ କରେ?

ହଁ। ସେମାନେ standard MCP hosts। host ର MCP config ରେ blockchain0x server କୁ ଯୋଗ କରନ୍ତୁ - stdio block (npx + env ରେ ଆପଣଙ୍କ key) କିମ୍ବା hosted block (mcp.blockchain0x.com URL + Bearer key) - ଏବଂ ପାଞ୍ଚଟି wallet tools agent ପାଖରେ ଦେଖାଯାଏ। ସେଠାରୁ agent wallet read କରିପାରେ, transaction ଯାଞ୍ଚ କରିପାରେ, USDC payment send କରିପାରେ, କିମ୍ବା x402 invoice settle କରିପାରେ, ସବୁକିଛି ଆପଣଙ୍କ API key ପୂର୍ବରୁ enforce କରୁଥିବା scope, allowance, ଏବଂ caps ମଧ୍ୟରେ।

ସର୍ଭର୍ ସଂଯୋଗ ହେବା ପରେ ଏଜେଣ୍ଟ ବାସ୍ତବରେ କଣ କରିପାରିବ?

ପାଞ୍ଚଟି ଜିନିଷ, ପାଞ୍ଚଟି ଟୁଲ୍ ସହିତ ମେଳ ଖାଇଛି: get_wallet ଏବଂ list_wallets ୱାଲେଟ୍ ମେଟାଡାଟା ପଢନ୍ତି, get_transaction ଏକ ଲେନଦେନର ସ୍ଥିତି ଏବଂ ହ୍ୟାଶ୍ ପୋଲ୍ କରେ, send_payment ଏକ ବାହାର USDC ଭୁଗତାନ କରେ, ଏବଂ settle_payment_request ଏକ x402 ଇନଭଏସ୍ କୁ ଅନ୍-ଚେନ୍ ପ୍ରମାଣ ସହିତ ସେଟଲ୍ କରେ। ଏହା ସମ୍ପୂର୍ଣ୍ଣ ସର୍ଫେସ୍। ସର୍ଭର ଏକ ରାଜ୍ୟହୀନ ପ୍ରକ୍ସୀ: ଏହା କୌଣସି କୀ ଧରେ ନାହିଁ, କିଛି ସଂରକ୍ଷଣ କରେ ନାହିଁ, ଏବଂ ଡ୍ୟାସ୍‌ବୋର୍ଡ-ମାତ୍ର କାର୍ଯ୍ୟଗୁଡିକୁ ଉପଲବ୍ଧ କରିପାରିବ ନାହିଁ, ତେଣୁ ଏକ ଏଜେଣ୍ଟ କୀଗୁଡିକୁ ଘୁରାଇବା, ପରିଚୟ ବଦଳାଇବା, କିମ୍ବା ତାହା ମାଧ୍ୟମରେ ଅବହାର କରିପାରିବ ନାହିଁ।

ମୁଁ କିପରି ଏଜେଣ୍ଟମାନେ ମୋର ନିଜ MCP ଟୁଲ୍ କୁ ଡାକିବାକୁ ଚାର୍ଜ୍ କରିବି?

ବାସ୍ ସେପୋଲିଆରେ @blockchain0x/mcp ଦ୍ୱାରା ନିର୍ୟାତିତ ହେଉଥିବା ମୂଳ requirePayment ସହାୟକ ବ୍ୟବହାର କରନ୍ତୁ। ଯେତେବେଳେ କଲର ଦେୟ ଦେଇନାହିଁ, ତେବେ ଆପଣଙ୍କର ଟୁଲ୍‌ରେ requirePayment({ amountUsdc, payTo, hostedUrl }) କୁ କଲ୍ କରନ୍ତୁ, ଏବଂ ଫଳସ୍ୱରୂପ 402 ଦେହକୁ ଫେରାଇବେ - ଏହା @blockchain0x/x402 ସହିତ ବାୟର୍-ସମ୍ପାଦନା ସହିତ ସମାନ। ଆପଣ ଯେଉଁଠାରେ ଦେୟ ଦିଆଯାଇଛି (payment.received ଉପରେ ଏକ ଓେଭୁକ୍ ଏବଂ ଆପଣଙ୍କର ନିଜର ଷ୍ଟୋର୍), ଏବଂ ଆପଣ ତାଙ୍କୁ ଆହ୍ୱାନ କରିବାକୁ ଦିଅନ୍ତୁ। ଏକ ସାଧାରଣ HTTP ସର୍ଭର ପାଇଁ ଏକ MCP ଏକ ନୁହେଁ, ଗ୍ରହଣ-ପାର୍ଶ୍ୱ x402 ଅଡାପ୍ଟର (Express ପାଇଁ createX402Middleware, Fastify ପାଇଁ createX402Plugin) ଫ୍ରେମ୍ୱର୍କ ତଳରେ ସେହି କାମ କରେ।

ଆପଣଙ୍କର ଏଜେଣ୍ଟକୁ MCP ମାଧ୍ୟମରେ ଏକ ୱାଲେଟ୍ ଦିଅନ୍ତୁ।

ବାଲେଟ୍ ଟୁଲ୍ ସଂଯୋଗ କରିବାକୁ ଗୋଟିଏ କନଫିଗ୍ ବ୍ଲକ୍। ଯେତେବେଳେ ଆପଣ ନିଜ ପାଇଁ ଚାର୍ଜ୍ କରିବାକୁ ଚାହାନ୍ତି, ସେଥିରେ ଏହା ଏକ ଆବଶ୍ୟକତା ନିର୍ମାତା। ଆରମ୍ଭ କରିବାକୁ ମାଗଣା।