SDKsTypeScript@t402/mcp

@t402/mcp

Model Context Protocol (MCP) server for AI agent payments with Claude Desktop.

Installation

# Install globally
npm install -g @t402/mcp
 
# Or run directly
npx @t402/mcp

Features

  • 11 tools for AI agents (6 base + 5 WDK wallet tools)
  • Multi-chain support (EVM, TON, TRON, Solana, and more)
  • Demo mode for testing without real transactions
  • Claude Desktop integration
  • WDK wallet management for autonomous agents

MCP Tools

Base Tools (6)

ToolDescription
t402/verifyVerify a payment authorization
t402/settleSettle a verified payment on-chain
t402/supportedList supported networks and schemes
t402/getRequirementsGet payment requirements for a resource
t402/getAllBalancesCheck balances across all supported networks
t402/payExecute stablecoin payment

WDK Tools (5, requires seed phrase)

ToolDescription
wdk/getWalletGet WDK wallet address and info
wdk/getBalancesCheck WDK wallet balances
wdk/transferTransfer tokens from WDK wallet
wdk/swapSwap tokens via WDK
t402/autoPayAutonomously pay for a 402-protected resource

Claude Desktop Setup

Add to your Claude Desktop configuration (claude_desktop_config.json):

{
  "mcpServers": {
    "t402": {
      "command": "npx",
      "args": ["@t402/mcp"],
      "env": {
        "T402_PRIVATE_KEY": "0x...",
        "T402_DEMO_MODE": "true"
      }
    }
  }
}

Configuration Options

Environment VariableDescriptionDefault
T402_PRIVATE_KEYEVM private key for signingRequired (or WDK seed)
T402_WDK_SEED_PHRASEWDK seed phrase (enables 5 WDK tools)Optional
T402_DEMO_MODEEnable demo mode (no real transactions)false
T402_RPC_ETHEREUMCustom Ethereum RPC URLPublic RPC
T402_RPC_BASECustom Base RPC URLPublic RPC
T402_RPC_ARBITRUMCustom Arbitrum RPC URLPublic RPC

Usage Examples

Once configured, you can ask Claude to:

“Check my USDT balance on Arbitrum”

“Send 10 USDT0 to 0x1234… on Base”

“What’s the fee to bridge 100 USDT0 from Arbitrum to Ethereum?”

“Bridge 50 USDT0 from Arbitrum to Ethereum”

Demo Mode

Demo mode simulates transactions without executing them:

T402_DEMO_MODE=true npx @t402/mcp

In demo mode:

  • Balances return mock values
  • Payments return simulated transaction hashes
  • No real blockchain transactions occur

Tool Details

t402/getBalance

Check balance on a specific network.

Input:

{
  "network": "eip155:8453",
  "token": "USDT0"
}

Output:

{
  "balance": "1000000000",
  "formatted": "1000.00 USDT0",
  "network": "eip155:8453"
}

t402/pay

Execute a stablecoin payment.

Input:

{
  "to": "0x...",
  "amount": "1000000",
  "network": "eip155:8453",
  "token": "USDT0"
}

Output:

{
  "txHash": "0x...",
  "amount": "1000000",
  "network": "eip155:8453",
  "status": "confirmed"
}

t402/bridge

Bridge USDT0 between chains.

Input:

{
  "fromChain": "arbitrum",
  "toChain": "ethereum",
  "amount": "100000000",
  "recipient": "0x..."
}

Output:

{
  "txHash": "0x...",
  "messageGuid": "0x...",
  "fromChain": "arbitrum",
  "toChain": "ethereum",
  "estimatedTime": 900
}

Supported Networks

NetworkIDTokens
Ethereumeip155:1USDT0, USDC, USDT
Baseeip155:8453USDT0, USDC
Arbitrumeip155:42161USDT0, USDC
Optimismeip155:10USDT0, USDC
Polygoneip155:137USDC, USDT
Inkeip155:57073USDT0
Berachaineip155:80094USDT0
Unichaineip155:130USDT0

Security Considerations

  • Store private keys securely (use environment variables)
  • Enable demo mode for testing
  • Set spending limits in your application
  • Monitor agent actions and transactions

Programmatic Usage

import { createMcpServer } from '@t402/mcp'
 
const server = createMcpServer({
  privateKey: process.env.PRIVATE_KEY,
  demoMode: process.env.NODE_ENV !== 'production'
})
 
// Use with MCP client
await server.start()