pay-mcp

pay-mcp

An MCP server for USDC payments on Base, enabling AI agents to check balances, send payments, generate payment requests, and view transaction history.

Category
Visit Server

README

Pay-MCP šŸ’ø

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

<p align="center"> <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"></a> <a href="https://nodejs.org"><img src="https://img.shields.io/badge/Node.js-18+-339933?logo=node.js&logoColor=white" alt="Node.js 18+"></a> <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-5.7-3178C6?logo=typescript&logoColor=white" alt="TypeScript"></a> <a href="https://base.org"><img src="https://img.shields.io/badge/Chain-Base-0052FF?logo=coinbase&logoColor=white" alt="Base"></a> <a href="https://www.circle.com/en/usdc"><img src="https://img.shields.io/badge/Token-USDC-2775CA?logo=circle&logoColor=white" alt="USDC"></a> <a href="https://modelcontextprotocol.io"><img src="https://img.shields.io/badge/Protocol-MCP-FF6B35" alt="MCP"></a> <a href="https://viem.sh"><img src="https://img.shields.io/badge/Blockchain-Viem-1C1C1C" alt="Viem"></a> </p>


šŸŽÆ 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

šŸ—ļø 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


<p align="center"> <strong>āš ļø Disclaimer:</strong> This is experimental software. Use at your own risk. Always verify transactions and test on testnet before using with real funds. </p>

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured