CronosMCP Documentation

Build and monetize AI-powered tools with seamless micropayments on the Cronos blockchain.

CronosMCP is a comprehensive platform for AI-native payments on Cronos. We provide the infrastructure for AI agents to autonomously pay for premium tools using the x402 payment protocol, a discovery platform for the Cronos x402 ecosystem, and our own suite of premium APIs for market data and blockchain analytics.

What We Offer

  • Developer SDK: Build and monetize your own paid tools with our TypeScript packages
  • Gasless Transfer Widget: Embed gasless USDC.e transfers in your website
  • x402 Explorer: Discover and browse all x402-enabled tools and services on Cronos
  • Market Data API: Real-time cryptocurrency prices, OHLCV data, order books, and trades
  • Onchain Analytics API: Wallet balances, token holdings, transactions, and contract data
What is x402?

x402 is a payment protocol that uses HTTP 402 status codes to handle micropayments. When a client requests a paid resource without payment, the server responds with payment requirements. The client then signs a payment authorization and retries the request.

Platform Features

  • Micropayments: Enable payments as low as $0.001 with minimal gas fees on Cronos
  • AI-Native: Built for autonomous AI agents using the Model Context Protocol (MCP)
  • Flexible Pricing: Set custom prices per tool, from free to any amount
  • On-Chain Settlement: All payments settled on Cronos blockchain using USDC.e
  • Registry Discovery: Central registry for discovering available tools and services

Quick Start

Get started with CronosMCP in three steps:

Install the SDK

Add the CronosMCP packages to your project.

bash
npm install @cronos-mcp/server-sdk @cronos-mcp/core
Create a Server

Define your tools and their pricing.

typescript
import { createServer } from '@cronos-mcp/server-sdk';

const server = createServer({
  name: 'my-tool-server',
  version: '1.0.0',
  network: 'mainnet',
  payTo: '0xYourWalletAddress',
});

server.addTool({
  name: 'analyze_data',
  description: 'Analyze data and return insights',
  price: '1000', // $0.001 in atomic units
  handler: async (params) => {
    return { result: 'Analysis complete' };
  }
});

server.start(3001);
Register with the Explorer

Make your tools discoverable by registering with the CronosMCP Registry.

typescript
// Auto-registration happens on server start
server.start(3001, {
  registryUrl: 'https://registry.cronosmcp.xyz',
  projectName: 'My Project'
});

Installation

CronosMCP is available as a collection of npm packages. Install the packages you need based on your use case:

For Tool Providers (Servers)

bash
npm install @cronos-mcp/server-sdk @cronos-mcp/core

For AI Agents (Clients)

bash
npm install @cronos-mcp/client-sdk @cronos-mcp/core

All Packages

Package Description
@cronos-mcp/core Types, constants, and network configuration
@cronos-mcp/server-sdk SDK for building paid tool servers
@cronos-mcp/client-sdk SDK for AI agents to call and pay for tools
@cronos-mcp/payment-handler x402 payment verification and settlement

Core Concepts

Payment Flow

CronosMCP uses the x402 protocol to handle payments. Here is how a typical payment flow works:

  1. Client requests a paid tool without a payment header
  2. Server responds with HTTP 402 and payment requirements in the X-Payment header
  3. Client signs an EIP-712 TransferWithAuthorization message
  4. Client retries the request with the signed payment header
  5. Server verifies the signature with the Cronos Facilitator
  6. Server settles the payment on-chain
  7. Server returns the tool result with the transaction hash

Network Support

CronosMCP supports both Cronos testnet and mainnet:

Testnet Cronos Testnet
  • Network IDcronos-testnet
  • Chain ID338
  • TokendevUSDC.e
  • Use CaseDevelopment & Testing
Mainnet Cronos Mainnet
  • Network IDcronos-mainnet
  • Chain ID25
  • TokenUSDC.e
  • Use CaseProduction

Server SDK

The Server SDK enables you to create HTTP servers that expose paid tools. It handles payment verification, settlement, and provides standard endpoints for tool discovery.

