0.0.2 • Published 5 months ago
@chainbound/payflow-mcp v0.0.2
Payflow MCP Server
A Model Context Protocol (MCP) server that provides tools for creating x402 payment headers to use with paid MCP servers. This server acts as a payment client, allowing users to generate payment headers that can be submitted to paid MCP tools.
Features
- Payment Creation: Generate x402 payment headers for USDC transactions on Base
- MCP Compatible: Works with any MCP client (Claude Desktop, etc.)
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"payflow": {
"command": "npx",
"args": ["@chainbound/payflow-mcp"],
"env": {
"PRIVATE_KEY": "",
// Set your max payment amount in USDC per tool call
"MAX_PAYMENT_AMOUNT_USDC": "10",
}
}
}
}Installation
npm install -g @chainbound/payflow-mcp
# or
pnpm add -g @chainbound/payflow-mcpUsage
Once connected, you can use the payment tool in Claude:
Create Payment
Generate a payment header for a paid MCP tool:
Create a payment of 0.05 USDC to 0x742d35Cc6634C0532925a3b8D1d3e14C1C3E6FC8 for the weather_forecast toolThis will return an x402 payment header that you can then use with paid MCP servers.
Tools
create_payment
Creates an x402 payment header for use with paid MCP tools.
Parameters:
amount(number, required): Payment amount in USDCrecipient(string, required): Ethereum address to receive the paymenttool(string, optional): Name of the MCP tool being paid for
Returns:
- x402 payment header string that can be submitted to paid MCP tools
How It Works
- Generate Payment: The tool creates a signed payment commitment using your private key
- x402 Protocol: Uses the x402 micropayment protocol for blockchain payments
- USDC on Base: All payments are in USDC on the Base network
- Submit to Paid Tools: Use the generated header with paid MCP tools
Environment Variables
| Variable | Description | Required |
|---|---|---|
PRIVATE_KEY | Your wallet private key (0x...) | ✅ |
MAX_PAYMENT_AMOUNT_USDC | Maximum payment amount in USDC | ✅ |
DEBUG | Set to payflow for debug logs | ❌ |
Security Notes
⚠️ Important Security Considerations:
- Your
PRIVATE_KEYis used to sign payment commitments - Keep your private key secure and never share it
- The private key should have USDC balance for payments
- Consider using a dedicated wallet for MCP payments
Development
# Install dependencies
pnpm install
# Run in development mode
pnpm dev
# Link the package to a local binary
pnpm link
# Build
pnpm build
# Start production server
pnpm startExample Workflow
- Start Payflow MCP: Run the server with your private key
- Create Payment: Use the tool to generate payment headers
- Use Paid Tools: Submit headers to paid MCP servers
- Payment Settlement: Payments are automatically settled on Base
Related
- Payflow SDK - Build your own paid MCP servers
- x402 Protocol - Micropayment standard
- Model Context Protocol - MCP specification
License
MIT