@rail402/mcp
v0.1.0
Published
MCP server giving Claude, Cursor, and other LLMs direct access to the Rail402 paid-API marketplace on Base.
Downloads
23
Maintainers
Readme
@rail402/mcp
An MCP server that gives Claude, Cursor, and any MCP-compatible LLM direct access to the Rail402 marketplace — browse paid APIs, read their schemas, and pay for and call them with USDC on Base, all from inside the model.
Tools
| Tool | What it does |
| ----------------------- | --------------------------------------------------------------------------- |
| list_services | Browse the marketplace by category or free-text query. |
| get_service_details | Get a service's input/output JSON Schema, price, method, and examples. |
| call_service | Execute a paid call — settles the x402 USDC payment, returns the response. |
| check_payment_status | Verify a USDC payment transaction on Base by its hash. |
call_service requires a funded agent wallet (RAIL402_PRIVATE_KEY). The other
three tools work read-only with no wallet.
Quick start
npx -y @rail402/mcp # runs the stdio MCP serverConfigure via environment variables:
| Variable | Default | Purpose |
| ---------------------- | -------------------- | -------------------------------------------------- |
| RAIL402_API_BASE | https://rail402.app| Marketplace API base URL. |
| RAIL402_NETWORK | base | base or base-sepolia. |
| RAIL402_PRIVATE_KEY | (unset) | Agent wallet key; enables call_service. |
| RAIL402_RPC_URL | public Base RPC | Optional RPC override. |
Install in Claude Desktop
Edit your claude_desktop_config.json
(macOS: ~/Library/Application Support/Claude/claude_desktop_config.json,
Windows: %APPDATA%\Claude\claude_desktop_config.json):
{
"mcpServers": {
"rail402": {
"command": "npx",
"args": ["-y", "@rail402/mcp"],
"env": {
"RAIL402_NETWORK": "base",
"RAIL402_PRIVATE_KEY": "0xYourAgentWalletKey"
}
}
}
}Restart Claude Desktop. Ask: "List Rail402 security APIs and call the wallet risk scorer for 0x…".
Install in Cursor
Add to .cursor/mcp.json (project) or ~/.cursor/mcp.json (global):
{
"mcpServers": {
"rail402": {
"command": "npx",
"args": ["-y", "@rail402/mcp"],
"env": { "RAIL402_NETWORK": "base" }
}
}
}Install with Base MCP
This server ships a Base MCP–compatible skill manifest at
skill/skill.json. Register it alongside
Base MCP so an agent can use Base's wallet
and chain tools and Rail402's marketplace together:
{
"mcpServers": {
"base": { "command": "npx", "args": ["-y", "@base-org/base-mcp"] },
"rail402": { "command": "npx", "args": ["-y", "@rail402/mcp"], "env": { "RAIL402_NETWORK": "base" } }
}
}A ready-to-edit config is included at mcp-config.json.
Example session
You: Find an analytics API for Base tokens and tell me what it costs.
Claude: (list_services category=Analytics) → "Token Analytics", 0.05 USDC on base.
(get_service_details token-analytics) → input: { address }, output: {...}
You: Run it for 0x1bc0c42215582d5a085795f4badbac3ff36d1bcb.
Claude: (call_service token-analytics {address}) → pays 0.05 USDC, returns holder stats.Security
- Keep
RAIL402_PRIVATE_KEYin a wallet funded with only what you're willing to let an agent spend. Treat it like a hot wallet. - Without the key, the server is read-only (
call_servicereturns a clear error). - All logs go to stderr, never stdout, so they can't corrupt the JSON-RPC stream.
Develop
npm install
npm run dev # tsx src/index.ts
npm run typecheck
npm run build # → dist/index.jsLicense
MIT © Rail402