Creating a Server

Use the createServer function to initialize your server with configuration:

typescript
import { createServer } from '@cronos-mcp/server-sdk';

const server = createServer({
  name: 'market-data-server',
  version: '1.0.0',
  description: 'Real-time cryptocurrency market data',
  network: process.env.NETWORK || 'testnet',
  payTo: process.env.WALLET_ADDRESS,
});

Configuration Options

Option Type Description
name string Unique identifier for your server
version string Semantic version of your server
description string Human-readable description
network "testnet" | "mainnet" Target Cronos network
payTo string Wallet address to receive payments

Defining Tools

Add tools to your server using the addTool method:

typescript
server.addTool({
  name: 'get_price',
  description: 'Get current price for a trading pair',
  price: '0', // Free tool
  inputSchema: {
    type: 'object',
    properties: {
      symbol: { type: 'string', description: 'Trading pair (e.g., BTC_USD)' }
    },
    required: ['symbol']
  },
  handler: async (params) => {
    const price = await fetchPrice(params.symbol);
    return { price };
  }
});

server.addTool({
  name: 'get_ohlcv',
  description: 'Get OHLCV candlestick data',
  price: '1000', // $0.001 (1000 atomic units)
  inputSchema: {
    type: 'object',
    properties: {
      symbol: { type: 'string' },
      interval: { type: 'string', enum: ['1m', '5m', '1h', '1d'] },
      limit: { type: 'number', default: 100 }
    },
    required: ['symbol']
  },
  handler: async (params) => {
    const data = await fetchOHLCV(params);
    return { candles: data };
  }
});

Pricing Tools

Prices are specified in atomic units of USDC.e (6 decimals). Here are common price points:

USD Amount Atomic Units Code
Free 0 price: '0'
$0.001 1,000 price: '1000'
$0.01 10,000 price: '10000'
$0.10 100,000 price: '100000'
$1.00 1,000,000 price: '1000000'
Price Format

Always specify prices as strings to avoid JavaScript number precision issues with large values.

Server Endpoints

The Server SDK automatically exposes these endpoints:

Method Endpoint Description
GET /health Health check endpoint
GET /info Server metadata and configuration
GET /tools List all available tools with pricing
GET /stats Server statistics for dashboard
POST /tools/:name Execute a specific tool

Client SDK

The Client SDK enables AI agents and applications to discover, call, and pay for tools seamlessly.

Wallet Setup

Initialize a client with your wallet credentials:

typescript
import { CronosMCPClient } from '@cronos-mcp/client-sdk';

const client = new CronosMCPClient({
  network: 'mainnet',
  privateKey: process.env.WALLET_PRIVATE_KEY,
  maxBudget: '100000', // $0.10 max per call
});

Calling Tools

Call a tool on a remote server:

typescript
const result = await client.callTool({
  serverUrl: 'https://market-data.example.com',
  tool: 'get_ohlcv',
  params: {
    symbol: 'BTC_USD',
    interval: '1h',
    limit: 24
  }
});

console.log(result.data);    // Tool response
console.log(result.txHash);  // Payment transaction hash

Handling Payments

The client automatically handles the x402 payment flow. When a tool requires payment:

  1. Client checks if the price is within budget
  2. Client signs the payment authorization
  3. Client retries the request with payment
  4. Client returns the result with transaction details
typescript
try {
  const result = await client.callTool({
    serverUrl: 'https://api.example.com',
    tool: 'expensive_analysis',
    params: { data: '...' }
  });
  
  if (result.paid) {
    console.log(`Paid ${result.amount} USDC.e`);
    console.log(`Tx: ${result.txHash}`);
  }
} catch (error) {
  if (error.code === 'BUDGET_EXCEEDED') {
    console.log('Tool price exceeds budget');
  }
}

Payment Handler

The Payment Handler manages x402 payment verification and settlement with the Cronos Facilitator.

x402 Protocol

The x402 protocol uses HTTP 402 Payment Required responses to negotiate payments:

