x402 Payment Gateway MCP Server
Enables AI agents to make micropayments using USDC on Solana via the x402 protocol, supporting payment requests, on-chain verification, and revenue tracking.
README
x402 Payment Gateway MCP Server 💰
MCP Server that enables micropayments between AI agents using USDC on Solana. Based on the x402 protocol (HTTP 402 Payment Required).
What is x402?
x402 is a protocol that lets AI agents pay for services automatically. When an agent calls a premium tool, it gets a "402 Payment Required" response with payment instructions. The agent pays via blockchain, then gets access.
Features
- Payment Requests — Create x402-compatible payment requests for any tool
- On-Chain Verification — Verify USDC payments directly on Solana
- Tool Pricing — Set per-call prices for individual tools
- Revenue Tracking — Dashboard with total revenue, per-tool breakdown
- Payment History — Full audit trail of all transactions
Installation
pip install x402-mcp-server
Configuration
Set your merchant wallet in .env:
MERCHANT_WALLET=YourSolanaWalletAddress
SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
Usage with Claude Code
{
"mcpServers": {
"x402": {
"command": "uvx",
"args": ["x402-mcp-server"],
"env": {
"MERCHANT_WALLET": "YourSolanaWalletAddress"
}
}
}
}
Tools
| Tool | Description |
|---|---|
create_payment_request |
Create a 402 payment request for a tool |
verify_payment |
Verify on-chain USDC payment |
get_payment_status |
Check payment status |
set_tool_price |
Set price for a tool |
get_price_list |
View all tool prices |
list_payments |
Payment history |
get_revenue |
Revenue statistics |
Flow
Agent A x402 Gateway Agent B (Service)
| | |
|-- "Use premium tool" ---->| |
| |-- 402 Payment Required ---->|
|<-- Payment instructions --| |
| | |
|-- USDC payment on-chain ->| |
| |-- verify_payment ---------->|
| |<-- verified ----------------|
|<-- Access granted --------| |
More MCP Servers by AiAgentKarl
| Category | Servers |
|---|---|
| 🔗 Blockchain | Solana |
| 🌍 Data | Weather · Germany · Agriculture · Space · Aviation · EU Companies |
| 🔒 Security | Cybersecurity · Policy Gateway · Audit Trail |
| 🤖 Agent Infra | Memory · Directory · Hub · Reputation |
| 🔬 Research | Academic · LLM Benchmark · Legal |
License
MIT
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.