The Economic Layer for AI Agents.
Agents need wallets, not credit cards. Model Context Protocol (MCP) on P402 gives Claude, Cursor, and custom agents a secure wallet and an orchestration layer to negotiate, pay, and route data autonomously.
Agent Wallet Status
- Active
- Daily Budget: $10.00
- 84% Remaining
- Avg. Latency: 124ms
-12% vs last week - Budget Consumed (Today): 16.0%
Why P402 for MCP?
Autonomous Payments
Enable your agent to pay for premium tools (weather, market data, high-tier LLMs) without human approval, strictly within pre-defined policies.
Protocol Routing
Don't hardcode providers. P402 routes agent requests to the most cost-effective and healthy models in real-time.
Semantic Guardrails
Prevent agent "hallucination loops" from draining your wallet with semantic analysis and recursive-call kill switches.
Install in Your Environment
Three distribution paths. Pick the one that matches your client.
Zero config
VS Code · Cursor · Windsurf
ext install p402-protocol.p402
Embedded MCP server bundled inside the extension. Tools appear in Copilot agent mode immediately on install — no config files, no env vars, no restart.
McpServerDefinitionProvider — spawns local node process
Status bar: spend tracker + mode switcher
3 sidebar views: sessions · requests · provider status
stdio transport
Claude Desktop · JetBrains · Any MCP client
npx -y @p402/mcp-server
Standalone stdio MCP server. Add to your client's config file with P402_API_KEY. See the config snippet below.
npm: @p402/mcp-server@1.0.0
MCP Registry: io.github.Z333Q/p402
No daemon, no persistent process
OpenAI-compatible
REST API · Node · Python · Any HTTP client
npm install @p402/sdk
Drop-in replacement for direct provider calls. Change the base URL and API key — everything else stays the same.
POST /api/v2/chat/completions
300+ models, 1 key
USDC settlement per request
Quick Local Setup
Initialize Agent Wallet
Create a dedicated hot wallet for your agent. We recommend keeping <$10 USDC for safety.
Define Policy
Set spending limits (e.g., $1.00/day) and allowed providers via the P402 Dashboard.
Sync MCP Server
Add the P402 MCP server to your client (Claude Desktop or Cursor) to bridge the agent to the web.
claude_desktop_config.json
{
"mcpServers": {
"p402": {
"command": "npx",
"args": ["-y", "@p402/mcp-server"],
"env": {
"P402_API_KEY": "p402_live_...",
"P402_ROUTER_URL": "https://p402.io"
}
}
}
}
Environment Variables
P402_API_KEY: Required. Your P402 API key from the dashboard.P402_ROUTER_URL: Optional. Defaults tohttps://p402.io. Override for self-hosted deployments.
Available Tools
Six tools exposed over stdio MCP transport. Use them from any MCP client.
p402_chat: Core
Route a prompt to the best provider. Supports cost / quality / speed / balanced modes. Settles payment per-request in USDC on Base at 1% flat fee.
params: prompt, mode?, model?, session_token?, max_tokens?p402_create_session: Sessions
Create a budget session with a USD cap. All p402_chat calls referencing this session draw from the shared budget — useful for multi-turn conversations.
params: budget_usd, label?p402_get_session: Sessions
Retrieve session status: remaining budget, total spent, request count, and expiry.
params: session_tokenp402_list_models: Discovery
List all 300+ routable models with provider, context window, cost per token, and availability.
params: provider?p402_compare_providers: Discovery
Side-by-side cost and latency comparison for a given model across all providers that serve it.
params: modelp402_health: Ops
Router uptime, facilitator settlement status, and provider health summary.
params: none
Infinite Scalability
As your agent fleet grows, P402 acts as the centralized Economic Gateway. 100 agents, 1 budget, 0 hardcoded API keys.