Skip to main content
AP

AP2

v0.2.0-alpha.2OAuth2alpha

Google's Agent-to-Agent Payment Protocol. Authorization, audit, trust establishment between autonomous payment agents.

22 tools1 env vars🌐 GLOBALalpha β€” pending validation

What your agent can do

AP2 gives your agent 22 tools it calls directly β€” pick the ones it needs, in Claude, Cursor, or any MCP client.

  • register_agent β€” Register an AI agent as a trusted payer in the AP2 network. Defines the agent's identity, capabilities, and spending limits.
  • get_agent β€” Get agent registration details, trust status, and current spend usage
  • list_agents β€” List registered agents with optional filters
Example call
// Your agent calls a tool directly β€” no glue code.
// CodeSpar's managed tier handles OAuth2, token rotation and rate limits.
const result = await session.call("register_agent", { /* ... */ });

Install

terminal
$ npm install @codespar/mcp-ap2@alpha

Quickstart

Add this entry to your claude_desktop_config.json (or any MCP-compatible client config).

claude_desktop_config.json
{
  "mcpServers": {
    "ap2": {
      "command": "npx",
      "args": [
        "-y",
        "@codespar/mcp-ap2@alpha"
      ],
      "env": {
        "AP2_API_KEY": "<your_ap2_api_key>"
      }
    }
  }
}

After restart, your agent can call any of the 22 tools below β€” try register_agent first.

Environment variables Β· 1

Required to authenticate the server. Stored encrypted when using CodeSpar managed hosting.

AP2_API_KEY
requiredsecret

API key for ap2

Available tools Β· 22

Each tool is independent β€” your agent loads only what it needs to reduce context and response time.

WRITEregister_agent
Register an AI agent as a trusted payer in the AP2 network. Defines the agent's identity, capabilities, and spending limits.
READget_agent
Get agent registration details, trust status, and current spend usage
READlist_agents
List registered agents with optional filters
DELETErevoke_agent
Revoke an agent's payment authorization. The agent will no longer be able to make or receive payments.
WRITEauthorize_payment
Request payment authorization with scoped limits. Returns an authorization token that can be used to execute the payment.
READget_authorization
Get authorization details including status, limits, and expiry
READlist_authorizations
List payment authorizations with optional filters
WRITEexecute_payment
Execute an authorized payment. Requires a valid authorization token.

Compatible frameworks

MCP is a protocol β€” any framework that speaks it can mount this server.

Claude Agent SDKAnthropic
OpenAI AgentsOpenAI
Vercel AI SDKVercel
LangChainLangChain
LlamaIndexLlamaIndex
CrewAICrewAI
MastraMastra
Any MCP clientProtocol

Frequently asked questions

Run `npx -y @codespar/mcp-ap2` and add the config block above to your MCP client β€” Claude, Cursor, VS Code, or any MCP-compatible client. No build step, no SDK required. Prefer hosted? CodeSpar's managed tier runs it for you with auth handled.
AP2 β€” MCP server Β· 22 tools | CodeSpar