http
# Initial request (no payment)
POST /tools/get_ohlcv HTTP/1.1
Host: api.example.com
Content-Type: application/json

{"symbol": "BTC_USD"}

# Server response (402)
HTTP/1.1 402 Payment Required
X-Payment: eyJzY2hlbWUiOiJleGFjdCIsIm5ldHdvcmsiOiJjcm9ub3MtbWFpbm5ldCIuLi59

# Retry with payment header
POST /tools/get_ohlcv HTTP/1.1
Host: api.example.com
Content-Type: application/json
X-Payment: eyJ4NDAyVmVyc2lvbiI6MSwic2NoZW1lIjoiZXhhY3QiLi4ufQ==

{"symbol": "BTC_USD"}

# Success response
HTTP/1.1 200 OK
X-Payment-Response: eyJ0eEhhc2giOiIweDEyMzQuLi4ifQ==

{"candles": [...]}

EIP-712 Signing

Payments are authorized using EIP-712 typed signatures for TransferWithAuthorization:

typescript
// โš ๏ธ CRITICAL: Domain params must be EXACT or signature fails!
const domain = {
  name: 'Bridged USDC (Stargate)',  // โœ… EXACT - not 'USD Coin'!
  version: '1',                      // โœ… Must be '1', not '2'
  chainId: 25,                       // Cronos mainnet (338 for testnet)
  verifyingContract: '0xf951eC28187D9E5Ca673Da8FE6757E6f0Be5F77C'
};

const types = {
  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' }
  ]
};

const message = {
  from: '0xPayerAddress',
  to: '0xServerAddress',
  value: '1000',
  validAfter: 0,
  validBefore: Math.floor(Date.now() / 1000) + 300,
  nonce: '0x...' // Random 32 bytes
};

Facilitator API

The Cronos Facilitator handles payment verification and on-chain settlement. A single URL supports both testnet and mainnet - the network is determined by the network field in your payment requirements.

๐Ÿ’ก

Base URL: https://facilitator.cronoslabs.org/v2/x402

Endpoint Method Full URL Description
/healthcheck GET https://facilitator.cronoslabs.org/healthcheck Service health status
/supported GET https://facilitator.cronoslabs.org/v2/x402/supported List supported networks and schemes
/verify POST https://facilitator.cronoslabs.org/v2/x402/verify Validate payment signature
/settle POST https://facilitator.cronoslabs.org/v2/x402/settle Execute on-chain transfer
typescript
const FACILITATOR_URL = 'https://facilitator.cronoslabs.org/v2/x402';

// Verify payment
const verifyResponse = await fetch(`${FACILITATOR_URL}/verify`, {
  method: 'POST',
  headers: { 
    'Content-Type': 'application/json',
    'X402-Version': '1'
  },
  body: JSON.stringify({
    x402Version: 1,
    paymentHeader: encodedPayload,
    paymentRequirements: requirements
  })
});

// Settle payment
const settleResponse = await fetch(`${FACILITATOR_URL}/settle`, {
  method: 'POST',
  headers: { 
    'Content-Type': 'application/json',
    'X402-Version': '1'
  },
  body: JSON.stringify({
    x402Version: 1,
    paymentHeader: encodedPayload,
    paymentRequirements: requirements
  })
});

const result = await settleResponse.json();
// result.event === 'payment.settled' on success
// result.txHash contains the transaction hash
// result.network confirms which network was used

Verify Response

json
// Success
{ "isValid": true, "invalidReason": null }

// Failure
{ "isValid": false, "invalidReason": "Invalid EIP-3009 signature" }

Settle Response

json
// Success
{
  "x402Version": 1,
  "event": "payment.settled",
  "txHash": "0xabc123...",
  "from": "0xPayer...",
  "to": "0xSeller...",
  "value": "1000000",
  "blockNumber": 17352,
  "network": "cronos-mainnet",
  "timestamp": "2025-12-30T12:00:00.000Z"
}

// Failure
{
  "x402Version": 1,
  "event": "payment.failed",
  "network": "cronos-mainnet",
  "error": "Authorization already used"
}

Common Error Reasons

