Skip to main content
Glama
pay-mcp
by MonadWorks

Pay-MCP πŸ’Έ

MCP server for USDC payments on Base β€” Enable any Claude Code agent to send and receive payments.


🎯 Overview

Pay-MCP is a Model Context Protocol (MCP) server that wraps USDC payment capabilities on the Base blockchain. It allows AI agents (like Claude Code) to:

  • πŸ’° Check USDC balances β€” Query any wallet's USDC balance

  • πŸ“€ Send USDC payments β€” Transfer USDC to any address

  • πŸ“₯ Generate payment requests β€” Create payment links with deep linking support

  • πŸ“œ View transaction history β€” List recent sent/received transfers


Related MCP server: @true402.dev/mcp-server

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         Your Computer                           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     stdio      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚   Claude Code   │◄──────────────►│      Pay-MCP         β”‚   β”‚
β”‚  β”‚  (MCP Client)   β”‚   JSON-RPC     β”‚    (MCP Server)      β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β”‚                      β”‚   β”‚
β”‚                                     β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚   β”‚
β”‚                                     β”‚  β”‚  PayWallet     β”‚  β”‚   β”‚
β”‚                                     β”‚  β”‚  β”œβ”€ viem       β”‚  β”‚   β”‚
β”‚                                     β”‚  β”‚  └─ ERC-20 ABI β”‚  β”‚   β”‚
β”‚                                     β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚   β”‚
β”‚                                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                 β”‚ HTTPS/RPC
                                                 β–Ό
                                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                     β”‚    Base Blockchain   β”‚
                                     β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
                                     β”‚  β”‚  USDC Contract β”‚  β”‚
                                     β”‚  β”‚  (Circle)      β”‚  β”‚
                                     β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
                                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Installation

# Clone the repository
git clone https://github.com/koriyoshi2041/pay-mcp.git
cd pay-mcp

# Install dependencies
npm install

# Build
npm run build

Configuration

  1. Copy the example environment file:

cp .env.example .env
  1. Edit .env with your private key:

# Required: Your wallet's private key
PRIVATE_KEY=your_private_key_here

# Optional: Network (mainnet or testnet)
NETWORK=mainnet

⚠️ Security Warning: Never commit your .env file or share your private key!

Add to Claude Code

Add this to your Claude Code MCP settings:

Location: ~/.claude/claude_desktop_config.json (macOS/Linux) or via Claude Code settings

{
  "mcpServers": {
    "pay-mcp": {
      "command": "node",
      "args": ["/path/to/pay-mcp/dist/index.js"],
      "env": {
        "PRIVATE_KEY": "your_private_key_here",
        "NETWORK": "mainnet"
      }
    }
  }
}

Alternative: Run directly with source:

{
  "mcpServers": {
    "pay-mcp": {
      "command": "npx",
      "args": ["tsx", "/path/to/pay-mcp/src/index.ts"],
      "env": {
        "PRIVATE_KEY": "your_private_key_here",
        "NETWORK": "mainnet"
      }
    }
  }
}

πŸ› οΈ Tools

pay_balance

Check USDC balance for your wallet or any address.

Parameter

Required

Description

address

No

Address to check. Defaults to your wallet.

Example prompt:

Check my USDC balance

pay_send

Send USDC to an address.

Parameter

Required

Description

to

Yes

Recipient address (0x...)

amount

Yes

Amount in USDC (e.g., "10.50")

memo

No

Note for this payment

Example prompt:

Send 25 USDC to 0x742d35Cc6634C0532925a3b844Bc9e7595f8d123 for "Coffee subscription"

pay_request

Generate a payment request link.

Parameter

Required

Description

amount

Yes

Amount to request in USDC

memo

No

Description for the request

Example prompt:

Create a payment request for 50 USDC for "Consulting services"

pay_history

View recent USDC transactions.

Parameter

Required

Description

limit

No

Number of transactions (default: 20, max: 100)

Example prompt:

Show my last 10 USDC transactions

πŸ’» Development

Project Structure

