P402 logo

P402

Routes AI requests across 300+ models and supports USDC micropayment settlement through an MCP interface.

Install P402

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "p402": {
      "command": "npx",
      "args": [
        "-y",
        "p402"
      ],
      "env": {
        "P402_API_KEY": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

Claude Code command
claude mcp add --env P402_API_KEY=YOUR_VALUE_HERE --transport stdio p402 -- npx -y p402

Run in your terminal. Add --scope project to share it with your team through .mcp.json.

We couldn’t confirm it starts correctly

We hit an unexpected error while testing this listing automatically.

npx -y p402

Rate limit exceeded, please try again later - you have reached the maximum number of concurrent E2B sandboxes (20). If you need more, please visit 'https://e2b.dev/docs/billing'

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

The p402 MCP server connects MCP clients to P402's multi-provider AI routing service and payment infrastructure. It exposes six tools through a stdio MCP server, with requests authenticated by a P402 API key. P402 can route requests by cost, quality, speed, or a balanced score, while session budgets help limit autonomous-agent spending. Use it when an agent needs model selection across providers, usage controls, and x402-based settlement through one service.

Use cases

  • Route agent requests by cost, quality, speed, or balance
  • Set spending caps for autonomous model sessions
  • Consolidate access to multiple AI providers
  • Settle machine-to-machine AI payments on Base

Key features

  • Six MCP tools over stdio
  • Routing across 300+ models
  • Cost, quality, speed, and balanced modes
  • Session budgets for spending limits
  • x402 USDC settlement on Base
  • API-key authentication

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

25/26 checks healthy over the last 117d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 15d ago via OSV.dev · p402 (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

Last commit4mo agoMost recent push to the default branch.
Install checkInconclusiveWe hit an unexpected error running the automated check.
Directory activity1 viewsConfig copies, upvotes, and views on AllMCPs.

How P402 works

What the p402 MCP server does

The p402 MCP server gives MCP-compatible clients access to P402, an AI payment router that can select among more than 300 models. Instead of integrating each provider separately, an agent sends requests through P402 and chooses a routing objective: lowest cost, highest quality, lowest latency, or a balanced result.

P402 also handles per-request payment settlement. Its payment flow uses x402 and supports USDC on Base, with the broader protocol material also describing USDC.e on Tempo through the available payment-method package. The service is designed for applications and agents that need to combine model access with machine-readable payments.

The p402 MCP server exposes six MCP tools.

How it works

The server runs as a stdio process from the @p402/mcp-server npm package. An MCP client starts it with npx, passes the API key through the process environment, and then discovers the available tools. The server forwards authenticated operations to P402's service rather than requiring each client to implement provider-specific APIs.

Routing supports four modes. cost favors lower-priced providers, quality favors output quality, speed favors lower latency, and balanced combines those considerations.

For autonomous workflows, P402 supports sessions with hard dollar budgets. Requests associated with a session reduce its remaining allowance, and clients can query the session to inspect the balance. Payment settlement uses the x402 protocol and gasless EIP-3009 USDC transfers on Base, where the facilitator verifies and settles signed authorizations.

Setup and configuration

For Claude Desktop or another MCP client, configure a server named p402 with npx -y @p402/mcp-server as the command and set P402_API_KEY in its environment. The key is required to authenticate requests. The repository points to P402's MCP documentation and registry entry for client-specific configuration details.

VS Code, Cursor, and Windsurf can use the published p402 extension instead. The extension embeds the MCP server and provides a command-palette action for configuring the API key, so this path does not require a separate MCP configuration file.

Tools and capabilities

  • Route AI requests across more than 300 models.
  • Select cost, quality, speed, or balanced routing.
  • Use one service instead of separate provider API integrations.
  • Create and inspect sessions with spending budgets.
  • Support x402 micropayment verification and settlement on Base.
  • Access six MCP tools through the stdio package.

The p402 MCP server is a fit for agents that need provider choice and spend controls in the same workflow. It is less suitable if the application requires a specifically named model provider API without P402's routing layer, or if it needs tool schemas not documented by the package.

Limitations and notes

The README identifies the server as stdio-based and does not document a separate HTTP transport for MCP. Base Mainnet is specified for the x402 USDC flow, including chain ID 8453 and the USDC contract address in the project documentation. P402 also documents an A2A JSON-RPC interface, but that is a separate protocol surface from the MCP server.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about P402

p402 is an MCP server that connects AI applications to its multi-provider routing and payment services. It exposes six MCP tools for chat, session budgets, spending, and related operations, using an API key to route requests across models and settle supported micropayments.

Install it by configuring an MCP client to run `npx -y @p402/mcp-server` and provide `P402_API_KEY` in the server environment. VS Code, Cursor, and Windsurf can instead install the p402 extension, which embeds the server.

Yes, p402 works with Cursor through its VS Code-compatible extension. Install the p402 extension and run `P402: Configure API Key` from the command palette; the embedded MCP server then makes its tools available in agent mode.

P402 limits spending with sessions that have hard dollar budgets. Requests associated with a session deduct from its allowance, and the client can query the session to see the remaining budget.

P402 uses Base Mainnet for its documented x402 USDC settlement flow. The protocol uses gasless EIP-3009 transfers, with a facilitator verifying and settling signed payment authorizations.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewP402 AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/p402?style=directory)](https://allmcps.com/mcp/p402)
HTML Embed
<a href="https://allmcps.com/mcp/p402"><img src="https://allmcps.com/api/badge/p402?style=directory" alt="P402 on AllMCPs" /></a>