Error Cause
Invalid EIP-3009 signature Wrong domain params (name/version) or signing error
Unsupported network Network must be "cronos-testnet" or "cronos-mainnet"
Authorization already used Duplicate nonce - transaction already executed
Authorization expired validBefore timestamp has passed
ERC20: transfer amount exceeds balance Insufficient USDC.e balance

Registry API

The CronosMCP Registry provides centralized discovery of available tools and services. Servers can register automatically on startup or manually through the web interface.

Server Registration

Register your server to make it discoverable:

Automatic Registration

typescript
server.start(3001, {
  registryUrl: 'https://registry.cronosmcp.xyz',
  projectName: 'Market Data Tools',
  ownerAddress: '0xYourWalletAddress'
});

Manual Registration

http
POST /api/servers HTTP/1.1
Host: registry.cronosmcp.xyz
Content-Type: application/json

{
  "name": "market-data-server",
  "url": "https://api.example.com",
  "description": "Real-time crypto market data",
  "network": "cronos-mainnet",
  "projectName": "Market Data Tools",
  "ownerAddress": "0xYourWalletAddress",
  "tools": [
    {
      "name": "get_price",
      "description": "Get current price",
      "price": "0"
    },
    {
      "name": "get_ohlcv",
      "description": "Get OHLCV data",
      "price": "1000"
    }
  ]
}

Tool Discovery

Query the registry to discover available tools:

typescript
// List all servers
const response = await fetch('https://registry.cronosmcp.xyz/api/servers');
const servers = await response.json();

// Filter by network
const mainnetServers = servers.filter(s => s.network === 'cronos-mainnet');

// Find tools by name
const ohlcvTools = servers
  .flatMap(s => s.tools)
  .filter(t => t.name.includes('ohlcv'));

API Endpoints

API Playground Interactive
Request
Query Parameters
Response
200 OK 142ms
{ "servers": [ { "id": "mkt-001", "name": "market-data-server", "url": "https://market.cronosmcp.xyz", "network": "cronos-mainnet", "projectName": "Market Data Tools", "tools": [ { "name": "get_price", "price": "0" }, { "name": "get_ohlcv", "price": "1000" } ] } ] }
Method Endpoint Description
GET /api/servers List all registered servers
GET /api/servers/:id Get server details by ID
POST /api/servers Register a new server
PUT /api/servers/:id Update server registration
DELETE /api/servers/:id Remove server from registry

Market Data API

CronosMCP provides a comprehensive Market Data API for accessing real-time cryptocurrency prices, historical OHLCV data, order books, and recent trades. Data is sourced from the Crypto.com Exchange.

Base URL

All Market Data endpoints are available at https://market.cronosmcp.xyz

Endpoints Overview

Tool Description Price
get_price Get current price for a trading pair Free
get_ohlcv Get OHLCV candlestick data $0.001
get_orderbook Get order book depth $0.002
get_trades Get recent trades $0.001

Get Price

Retrieve the current price for a trading pair. This endpoint is free to use.

Parameter Type Required Description
symbol string Yes Trading pair (e.g., BTC_USD, ETH_USDT, CRO_USD)
bash
curl -X POST https://market.cronosmcp.xyz/tools/get_price \
  -H "Content-Type: application/json" \
  -d '{"symbol": "BTC_USD"}'
json
{
  "symbol": "BTC_USD",
  "price": "94250.50",
  "bid": "94248.00",
  "ask": "94253.00",
  "volume_24h": "12543.82",
  "change_24h": "-1.25",
  "timestamp": 1735570422428
}

Get OHLCV

Retrieve historical OHLCV (Open, High, Low, Close, Volume) candlestick data. Requires payment of $0.001 per request.

Parameter Type Required Description
symbol string Yes Trading pair (e.g., BTC_USD)
interval string No Candle interval: 1m, 5m, 15m, 30m, 1h, 4h, 1d (default: 1h)
limit number No Number of candles to return (default: 100, max: 1000)
bash
curl -X POST https://market.cronosmcp.xyz/tools/get_ohlcv \
  -H "Content-Type: application/json" \
  -H "X-Payment: <payment_header>" \
  -d '{"symbol": "BTC_USD", "interval": "1h", "limit": 24}'
