mcp-ap2 — Claude Code MCP server: what it does, how to install
This MCP server exposes AP2 payment, authorization, audit, and credential tools for agents. It is deprecated because no live AP2 endpoint is available.
claude mcp add mcp-ap2 -e AP2_API_KEY=<AP2_API_KEY> -- npx -y @codespar/mcp-ap2What mcp-ap2 does
mcp-ap2 exposes AP2 operations through an MCP client. Its tool set covers agent registration, scoped payment authorization, payment execution, transaction lookup, audit events, mandates, Verifiable Credentials, DID resolution, and signed receipts.
The package is deprecated and does not reach a live payment service: AP2 is an open specification rather than a Google-hosted API. A working provider endpoint can be supplied through AP2_BASE_URL. Requests use AP2_API_KEY as a Bearer token and AP2_AGENT_ID in the X-Agent-Id header. Setting AP2_SANDBOX=true causes a TLS failure.
What it helps with
- register an agent as a trusted payer
- request payment approval with scoped limits
- verify mandates and Verifiable Credentials
- inspect a transaction’s audit trail
- create and validate a signed receipt
Example prompts for the agent
- Use
register_agentto register an agent and return its trust status. - Request a limited payment authorization with
authorize_payment. - Verify a mandate, then create a receipt with
verify_credentialandcreate_receipt.
How to install mcp-ap2
Platform CLI
claude mcp add mcp-ap2 -e AP2_API_KEY=<AP2_API_KEY> -- npx -y @codespar/mcp-ap2Replace <…> with your own values
Platform CLI
codex mcp add ap2 --env AP2_API_KEY=<AP2_API_KEY> -- npx -y @codespar/mcp-ap2Replace <…> with your own values
Config file
{
"mcpServers": {
"ap2": {
"command": "npx",
"args": [
"-y",
"@codespar/mcp-ap2"
],
"env": {
"AP2_API_KEY": "<AP2_API_KEY>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"ap2": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@codespar/mcp-ap2"
],
"env": {
"AP2_API_KEY": "<AP2_API_KEY>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e AP2_API_KEY=<AP2_API_KEY> ap2 npx -y @codespar/mcp-ap2Replace <…> with your own values
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about mcp-ap2
How do I install mcp-ap2 in Claude Code?
Run claude mcp add mcp-ap2 -e AP2_API_KEY=<AP2_API_KEY> -- npx -y @codespar/mcp-ap2.
What does mcp-ap2 do?
It exposes AP2 tools for agent payment authorization, mandates, audit records, DID resolution, credentials, and signed receipts.
Why does mcp-ap2 not process payments?
The package is deprecated and has no live AP2 endpoint to call. AP2 is a specification, not a Google-hosted API; a working provider URL can be set with AP2_BASE_URL.