AI42-MCP X402 Payment Server
Enables automatic X402 payment processing using Solana wallets on devnet, with support for checking wallet balances, tracking payment history, and setting spending limits for paid web requests.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@AI42-MCP X402 Payment Serverfetch https://api.premium-news.com/latest-articles"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
AI42 MCP Server
X402 Payment MCP Server for Claude Desktop
Quick Start • Features • Installation • Usage
Overview
AI42 MCP Server enables Claude Desktop to automatically handle web requests with X402 payments. Fetch data from any URL and seamlessly process cryptocurrency payments when required (402 status). Includes payment tracking, balance checking, and spending limits.
Features
Automatic Payment Handling: Transparent X402 payment processing on 402 responses
GET & POST Support: Full HTTP method support for API interactions
Payment Management: Track history, check balance, set spending limits
Solana Integration: Built on Solana devnet/mainnet
Type-safe: Full TypeScript support
Zero Configuration: Works out of the box with Claude Desktop
Available Tools
Tool | Description |
| Fetch data from URLs with automatic payments |
| Check wallet SOL balance |
| View all payments made during session |
| Set maximum spending limit per request |
Related MCP server: AgentScout MCP Server
Installation
Prerequisites
Node.js 18+
Solana wallet private key (base58 format)
Claude Desktop
Quick Install
No manual installation needed! Just configure Claude Desktop:
Add to claude_desktop_config.json:
Windows:
{
"mcpServers": {
"x402-payment": {
"command": "npx",
"args": ["-y", "@ai42/mcp"],
"env": {
"SOLANA_PRIVATE_KEY": "your_base58_private_key_here"
}
}
}
}macOS:
{
"mcpServers": {
"x402-payment": {
"command": "npx",
"args": ["-y", "@ai42/mcp"],
"env": {
"SOLANA_PRIVATE_KEY": "your_base58_private_key_here"
}
}
}
}Linux:
{
"mcpServers": {
"x402-payment": {
"command": "npx",
"args": ["-y", "@ai42/mcp"],
"env": {
"SOLANA_PRIVATE_KEY": "your_base58_private_key_here"
}
}
}
}Config File Locations
Platform | Path |
Windows |
|
macOS |
|
Linux |
|
After adding config: Restart Claude Desktop!
Quick Start
Getting Your Private Key
Generate Solana Keypair:
solana-keygen new --outfile ~/.config/solana/id.json
solana-keygen pubkey ~/.config/solana/id.jsonExport Private Key (base58 format):
cat ~/.config/solana/id.json
# Copy the array, then convert to base58⚠️ Never commit private keys to version control!
First Request
Once configured and Claude Desktop is restarted, simply ask:
You: Check my wallet balance
Claude: [Uses get-balance tool] Your balance is 2.5 SOL on devnetUsage
Example Conversations
Fetch Data from URL
You: Get data from https://api.example.com/endpoint
Claude: [Uses fetch-with-payment] Here's the data from the API...Fetch with Payment
You: Fetch https://paid-service.com/premium-data
Claude: [Uses fetch-with-payment] Payment of 0.05 SOL made successfully.
Here's the premium data...POST Request
You: POST this data to https://api.example.com: {"message": "hello"}
Claude: [Uses fetch-with-payment] Successfully posted. Response: {...}Check Balance
You: What's my SOL balance?
Claude: [Uses get-balance] Your current balance:
- Balance: 2.5 SOL
- Network: devnet
- Address: 7xK...abcSet Payment Limit
You: Set payment limit to 0.1 SOL
Claude: [Uses set-payment-limit] Payment limit set to 0.1 SOL.
Any request exceeding this amount will be rejected.View Payment History
You: Show my payment history
Claude: [Uses get-payment-history]
Total payments: 3
Total spent: 0.15 SOL
Recent payments:
1. 0.05 SOL to xyz...abc at 2025-11-12T10:30:00Z
2. 0.08 SOL to def...123 at 2025-11-12T11:45:00Z
3. 0.02 SOL to ghi...789 at 2025-11-12T12:15:00ZTool Reference
1. fetch-with-payment
Fetch data from any URL with automatic payment handling.
Parameters:
url(string, required): URL to fetchmethod(string, optional): HTTP method - "GET" or "POST" (default: "GET")body(string, optional): JSON string for POST requests
Returns:
{
success: boolean;
data: any;
payment_made: boolean;
payment_amount: number; // in SOL
}Example:
Get data from https://api.weather.com/current2. get-balance
Check current SOL balance in your wallet.
Parameters: None
Returns:
{
balance: number; // SOL amount
unit: "SOL";
network: string; // "devnet" or "mainnet"
address: string; // Public key
}Example:
Check my wallet balance3. get-payment-history
View all payments made during the current session.
Parameters:
limit(number, optional): Maximum records to return (default: all)
Returns:
{
total_payments: number;
total_spent: number; // Total SOL spent
records: Array<{
url: string;
amount: number; // in SOL
recipient: string;
timestamp: string;
signature: string;
}>;
}Example:
Show last 5 payments4. set-payment-limit
Set maximum spending limit per request. Set to 0 to remove limit.
Parameters:
limit(number, required): Maximum SOL amount (0 to remove)
Returns:
{
message: string;
current_limit: number | null;
}Example:
Don't let me spend more than 0.05 SOL per requestHow It Works
The X402 Payment Flow
Request: Claude makes a request to a URL
402 Response: If the endpoint requires payment, it returns HTTP 402
Automatic Payment: The MCP server automatically processes the payment using your Solana wallet
Retry: The request is retried with payment proof
Success: Data is returned to Claude
Payment Tracking
All payments are logged in-memory during the session
Track amounts, recipients, timestamps, and transaction signatures
View history anytime with
get-payment-history
Spending Limits
Set a maximum amount per request to prevent overspending
Requests exceeding the limit are automatically rejected
Remove limits by setting to 0
Advanced Usage
Testing with MCP Inspector
For development and debugging:
# Install globally or use npx
npx @modelcontextprotocol/inspector npx @ai42/mcpThis opens a web UI where you can:
See all registered tools
Test tool calls with custom inputs
View request/response JSON
Debug payment flows
Environment Variables
If running locally (not via npx in Claude config):
# .env file
SOLANA_PRIVATE_KEY=your_base58_private_key_hereNetwork Configuration
Currently supports:
Solana Devnet (default): For testing with test SOL
Solana Mainnet: For production (update in source)
Security Best Practices
Private Key Safety
✅ DO:
Store private keys in environment variables
Use separate wallets for testing (devnet) and production (mainnet)
Set reasonable payment limits
Regularly check payment history
❌ DON'T:
Commit private keys to git
Share private keys in chat or screenshots
Use production wallets without payment limits
Ignore payment history
Payment Limits
Recommended limits based on usage:
Use Case | Recommended Limit |
Testing | 0.01 SOL |
Light Usage | 0.1 SOL |
Regular Usage | 0.5 SOL |
Heavy Usage | 1.0 SOL |
Troubleshooting
"Bad secret key size" error
Your private key format is incorrect. Ensure it's in base58 format:
# Convert from JSON array to base58
node -e "console.log(require('bs58').encode(Buffer.from([your,array,here])))""Module not found" error
Clear npx cache and reinstall:
npx clear-npx-cache
# Restart Claude Desktop"Payment failed" error
Check:
Wallet has sufficient balance (
get-balance)Network connectivity to Solana RPC
Private key is valid
Payment limit not exceeded
Tool not appearing in Claude
Verify config file location and syntax
Restart Claude Desktop completely
Check Claude Desktop logs for errors
Test with MCP Inspector
Development
Local Development
# Clone repository
git clone https://github.com/Kishore-MK/ai42-mcp
cd ai42-mcp
# Install dependencies
npm install
# Create .env file
echo "SOLANA_PRIVATE_KEY=your_key" > .env
# Build
npm run build
# Test locally
node dist/index.jsProject Structure
ai42-mcp/
├── src/
│ ├── index.ts # Main MCP server
| ├── payment.ts # Payment client wrapper
│ └── types.ts # Types file
├── dist/ # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.mdContributing
Contributions welcome! Please feel free to submit a Pull Request.
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Feat: Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
Links
📦 NPM Package: @ai42/mcp
💻 GitHub Repository: ai42-mcp
📖 X402 Protocol: x402.org
🔧 MCP SDK: @modelcontextprotocol/sdk
License
MIT License - see LICENSE file for details
Acknowledgments
Built with:
X402 Protocol - HTTP 402 payment standard
x402-fetch - Payment wrapper for Node.js
Model Context Protocol - MCP SDK
@solana/web3.js - Solana blockchain interaction
Made with ❤️ by keyaru
Available Tools
4 toolsfetch-with-paymentFetch DataA
Fetch data from a website or API. Automatically handles payment if required (402 status).
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The URL to fetch data from | |
| method | No | HTTP method (default: GET) | |
| body | No | Request body for POST requests (JSON string) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It discloses key behavioral traits: automatic payment handling for 402 status, which is valuable beyond basic fetching. However, it lacks details on error handling, rate limits, authentication needs, or response format, leaving significant gaps for a tool with mutation potential (payment handling).
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized with two concise sentences that are front-loaded and zero waste. Each sentence earns its place by stating the core function and a key behavioral trait.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (payment handling mutation with no annotations and no output schema), the description is incomplete. It covers the payment feature but lacks details on prerequisites, side effects, or return values, making it adequate but with clear gaps for safe agent use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema fully documents parameters (url, method, body). The description adds no additional meaning beyond what the schema provides, such as explaining how payment interacts with parameters. Baseline 3 is appropriate as the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with specific verbs ('fetch data') and resources ('from a website or API'), distinguishing it from payment-related siblings like get-balance or get-payment-history. However, it doesn't explicitly differentiate from potential generic fetch tools that might exist in other contexts.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for fetching data when payment might be required (handling 402 status), providing some context. However, it doesn't explicitly state when to use this vs. alternatives (e.g., standard fetch tools without payment handling) or when not to use it, leaving gaps in guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get-balanceGet Wallet BalanceB
Check the current SOL balance in your wallet
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. While 'Check' implies a read-only operation, it doesn't specify whether this requires authentication, network connectivity, rate limits, or what happens if the wallet doesn't exist. For a financial tool with zero annotation coverage, this leaves significant behavioral questions unanswered.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that communicates the essential purpose without any wasted words. It's front-loaded with the core functionality and appropriately sized for a simple read operation with no parameters.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple balance-checking tool with no parameters and no output schema, the description is minimally adequate. However, without annotations covering authentication requirements, network behavior, or error conditions, and with sibling tools that suggest a payment/wallet context, more contextual information would be helpful for an AI agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters with 100% schema description coverage, so the schema already fully documents the empty parameter set. The description appropriately doesn't waste space discussing non-existent parameters, maintaining focus on the tool's purpose. Baseline for zero parameters is 4.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Check') and resource ('current SOL balance in your wallet'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'get-payment-history', but the focus on current balance rather than historical data provides implicit distinction.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'get-payment-history' or 'fetch-with-payment'. There's no mention of prerequisites, timing considerations, or comparative use cases with sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get-payment-historyGet Payment HistoryC
View all payments made during this session
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of records to return (default: all) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'view all payments made during this session', which implies a read-only operation, but doesn't disclose other traits such as authentication needs, rate limits, error handling, or what 'session' entails. This leaves significant gaps in understanding the tool's behavior beyond basic purpose.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, clear sentence that efficiently states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded, making it easy to parse, though it could be slightly more structured by including usage context or parameter hints.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (a read operation with one parameter) and no annotations or output schema, the description is incomplete. It lacks details on behavioral traits, usage guidelines, and return values, which are crucial for an agent to invoke it correctly. The description alone is insufficient for full contextual understanding.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, with the 'limit' parameter fully documented in the schema. The description adds no additional meaning beyond what the schema provides, as it doesn't mention parameters at all. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description 'View all payments made during this session' clearly states the tool's purpose with a specific verb ('view') and resource ('payments'), but it doesn't differentiate from sibling tools like 'fetch-with-payment' or 'get-balance'. The scope 'during this session' provides some specificity, but the purpose remains somewhat vague regarding what distinguishes it from similar tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'fetch-with-payment' or 'get-balance'. It implies usage for viewing payments in the current session, but lacks explicit when/when-not instructions or named alternatives, leaving the agent to infer context without clear direction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
set-payment-limitSet Payment LimitA
Set maximum amount willing to pay per request (in SOL). Set to 0 to remove limit.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | Yes | Maximum payment amount in SOL (0 to remove limit) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the action ('Set') and effect ('remove limit'), but lacks details on permissions required, whether changes are reversible, rate limits, or what happens if the limit is exceeded. This is a significant gap for a mutation tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise with two sentences that are front-loaded and waste no words. Every sentence earns its place by clearly stating the tool's purpose and usage rule.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (mutation with no annotations and no output schema), the description is adequate but incomplete. It covers the basic purpose and parameter usage, but lacks behavioral context like error handling or response format, leaving gaps for an agent to operate effectively.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents the 'limit' parameter fully. The description adds minimal value by restating the parameter's purpose and the special case of 0, but does not provide additional syntax or format details beyond what the schema provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Set maximum amount willing to pay per request') and resource ('payment limit'), with explicit mention of the currency (SOL). It distinguishes from sibling tools like 'get-balance' or 'get-payment-history' by focusing on configuration rather than retrieval.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for usage ('Set to 0 to remove limit'), indicating when to use this specific value. However, it does not explicitly mention when to use this tool versus alternatives like 'fetch-with-payment' or any prerequisites, which prevents a perfect score.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Each tool has a clearly distinct purpose with no ambiguity: fetch-with-payment handles data retrieval with payment automation, get-balance checks wallet balance, get-payment-history views session payments, and set-payment-limit configures spending limits. The descriptions clearly differentiate their functions, making misselection unlikely.
The tool names follow a mostly consistent verb_noun pattern (e.g., fetch-with-payment, get-balance, get-payment-history, set-payment-limit), with all using hyphens for separation. However, fetch-with-payment uses a compound verb (fetch-with) that slightly deviates from the simpler verb forms in the others, but overall the naming is predictable and readable.
With 4 tools, the count is well-scoped for a payment server focused on data fetching and wallet management. Each tool earns its place by covering essential operations: data retrieval, balance checking, payment tracking, and limit setting, without being overly complex or sparse.
The tool surface covers core payment and wallet management workflows effectively, including data fetching with payment handling, balance inquiries, payment history, and limit configuration. A minor gap exists in lacking a tool for direct payment initiation or refunds, but agents can work around this using the existing tools for most scenarios.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Pay-per-use web extract, token prices, and wallet balances via x402 USDC micropayments.
Fetch any URL as clean Markdown or metadata, and buy digital goods via x402 — for AI agents.
AI agent gateway with web fetching, data extraction, crypto pricing, and x402 payments
Pay-per-call browser rendering and x402 marketplace ranking for AI agents, billed via USDC.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables extracting clean Markdown from any webpage by paying $0.005 USDC per call via the x402 protocol, with automatic wallet-based payment settlement.11MIT
- AlicenseNot gradedqualityCmaintenanceEnables web content extraction, reading, crawling, and pricing via MCP tools, with pay-per-fetch in USDC on Base using x402.2MIT

@bridgenode/mcpofficial
AlicenseAqualityAmaintenanceEnables AI agents to make pay-as-you-go AI inference requests through x402 with automatic Solana USDC payments, no API keys or registration, while enforcing configurable spending limits.35441MIT No Attribution
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Kishore-MK/ai42-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server