json
{
  "symbol": "BTC_USD",
  "interval": "1h",
  "candles": [
    {
      "timestamp": 1735567200000,
      "open": "94100.00",
      "high": "94500.00",
      "low": "94050.00",
      "close": "94250.50",
      "volume": "523.45"
    },
    ...
  ]
}

Get Order Book

Retrieve the current order book depth for a trading pair. Requires payment of $0.002 per request.

Parameter Type Required Description
symbol string Yes Trading pair (e.g., BTC_USD)
depth number No Number of price levels (default: 20, max: 100)
bash
curl -X POST https://market.cronosmcp.xyz/tools/get_orderbook \
  -H "Content-Type: application/json" \
  -H "X-Payment: <payment_header>" \
  -d '{"symbol": "BTC_USD", "depth": 10}'
json
{
  "symbol": "BTC_USD",
  "bids": [
    ["94248.00", "2.500"],
    ["94247.00", "1.250"],
    ...
  ],
  "asks": [
    ["94253.00", "1.800"],
    ["94254.00", "3.200"],
    ...
  ],
  "timestamp": 1735570422428
}

Get Trades

Retrieve recent trades for a trading pair. Requires payment of $0.001 per request.

Parameter Type Required Description
symbol string Yes Trading pair (e.g., BTC_USD)
limit number No Number of trades to return (default: 50, max: 500)
bash
curl -X POST https://market.cronosmcp.xyz/tools/get_trades \
  -H "Content-Type: application/json" \
  -H "X-Payment: <payment_header>" \
  -d '{"symbol": "BTC_USD", "limit": 20}'
json
{
  "symbol": "BTC_USD",
  "trades": [
    {
      "id": "T123456789",
      "price": "94250.50",
      "quantity": "0.125",
      "side": "buy",
      "timestamp": 1735570422000
    },
    ...
  ]
}

Onchain Analytics API

CronosMCP provides an Onchain Analytics API for querying blockchain data on the Cronos network, including wallet balances, token holdings, transaction history, and smart contract information.

Base URL

All Onchain Analytics endpoints are available at https://onchain.cronosmcp.xyz

Endpoints Overview

Tool Description Price
get_balance Get native CRO balance for an address Free
get_token_balance Get ERC20 token balance $0.001
get_transactions Get recent transactions for an address $0.002
get_contract_info Get smart contract metadata $0.001

Get Balance

Retrieve the native CRO balance for a wallet address. This endpoint is free to use.

Parameter Type Required Description
address string Yes Wallet address (0x...)
bash
curl -X POST https://onchain.cronosmcp.xyz/tools/get_balance \
  -H "Content-Type: application/json" \
  -d '{"address": "0xa7d5e0EA07DCd2b30Fc87719D15Df92a40791150"}'
json
{
  "address": "0xa7d5e0EA07DCd2b30Fc87719D15Df92a40791150",
  "balance": "1250.456789",
  "symbol": "CRO",
  "network": "cronos-mainnet"
}

Get Token Balance

Retrieve the ERC20 token balance for a wallet address. Requires payment of $0.001 per request.

Parameter Type Required Description
address string Yes Wallet address (0x...)
token string Yes Token contract address (0x...)
bash
curl -X POST https://onchain.cronosmcp.xyz/tools/get_token_balance \
  -H "Content-Type: application/json" \
  -H "X-Payment: <payment_header>" \
  -d '{
    "address": "0xa7d5e0EA07DCd2b30Fc87719D15Df92a40791150",
    "token": "0xf951eC28187D9E5Ca673Da8FE6757E6f0Be5F77C"
  }'
json
{
  "address": "0xa7d5e0EA07DCd2b30Fc87719D15Df92a40791150",
  "token": {
    "address": "0xf951eC28187D9E5Ca673Da8FE6757E6f0Be5F77C",
    "name": "USD Coin",
    "symbol": "USDC.e",
    "decimals": 6
  },
  "balance": "5000.000000",
  "network": "cronos-mainnet"
}

