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

  • 6 payment tools for AI agents
  • Multi-chain support (EVM, TON, TRON)
  • Demo mode for testing without real transactions
  • Claude Desktop integration

MCP Tools

ToolDescription
t402/getBalanceCheck wallet balance on a specific network
t402/getAllBalancesCheck balances across all supported networks
t402/payExecute stablecoin payment
t402/payGaslessExecute gasless payment (ERC-4337)
t402/getBridgeFeeGet fee quote for cross-chain bridge
t402/bridgeBridge USDT0 between chains

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
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:80084USDT0
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()