Address Validator
भाषा: HI
खाता बनाएँ

AI एजेंटMCP और x402

ऐसा पता सत्यापन जिसका भुगतान आपका AI एजेंट खुद कर सके।

एक MCP टूल, validate_address, और हर कॉल पर x402 भुगतान: आपका एजेंट सेवा को मुफ़्त में खोजता है, Base नेटवर्क पर हर वैलिडेशन के लिए 0.02 USDC देता है, और मानकीकृत पता पाता है। न खाता, न API कुंजी, न किसी इंसान की ज़रूरत।

  • MCP 2025-06-18
  • x402 v1 · v2
  • 0.02 USDC / कॉल
  • USDC · Base

तीन कॉल में

वही सेवा जो HTTP पर है, उस प्रोटोकॉल में जिसे आपका एजेंट पहले से बोलता है।

  1. मुफ़्त में खोजें

    /.well-known/mcp-server कार्ड सर्वर का विवरण देता है। /mcp पर initialize और फिर tools/list मुफ़्त हैं।

  2. ऑफ़र पाएँ

    बिना भुगतान वाला tools/call त्रुटि वाला टूल परिणाम देता है (isError), जिसमें सटीक x402 v2 ऑफ़र होता है: नेटवर्क, USDC टोकन, राशि (20000 इकाइयाँ, यानी 0.02 USDC), गंतव्य।

  3. भुगतान करें, फिर पाएँ

    एजेंट अनुमति (EIP-3009) पर हस्ताक्षर करता है और भुगतान params._meta["x402/payment"] में रखकर कॉल दोबारा भेजता है (या v1 क्लाइंट का X-PAYMENT हेडर)। निपटान के बाद रसीद के साथ नतीजा आता है।

MCP क्लाइंट का कॉन्फ़िगरेशन

{
  "mcpServers": {
    "address-validator": { "url": "https://kder-ai.com/mcp" }
  }
}

टूल को कॉल करना

POST https://kder-ai.com/mcp
{
  "jsonrpc": "2.0", "id": 1, "method": "tools/call",
  "params": {
    "name": "validate_address",
    "arguments": { "address": {
      "street": "1600 Amphitheatre Parkway", "city": "Mountain View",
      "state": "CA", "zip": "94043", "country": "US" } }
  }
}

टूल परिणाम में पढ़ा गया ऑफ़र

"accepts": [{
  "scheme": "exact", "network": "eip155:8453",
  "amount": "20000",
  "asset": "USDC", "payTo": "0x…"
}]

अपने कोड से भुगतान करें

x402 की आधिकारिक लाइब्रेरी ऑफ़र पढ़ती हैं, हस्ताक्षर करती हैं और अपने आप भुगतान करती हैं, x402 v1 और v2 दोनों में। खर्च की सीमा तय करें, फिर API को किसी भी दूसरे API की तरह कॉल करें।

Python · x402 + httpx

# pip install "x402[httpx,evm]"
import asyncio, os
from eth_account import Account
from x402 import x402Client
from x402.http.clients import x402HttpxClient
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client

async def main():
    client = x402Client().set_spend_controls({"max_amount_per_payment": "$0.05"})
    signer = EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"]))
    register_exact_evm_client(client, signer)
    async with x402HttpxClient(client) as http:
        response = await http.post("https://kder-ai.com/validate", json={"address": {
            "street": "1600 Amphitheatre Parkway", "city": "Mountain View",
            "state": "CA", "zip": "94043", "country": "US"}})
        await response.aread()
        print(response.status_code, response.json())

asyncio.run(main())

JavaScript · @x402/fetch

// npm install @x402/fetch @x402/evm viem, then run as an ES module (pay.mjs)
import { x402Client, wrapFetchWithPayment } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
client.setSpendControls({ maxAmountPerPayment: "$0.05" });
client.register("eip155:*", new ExactEvmScheme(privateKeyToAccount(process.env.EVM_PRIVATE_KEY)));

const pay = wrapFetchWithPayment(fetch, client);
const response = await pay("https://kder-ai.com/validate", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ address: {
    street: "1600 Amphitheatre Parkway", city: "Mountain View",
    state: "CA", zip: "94043", country: "US" } }),
});
console.log(response.status, await response.json());

एजेंट को क्या मिलता है

एक JSON जवाब, हमेशा एक ही रूप में।

  • validatedपता पहचाना गया या नहीं
  • standardizedline1, line2, city, state, zip, country
  • latitude · longitudeपते के GPS निर्देशांक
  • deliverabilityresidential, commercial…
  • confidence0 से 1 तक भरोसे का अंक
  • degradedtrue: प्रदाता ने जवाब नहीं दिया, फिर कोशिश करें

एजेंट के लिए x402 क्यों

न खाता बनाना, न कुंजी सँभालना, न सदस्यता: एजेंट ठीक उतना ही भुगतान करता है जितना इस्तेमाल करता है, उसी समय। पहले इस्तेमाल हो चुकी अनुमति अस्वीकार होती है: एक ही भुगतान कभी दो बार नहीं गिना जाता।

