Agents
🤖 AI Agents Integration
Integrate Latch MCP with AI agents to enable autonomous, on-chain API payments. This allows AI assistants to discover, price, and pay for API calls automatically via the x402 protocol — no API keys or subscriptions required.
🌐 MCP Endpoint
MCP URL:
https://x402.latchmcp.app/mcp
Each connected agent automatically receives:
🪙 A wallet capable of signing and paying for API calls
🔍 A semantic discovery engine to find available paid tools
💸 A payment layer implementing x402 pay → verify → retry logic
🧠 Integrate with Popular AI Clients
Latch MCP works natively with any MCP-compatible environment, including:
ChatGPT (via custom MCPs)
Claude Desktop
Claude Code
Cursor
Windsurf
And other OpenAI MCP clients
Install Latch MCP in ChatGPT
Open ChatGPT → Settings → Apps & Connectors (Enable Developer Mode under Advanced Settings if not visible)
Click Create
Enter the MCP name:
LatchMCP URL:
https://x402.latchmcp.app/mcpClick Save, then complete the authentication flow using your wallet or Latch key.
Your ChatGPT instance can now call paid APIs directly through Latch — automatically handling the 402 payment negotiation behind the scenes.
🧩 Using Latch with Your Own AI Agent
If you’re building a custom agent or framework, you can integrate Latch MCP as a remote MCP server.
Prerequisites
Create an agent wallet from the Latch Console.
Retrieve your wallet secret.
Integration Example
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
const mcpClient = await createMCPClient({
  transport: new StreamableHTTPClientTransport(
    new URL("https://x402.latchmcp.app/mcp"),
    {
      requestInit: {
        headers: {
          Authorization: `Bearer <YOUR_WALLET_SECRET>`,
        },
      },
    },
  ),
});
// Example: integrating paid tools into an AI model call
const response = await generateText({
  model: openai("gpt-4o"),
  tools: await mcpClient.tools(),
  prompt: "Analyze and summarize the latest Solana validator performance reports.",
});🔗 Why It Matters
By integrating Latch MCP, AI agents can:
Autonomously purchase access to APIs, data, and computation
Pay on-chain in real time using stablecoins or native tokens
Maintain transparent, verifiable usage logs through x402 receipts
This enables the next generation of autonomous AI economies, where tools, agents, and users transact natively on-chain.
Last updated
