About MCP Pay Server
MCP Pay Server is a standalone MCP server for operators who need to charge for tool calls. It uses prepaid USDC credits on Base, with signed requests, balance checks, and deductions.
Key features
- 01HTTP+SSE bidirectional transport
- 02Exposes MCP tools, resources, and prompts
- 03Accepts USDC deposits on Base
- 04Verifies signatures and deducts paid credits
- 05Checks wallet balances
Use cases
- 01Set per-call prices for MCP tools
- 02Let clients preload USDC credits
- 03Check balances before paid tool execution
- 04Review a payer wallet’s remaining credit
MCP support
It exposes tools, resources, and prompts to MCP clients over HTTP+SSE. Clients can retrieve payment capabilities, read the deposit resource, and use the balance-check tool.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEMCP Pay Server
A standalone implementation of the Model Context Protocol (MCP) server with HTTP+SSE transport, including a basic pre-pay credit system.
Features
- Exposes MCP tools, resources, and prompts
- Supports HTTP+SSE for bidirectional communication
- Implements a simple payment layer using USDC deposits on Base (or Base Sepolia)
- Built with Express, TypeScript, Viem, and Zod
Setup
-
Install dependencies:
npm install -
Configure Environment Variables: Create a
.envfile in the root directory (mcp-pay-server/.env) with the following:# Required: Public address of the wallet the server will watch for USDC deposits SERVER_DEPOSIT_ADDRESS=0xYourServerWalletPublicAddress # Optional: RPC URL for Base or Base Sepolia (defaults provided) # BASE_RPC_URL=https://your-base-rpc-url # Optional: Port for the server (defaults to 3000) # PORT=3001SERVER_DEPOSIT_ADDRESS: The public0x...address the server should monitor for incoming USDC deposits.BASE_RPC_URL: The RPC endpoint for interacting with the Base blockchain (mainnet or Sepolia).PORT: The port the HTTP server will listen on.
Usage
Start the server:
npm start
This will start the MCP server and begin watching for USDC deposits to the configured SERVER_DEPOSIT_ADDRESS.
Payment System Overview
This server uses a pre-pay credit system verified via cryptographic signatures. Clients fetch the payment capabilities separately after connecting.
- Connect: Client connects to the server.
- Fetch Capabilities: Client calls the
payments/getCapabilitiesmethod to receive:- The URI of the resource providing deposit information (e.g.,
mcp-pay://server/payment/info). - The name of the tool used for checking balances (e.g.,
payments_getBalance). - A list of tools that require payment and their associated cost (as strings).
- The URI of the resource providing deposit information (e.g.,
- Deposit Info: Clients read the deposit info resource (URI obtained from capabilities) to get the server's USDC deposit address.
- Credit: Clients send USDC (on the configured network) to the deposit address. The server monitors this address and credits the sender's account in its internal ledger.
- Paid Tool Usage: When a client calls a tool identified as paid in the capabilities:
- It must include
__payer(its0x...address) and__signature(ECDSA signature of the canonical request) in theparams.arguments. - The server's central middleware verifies the signature and checks the payer's balance against the tool's cost before executing the tool logic.
- If verification succeeds, the tool executes. If the tool execution is successful, the cost is deducted from the payer's balance.
- It must include
- Balance Check: Clients use the balance check tool (name obtained from capabilities) with their
payerAddressas an argument. This tool does not require a signature.
Available Endpoints
POST /mcp- For client requests to the server (requiresmcp-session-idheader). Handles general MCP methods andpayments/getCapabilities.GET /mcp- For SSE (Server-Sent Events) stream (requiresmcp-session-idheader).
Payment Capabilities (Exposed via payments/getCapabilities)
- Deposit Info Resource URI:
mcp-pay://server/payment/info(by default) - Balance Check Tool:
payments_getBalance(by default) - Paid Tools (Example):
greet: 0.05 USDC (by default)- (Others can be configured)
Available Tools
greet: A simple greeting tool (Requires payment by default).payments_getBalance: Returns the credit balance for the calling wallet (Free).
Available Resources
mcp-pay://server/payment/info: Returns the server's deposit address.
Development
Build the TypeScript code:
npm run build
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.