Get Transactions

Retrieve recent transactions for a wallet address. Requires payment of $0.002 per request.

Parameter Type Required Description
address string Yes Wallet address (0x...)
limit number No Number of transactions (default: 20, max: 100)
bash
curl -X POST https://onchain.cronosmcp.xyz/tools/get_transactions \
  -H "Content-Type: application/json" \
  -H "X-Payment: <payment_header>" \
  -d '{"address": "0xa7d5e0EA07DCd2b30Fc87719D15Df92a40791150", "limit": 10}'
json
{
  "address": "0xa7d5e0EA07DCd2b30Fc87719D15Df92a40791150",
  "transactions": [
    {
      "hash": "0x082adcfd2e6110ad03f3d290c4bb63260cd48d0ae9d5e2640567312cca7f2fad",
      "blockNumber": 65144507,
      "from": "0xa7d5e0EA07DCd2b30Fc87719D15Df92a40791150",
      "to": "0xf951eC28187D9E5Ca673Da8FE6757E6f0Be5F77C",
      "value": "0",
      "gasUsed": "65000",
      "status": "success",
      "timestamp": 1735570438000
    },
    ...
  ],
  "network": "cronos-mainnet"
}

Get Contract Info

Retrieve metadata and information about a smart contract. Requires payment of $0.001 per request.

Parameter Type Required Description
address string Yes Contract address (0x...)
bash
curl -X POST https://onchain.cronosmcp.xyz/tools/get_contract_info \
  -H "Content-Type: application/json" \
  -H "X-Payment: <payment_header>" \
  -d '{"address": "0xf951eC28187D9E5Ca673Da8FE6757E6f0Be5F77C"}'
json
{
  "address": "0xf951eC28187D9E5Ca673Da8FE6757E6f0Be5F77C",
  "name": "USD Coin",
  "symbol": "USDC.e",
  "decimals": 6,
  "type": "ERC20",
  "totalSupply": "1500000000.000000",
  "verified": true,
  "network": "cronos-mainnet"
}

Gasless Transfer Widget

CronosMCP includes a gasless USDC.e transfer widget that you can embed in your website. Users can send USDC.e without paying gas fees - powered by the x402 protocol.

Try it now! Click the "โ›ฝ Gasless Transfer" button in the header to see the widget in action.

Features

  • Zero Gas Fees: Users sign a message, not a transaction - no CRO needed
  • Network Support: Works on both Cronos testnet and mainnet
  • Wallet Integration: Connects to MetaMask and other Web3 wallets
  • Real-time Balance: Shows user's USDC.e balance
  • Quick Amounts: Pre-set amounts for faster transfers

How It Works

The widget uses EIP-3009 (transferWithAuthorization) to enable gasless transfers:

  1. User connects their wallet
  2. User enters recipient and amount
  3. User signs an EIP-712 typed message (no gas!)
  4. The x402 Facilitator executes the transfer on-chain
  5. USDC.e is transferred to the recipient

Embed in Your Website

You can embed the gasless transfer widget in your own website:

html
<!-- Option 1: Link to standalone page -->
<a href="https://cronosmcp.com/transfer.html" target="_blank">
  โ›ฝ Gasless Transfer
</a>

<!-- Option 2: Embed as iframe -->
<iframe
  src="https://cronosmcp.com/transfer.html"
  width="420"
  height="600"
  frameborder="0"
></iframe>

Network Configuration

The widget supports both networks with the following USDC.e addresses:

Testnet
Chain ID: 338
USDC.e: 0xc01efAaF7C5C61bEbFAeb358E1161b537b8bC0e0
RPC: https://evm-t3.cronos.org
Mainnet
Chain ID: 25
USDC.e: 0xf951eC28187D9E5Ca673Da8FE6757E6f0Be5F77C
RPC: https://evm.cronos.org

Payment Dashboard

