@402md/mcp
MCP tools reference for AI agents
Installation
npm install -g @402md/mcpConfiguration
Add to claude_desktop_config.json:
{
"mcpServers": {
"402md": {
"command": "402md-mcp",
"env": {
"WALLET_PRIVATE_KEY": "0xabc...",
"NETWORK": "base"
}
}
}
}Add to .cursor/mcp.json:
{
"mcpServers": {
"402md": {
"command": "402md-mcp",
"env": {
"WALLET_PRIVATE_KEY": "0xabc...",
"NETWORK": "base"
}
}
}
}Any MCP-compatible client can connect via stdio:
WALLET_PRIVATE_KEY=0xabc... NETWORK=base 402md-mcpEnvironment variables
| Variable | Required | Default | Description |
|---|---|---|---|
WALLET_PRIVATE_KEY | Yes | — | Hex private key for USDC wallet |
NETWORK | No | base | base or base-sepolia |
API_BASE_URL | No | https://api.402.md | 402.md API endpoint |
Tools
search_skills
Search 402.md for available skills (APIs, SaaS, products, services).
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Search query |
Returns: list of matching skills with name, description, price, and type.
call_api
Call a paid API with automatic x402 payment.
| Parameter | Type | Required | Description |
|---|---|---|---|
skill | string | Yes | Skill name or ID |
path | string | Yes | API endpoint path |
method | string | No | HTTP method. Defaults to GET |
body | string | No | JSON request body as string |
Returns: API response data.
subscribe
Subscribe to a SaaS service.
| Parameter | Type | Required | Description |
|---|---|---|---|
skill | string | Yes | Skill name or ID |
Returns: ticket JWT, access URL, and expiration date.
buy_product
Purchase a product.
| Parameter | Type | Required | Description |
|---|---|---|---|
skill | string | Yes | Skill name or ID |
path | string | Yes | Product endpoint path |
quantity | number | No | Number of items. Defaults to 1 |
shipping | object | No | Shipping address (name, address, city, state, zip, country) |
Returns: order ID, tracking URL, and total amount.
check_balance
Check the USDC wallet balance. No parameters.
Returns:
| Field | Type | Description |
|---|---|---|
balance | string | USDC balance |
token | string | "USDC" |
network | string | Network name |
wallet | string | Wallet address |
spentToday | number | Amount spent today |
dailyBudget | string | Daily budget limit or "unlimited" |
perTransactionLimit | string | Per-tx limit or "unlimited" |
get_orders
View recent purchases and orders. No parameters.
Returns: list of recent transactions with status.
Programmatic usage
Register 402.md tools on an existing MCP server:
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
import { register402Tools } from '@402md/mcp'
const server = new McpServer({ name: 'my-agent', version: '1.0.0' })
register402Tools(server, {
privateKey: process.env.WALLET_PRIVATE_KEY!,
network: 'base',
apiBaseUrl: 'https://api.402.md',
budget: {
daily: '100.00',
perTransaction: '50.00'
}
})McpConfig
| Field | Type | Required | Description |
|---|---|---|---|
privateKey | string | Yes | Wallet private key |
network | 'base' | 'base-sepolia' | No | Network. Defaults to 'base' |
apiBaseUrl | string | No | API URL. Defaults to 'https://api.402.md' |
budget.daily | string | No | Daily spending limit |
budget.perTransaction | string | No | Per-transaction limit |
Example conversation
User: Find me an API that can analyze sentiment and call it with "I love this product"
Claude (using 402.md MCP tools):
- Calls
search_skillswith query "sentiment analysis" - Finds "sentiment-api" at $0.05/call
- Calls
call_apiwith skill "sentiment-api", path "/analyze", body{"text": "I love this product"} - Auto-pays $0.05 USDC via x402
- Returns:
{ "sentiment": "positive", "score": 0.95 }