> For the complete documentation index, see [llms.txt](https://docs.carbonmark.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.carbonmark.com/carbonmark-x402/use-x402-from-an-ai-agent.md).

# Use x402 from an AI agent

Connect the x402 Carbon Retirement API to a wallet-connected AI agent so it can discover, quote and retire carbon credits from a plain-language request.

Wire the x402 Carbon Retirement API into any Base MCP–capable AI agent so it can discover, quote, prepare, and submit a carbon retirement from a plain-language request.

The x402 Carbon Retirement API is built for the x402 agent-payments ecosystem and plugs directly into Base MCP. The fastest path is the Klima Base MCP plugin, which connects the endpoint to agents such as Claude Code.

{% hint style="warning" %}
On 27 October 2026 the `base-mcp` skill was removed from `base/skills`; Coinbase now maintains it as `wallet-mcp` in [`coinbase/agents`](https://github.com/coinbase/agents). The setup guide linked below was written for the earlier layout. If its install step fails, use one of the direct integrations under [Prefer a direct integration?](#prefer-a-direct-integration), which do not depend on Base MCP.
{% endhint %}

## Setup

{% stepper %}
{% step %}

#### Install

Connect Base MCP and add the Klima plugin by following the [Base MCP setup guide](https://github.com/KlimaDAO/Klima-Protocol-x402-MCP-documentation/blob/main/base-mcp-setup.md). The plugin definition is [`plugins/klima-retire.md`](https://github.com/KlimaDAO/Klima-Protocol-x402-MCP-documentation/blob/main/plugins/klima-retire.md).
{% endstep %}

{% step %}

#### Ask in plain language

For example: "Retire 2 tonnes of carbon under $15/tonne, beneficiary 'Acme Corp'."
{% endstep %}

{% step %}

#### Approve once

The agent runs `discover` → `quote` → `prepare/retire`, shows you the cost, submits a single wallet approval, and returns your Carbonmark certificate URL.
{% endstep %}
{% endstepper %}

## Prefer a direct integration?

You do not need MCP to use the endpoint. You can:

* Call the GET or POST endpoints yourself, then sign and submit the `prepare/retire` batch (`approve` + retirement) with your own wallet on Base — see [Retire carbon with x402](https://docs.carbonmark.com/carbonmark-x402/retire-carbon-with-x402.md).
* Use the gasless relay path — sign one authorization and let a Klima executor submit it — see [Gasless retirement (paid relay)](https://docs.carbonmark.com/carbonmark-x402/gasless-retirement-paid-relay.md).

## Agent discovery

x402 directories and agent crawlers can index the endpoint automatically through its public well-known documents:

| Document       | URL                                                                                              |
| -------------- | ------------------------------------------------------------------------------------------------ |
| Manifest       | [`/.well-known/x402.json`](https://x402.klimalabs.com/.well-known/x402.json)                     |
| Error registry | [`/.well-known/x402-errors.json`](https://x402.klimalabs.com/.well-known/x402-errors.json)       |
| Changelog      | [`/.well-known/x402-changelog.json`](https://x402.klimalabs.com/.well-known/x402-changelog.json) |
| Docs index     | [`/api/docs`](https://x402.klimalabs.com/api/docs)                                               |

## Resources

* [Agent plugin + setup docs](https://github.com/KlimaDAO/Klima-Protocol-x402-MCP-documentation) — Base MCP setup guide, klima-retire plugin, and full integration docs
* [Base MCP setup guide](https://github.com/KlimaDAO/Klima-Protocol-x402-MCP-documentation/blob/main/base-mcp-setup.md) — connect Base MCP and add the Klima retirement plugin
* [Base MCP](https://docs.base.org/ai-agents/quickstart) — Base AI agent quickstart for wallet-connected agents on Base mainnet
* [Klima Aggregator USAGE](https://github.com/KlimaDAO/retirement-aggregator/blob/main/USAGE.md) — direct on-chain access for callers who do not want the HTTP layer

{% hint style="warning" %}
Retirement is irreversible. Review the tonnes, price, and fee the agent presents before approving — a confirmed retirement cannot be undone, refunded, or resold.
{% endhint %}