The CronosMCP Dashboard provides real-time visibility into your x402 payment activity.

Features

  • Payment History: View all payments received by your server
  • Real-time Updates: Live transaction feed with auto-refresh
  • Analytics: Track revenue, popular tools, and usage patterns
  • Network Filtering: Filter by testnet or mainnet

Accessing the Dashboard

The dashboard is available at https://cronosmcp.com/dashboard after registering your server.

bash
# Run the dashboard locally
cd apps/dashboard
npm install
npm run dev

# Open http://localhost:3000

Deployment

Deploy your x402-enabled server to production.

Environment Variables

Set these environment variables for your server:

.env
# Required
WALLET_ADDRESS=0xYourWalletAddress

# Optional
NETWORK=mainnet  # or testnet
PORT=3000

Deploy to Vercel

bash
# Install Vercel CLI
npm i -g vercel

# Deploy
vercel --prod

Deploy to Railway

bash
# Install Railway CLI
npm i -g @railway/cli

# Login and deploy
railway login
railway init
railway up

Register Your Server

After deployment, register your server to appear in the x402 Explorer:

    cronosmcp.com/register
  1. Enter your server URL, name, and wallet address
  2. Your tools will be discoverable by AI agents

Network Configuration

Complete network configuration for Cronos testnet and mainnet:

typescript
export const TESTNET_CONFIG = {
  networkId: 'cronos-testnet',
  chainId: 338,
  chainIdHex: '0x152',
  rpcUrl: 'https://evm-t3.cronos.org',
  blockExplorer: 'https://explorer.cronos.org/testnet',
  facilitatorUrl: 'https://facilitator.cronoslabs.org',
  usdc: {
    address: '0xc01efAaF7C5C61bEbFAeb358E1161b537b8bC0e0',
    name: 'USDC',
    version: '2',
    decimals: 6
  }
};
typescript
export const MAINNET_CONFIG = {
  networkId: 'cronos-mainnet',
  chainId: 25,
  chainIdHex: '0x19',
  rpcUrl: 'https://evm.cronos.org',
  blockExplorer: 'https://explorer.cronos.org',
  facilitatorUrl: 'https://facilitator.cronoslabs.org',
  usdc: {
    address: '0xf951eC28187D9E5Ca673Da8FE6757E6f0Be5F77C',
    name: 'USD Coin',
    version: '2',
    decimals: 6
  }
};

Type Definitions

Core TypeScript types used throughout the SDK:

typescript
// Network type
type Network = 'cronos-mainnet' | 'cronos-testnet';

// Payment requirements returned in 402 response
interface PaymentRequirements {
  scheme: 'exact';
  network: Network;
  maxAmountRequired: string;
  resource: string;
  description: string;
  payTo: string;
  maxTimeoutSeconds: number;
  asset: string;
}

// Payment payload sent by client
interface PaymentPayload {
  x402Version: number;
  scheme: 'exact';
  network: string;
  payload: {
    from: string;
    to: string;
    value: string;
    validAfter: number;
    validBefore: number;
    nonce: string;
    signature: string;
    asset: string;
  };
}

// Tool definition
interface MCPTool {
  name: string;
  description: string;
  price: string;
  inputSchema?: JSONSchema;
}

// Server registration
interface ServerRegistration {
  name: string;
  url: string;
  description: string;
  network: Network;
  projectName?: string;
  ownerAddress: string;
  tools: MCPTool[];
}

Error Codes

Code Name Description
PAYMENT_REQUIRED Payment Required Tool requires payment. Check X-Payment header for requirements.
INVALID_SIGNATURE Invalid Signature Payment signature verification failed.
INSUFFICIENT_FUNDS Insufficient Funds Payer wallet has insufficient USDC.e balance.
BUDGET_EXCEEDED Budget Exceeded Tool price exceeds client configured budget.
SETTLEMENT_FAILED Settlement Failed On-chain payment settlement failed.
TOOL_NOT_FOUND Tool Not Found Requested tool does not exist on server.
NETWORK_MISMATCH Network Mismatch Client and server are on different networks.