जानने योग्य बातें

  • अमेरिका का सत्यापन USPS (DPV) से, फ़्रांस और विदेशी विभागों का राष्ट्रीय पता आधार (BAN) से होता है; बाकी जगह जाँच आंशिक रहती है।
  • degraded का true होना मतलब प्रदाता ने जवाब नहीं दिया: यह गलत पता नहीं है, बाद में फिर कॉल करें।
  • हर IP पते से प्रति सेकंड 10 से ज़्यादा अनुरोध नहीं।
  • पता लॉग में नहीं रखा जाता; नतीजा 30 दिन तक कैश में रहता है ताकि जवाब जल्दी मिले।
  • बिना वॉलेट वाली दुकान वही सेवा API कुंजी और सदस्यता के साथ इस्तेमाल करती है।

अक्सर पूछे जाने वाले सवाल

क्या मेरे एजेंट को खाता बनाना होगा?

नहीं। x402 भुगतान काफ़ी है: न साइन-अप, न API कुंजी।

कौन-सा वॉलेट चाहिए?

ऐसा वॉलेट जिसमें Base नेटवर्क पर USDC हो और जो EIP-3009 अनुमति पर हस्ताक्षर कर सके, जैसे x402 लाइब्रेरी वाले वॉलेट।

खोजने में कितना खर्च आता है?

कुछ नहीं। initialize, tools/list और खोज कार्ड मुफ़्त हैं; सिर्फ़ tools/call का भुगतान होता है, 0.02 USDC।

अगर प्रदाता जवाब न दे तो?

कोई पैसा नहीं कटता: जवाब 503 होता है, साथ में Retry-After, और आपकी अनुमति मान्य रहती है। ऑर्डर न रोकें: थोड़ी देर बाद फिर कॉल करें।

इंटीग्रेशन गाइड कीमतें कीमतों की तुलना

Copy-paste: pay and call validate_address (MCP)

Python, three steps: read the offer (free), sign EIP-3009, send the same tools/call with params._meta["x402/payment"]. The code reads amount, network and payTo from the live offer: nothing is hard-coded.

Python - MCP

# pip install requests eth-account
import os, time, requests
from eth_account import Account

BASE = "https://kder-ai.com"
ARGS = {"address": {"street": "1600 Amphitheatre Parkway", "city": "Mountain View",
                    "state": "CA", "zip": "94043", "country": "US"}}

def mcp(method, params):
    body = {"jsonrpc": "2.0", "id": 1, "method": method, "params": params}
    return requests.post(f"{BASE}/mcp", json=body, timeout=30).json()

# 1) FREE: read the offer. An unpaid tools/call returns result.isError + structuredContent.
offer = mcp("tools/call", {"name": "validate_address", "arguments": ARGS})["result"]["structuredContent"]
accept = offer["accepts"][0]

# 2) SIGN: EIP-3009 TransferWithAuthorization on Base (USDC). Domain comes from the offer.
key = os.environ["EVM_PRIVATE_KEY"]
auth = {"from": Account.from_key(key).address, "to": accept["payTo"],
        "value": accept["amount"], "validAfter": int(time.time()) - 60,
        "validBefore": int(time.time()) + 240, "nonce": "0x" + os.urandom(32).hex()}
typed = {
    "primaryType": "TransferWithAuthorization",
    "domain": {"name": accept["extra"]["name"], "version": accept["extra"]["version"],
               "chainId": 8453, "verifyingContract": accept["asset"]},
    "types": {"EIP712Domain": [{"name": "name", "type": "string"}, {"name": "version", "type": "string"},
                               {"name": "chainId", "type": "uint256"}, {"name": "verifyingContract", "type": "address"}],
              "TransferWithAuthorization": [{"name": "from", "type": "address"}, {"name": "to", "type": "address"},
                                            {"name": "value", "type": "uint256"}, {"name": "validAfter", "type": "uint256"},
                                            {"name": "validBefore", "type": "uint256"}, {"name": "nonce", "type": "bytes32"}]},
    "message": {"from": auth["from"], "to": auth["to"], "value": int(auth["value"]),
                "validAfter": auth["validAfter"], "validBefore": auth["validBefore"], "nonce": auth["nonce"]},
}
signature = Account.sign_typed_data(key, full_message=typed).signature
payment = {"x402Version": 2, "resource": offer["resource"], "accepted": accept,
           "payload": {"signature": "0x" + signature.hex().removeprefix("0x"),
                       "authorization": auth}}

# 3) PAY + CALL: the same tools/call, with the payment in params._meta.
paid = mcp("tools/call", {"name": "validate_address", "arguments": ARGS,
                          "_meta": {"x402/payment": payment}})["result"]
print(paid["structuredContent"])   # validated address; receipt in paid["_meta"]