Skip to main content

Overview

Claude Code can interact with the Laso Finance API using an x402-enabled MCP server. The MCP server wraps the x402 payment flow so Claude can call paywalled endpoints like any other tool.

Prerequisites

Setup

1. Install the x402 MCP server

The x402 project provides an MCP server that handles payment signing automatically.
npm install @x402/mcp

2. Configure Claude Code

Add the x402 MCP server to your Claude Code configuration. Create or edit your MCP config file:
{
  "mcpServers": {
    "laso-finance": {
      "command": "npx",
      "args": ["@x402/mcp"],
      "env": {
        "EVM_PRIVATE_KEY": "your-locus-wallet-private-key",
        "RESOURCE_SERVER_URL": "https://laso.finance"
      }
    }
  }
}

3. Use it

Once configured, Claude Code can call Laso Finance endpoints directly. The MCP server handles the x402 payment flow automatically.
Order a $50 prepaid card from Laso Finance and tell me the card details
when they're ready.

How it works

  1. Claude Code calls the MCP server’s tool for the desired endpoint
  2. The MCP server makes an HTTP request to laso.finance
  3. If the server returns 402, the MCP server signs a USDC payment with your wallet
  4. The MCP server retries with the X-PAYMENT header
  5. The response is returned to Claude Code

Example prompts

Use the Laso Finance API to order a $25 prepaid card. Poll for the
card details and give me the card number, expiry, and CVV when ready.
Send $50 to the Venmo account with phone number 5551234567 using the Laso Finance API.
Check the balance on my Laso Finance card with ID O-01ABC123.

Building your own MCP server

If you need custom behavior, you can build an MCP server using @x402/axios:
import { wrapAxios } from "@x402/axios";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";

const account = privateKeyToAccount(process.env.EVM_PRIVATE_KEY as `0x${string}`);
const wallet = createWalletClient({
  account,
  chain: base,
  transport: http(),
});

const client = wrapAxios(axios, wallet);

// Use this client in your MCP tool handlers
const response = await client.get("https://laso.finance/get-card?amount=50");

x402 MCP Example

Full MCP server example from the x402 repository.