pay-mcp/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.ts      # MCP server entry point
β”‚   β”œβ”€β”€ config.ts     # Configuration and constants
β”‚   β”œβ”€β”€ wallet.ts     # Blockchain interaction layer (viem)
β”‚   └── tools.ts      # MCP tool definitions
β”œβ”€β”€ test/
β”‚   └── test.ts       # Test script
β”œβ”€β”€ dist/             # Compiled output
β”œβ”€β”€ .env.example      # Environment template
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
└── README.md

Commands

# Build TypeScript
npm run build

# Run in development mode
npm run dev

# Run tests (uses testnet)
npm test

# Clean build output
npm run clean

Running Tests

# Run with auto-generated test wallet
npm test

# Run with your own testnet wallet
PRIVATE_KEY=your_testnet_key npm test

🌐 Network Configuration

Mainnet (Default)

Setting

Value

Chain

Base (Chain ID: 8453)

USDC Contract

0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913

Explorer

https://basescan.org

Testnet

Set NETWORK=testnet in your .env:

Setting

Value

Chain

Base Sepolia (Chain ID: 84532)

USDC Contract

0x036CbD53842c5426634e7929541eC2318f3dCF7e

Explorer

https://sepolia.basescan.org

πŸ’‘ To get testnet USDC, use the Base Sepolia Faucet.


βš™οΈ Environment Variables

Variable

Required

Default

Description

PRIVATE_KEY

βœ… Yes

-

Wallet private key (without 0x prefix)

NETWORK

No

mainnet

mainnet or testnet

BASE_RPC_URL

No

Public RPC

Custom RPC endpoint

GAS_MULTIPLIER

No

1.1

Gas estimate multiplier

MAX_GAS_LIMIT

No

100000

Maximum gas limit


πŸ”’ Security Considerations

  1. Private Key Storage:

    • Never commit your private key to version control

    • Consider using environment variables or a secrets manager

    • For production, use hardware wallets or key management services

  2. Transaction Safety:

    • Always test on testnet first

    • Double-check recipient addresses

    • Consider implementing daily/per-transaction limits

  3. Network Selection:

    • Verify network configuration before mainnet transactions

    • Use testnet for development and testing


πŸ”§ Tech Stack

Component

Technology

Runtime

Node.js 18+

Language

TypeScript 5.7

MCP SDK

@modelcontextprotocol/sdk

Blockchain

viem

Validation

zod


🀝 Contributing

Contributions are welcome! Please:

  1. Fork the repository

  2. Create a feature branch (git checkout -b feature/amazing-feature)

  3. Make your changes

  4. Run tests (npm test)

  5. Commit your changes (git commit -m 'Add amazing feature')

  6. Push to the branch (git push origin feature/amazing-feature)

  7. Open a Pull Request


πŸ“„ License

MIT License - see LICENSE for details.


πŸ™ Acknowledgments


Available Tools

4 tools
pay_balanceA

Check USDC balance on Base. Returns the balance for your wallet or a specified address.

Inputs: address.

pay_historyA

Get recent USDC transaction history on Base. Shows both sent and received transfers.

Inputs: limit.

pay_requestA

Generate a payment request. Creates a payment link that others can use to send you USDC.

Inputs: amount (required), memo.

pay_sendB

Send USDC payment on Base. Transfers USDC to the specified address.

Inputs: to (required), amount (required), memo.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a distinct purpose: balance checking, sending, requesting, and viewing history. There is no overlap or ambiguity between them.

    Naming Consistency4/5

    All tools share the 'pay_' prefix and use snake_case, which is consistent. However, 'pay_balance' and 'pay_history' are noun-based while 'pay_send' is verb-based, a minor deviation from a pure verb_noun pattern.

    Tool Count5/5

    Four tools cover the core functionality of a simple USDC payment server without bloat. The count is well-scoped for the domain.

    Completeness5/5

    The toolset covers the essential lifecycle: checking balance, sending payments, requesting payments, and viewing transaction history. No critical operations are missing for a basic payment server.

    Related MCP Connectors

    Related MCP Servers