> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cleo-pay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect your agent

> Connect ChatGPT, Claude, Claude Code, Cursor or Codex to Cleo by signing in. Pick a business and an access level. No API key, and no agent can pay a bill.

Your AI agent can read your bills, payments and contacts in Cleo, and with your permission approve or flag bills. You add one URL to the agent and sign in to Cleo. No API key is needed.

| Environment | Server URL |
| - | - |
| Production | `https://mcp.cleo-pay.com` |
| Sandbox | `https://mcp.stg.cleo-pay.com` |

The first time the agent calls Cleo, it opens a Cleo sign-in page. There you pick:

* **Business**: one of the businesses you are an active member of.
* **Access**: **Read only** or **Read and approve**.

Click **Allow**, then go back to your agent.

## Access levels

| Access | The agent can | Scopes |
| - | - | - |
| **Read only** | Read bills, payments, contacts, invoices, bank accounts and the balance | `payables:read`, `payments:read`, `contacts:read`, `invoices:read`, `bank-accounts:read`, `balance:read`, `custom-fields:read` |
| **Read and approve** | Everything above, plus approve bills and flag bills | The read scopes plus `payables:approve` |

Any active member can connect with **Read only**. **Read and approve** is offered to admins and to members whose role can approve bills. The agent never gets more than your role allows: it approves only what you could approve yourself in Cleo. An admin can approve any step, as in the Cleo web app.

> [!NOTE]
>
> Neither level can pay a bill or move money. A connection never gets `payments:initiate`, `balance:transfer`, `payables:write`, `contacts:write` or `bank-accounts:write`, so the agent cannot pay, transfer, or create and change bills, contacts or bank accounts. To build an integration that pays, use an [API key](https://docs.cleo-pay.com/authentication.md).

## Connect by client

> [tab] ChatGPT
>
> 1. In ChatGPT, open **Settings** > **Apps** and turn on developer mode.
> 2. Create a connector with the URL `https://mcp.cleo-pay.com`.
> 3. Sign in to Cleo when ChatGPT asks, pick the business and the access level, and click **Allow**.
>
> On a ChatGPT Business or Enterprise workspace, an admin must allow custom connectors first.

> [tab] Claude
>
> This works in claude.ai and in Claude Desktop.
>
> 1. Open **Settings** > **Connectors** and click **Add custom connector**.
> 2. Enter the URL `https://mcp.cleo-pay.com`.
> 3. Click **Connect**, sign in to Cleo, pick the business and the access level, and click **Allow**.

> [tab] Claude Code
>
> ```bash theme={null}
> claude mcp add --transport http cleo https://mcp.cleo-pay.com
> ```
>
> Then run `/mcp` in Claude Code, pick `cleo`, and sign in to Cleo in the browser window it opens.

> [tab] Cursor
>
> Add Cleo in **Cursor Settings** > **MCP**, or add it to `~/.cursor/mcp.json`:
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "cleo": { "url": "https://mcp.cleo-pay.com" }
>   }
> }
> ```
>
> Cursor shows a sign-in button for the server. Click it and sign in to Cleo.

> [tab] Codex
>
> ```bash theme={null}
> codex mcp add cleo --url https://mcp.cleo-pay.com
> codex mcp login cleo
> ```
>
> The second command opens the Cleo sign-in page.

For the sandbox, use `https://mcp.stg.cleo-pay.com` in place of `https://mcp.cleo-pay.com`.

### Every desktop agent at once

```bash theme={null}
curl -fsSL https://mcp.cleo-pay.com/install.sh | sh
```

The script finds Claude Code, Codex, Cursor and Claude Desktop on your computer and adds Cleo to each one. It stores no key. Each agent asks you to sign in to Cleo the first time it calls Cleo. Restart Claude Desktop after the script runs. Claude Desktop connects through `npx mcp-remote`, so it needs Node.js.

You can also copy these commands from the Cleo web app, under **Settings** > **Connect your agent**.

## Review bills with your agent

With **Read and approve**, you can ask the agent to check your unpaid bills against something you trust, such as a P\&L or a list of expected costs. For example:

> Check every unpaid bill in Cleo against this P\&L. Approve the bills whose vendor, amount and event date match. Flag the rest and say what differs. Do not pay anything.

The agent uses these tools:

| Tool | What it does |
| - | - |
| `list_payables` | With `paymentStatus: "unpaid"`, lists every submitted bill that is not fully paid. Add `status: "pending_approval"` for the bills waiting for approval. |
| `get_payable` | Reads one bill, with its `eventDate`, line items and their `date`, and any `flags`. |
| `approve_payable` | Approves the bill at your approval step. It sends the total, vendor and bill number it read, so a bill whose total, vendor or bill number changed since is not approved. Approving never pays the bill. |
| `flag_payable` | Puts a note on the bill saying what does not match. The bill shows **Flagged** with the reason in its activity in Cleo. The bill keeps its status. |
| `list_members` | Lists your team's active members, so the agent can name who should look at a flagged bill. |

Cleo also tells every connected agent to approve only when the vendor, amount and event date match, and to flag otherwise. A connection cannot pay in any case. Agents that support MCP prompts can start this review with the `review_unpaid_bills` prompt.

After approval, a bill waits for payment. Someone on your team pays it in Cleo.

All tools are listed in [MCP server](https://docs.cleo-pay.com/guides/mcp-server.md#tools).

## What your team sees

The agent acts as you. Each approval or flag shows in the bill's activity in Cleo under your name, with the agent's name, for example **Jane Doe approved via ChatGPT**. The agent's name is the name the client gave when it registered with Cleo. A client that gave none shows as **Unnamed app**, or as the host of its `client_id` URL.

## See and revoke connections

In the Cleo web app, open **Settings** > **Connect your agent**. **Connected agents** lists each connection with the agent, the member who connected it, the access level and when it was last used.

* A member sees their own connections.
* An admin sees every connection for the business.

Click **Revoke** to end a connection. The agent's next call answers `401`, and it must sign in again to reconnect. If your settings do not show **Connect your agent**, ask Cleo support to revoke a connection.

Removing a member from the business also stops that member's connections.

## How sign-in works

* The agent gets an access token that lasts one hour, and a refresh token it uses to get a new one.
* The refresh token changes on every use and expires after 30 days without use. If a refresh token is sent again more than 30 seconds after it was used, Cleo ends the connection.
* The token works only on the MCP server. The REST API answers `401` to it.
* Connections do not appear in your list of API keys.
* While your business has not finished identity verification, the agent sees only `get_business_status`.

### For client developers

Cleo follows the [MCP authorization spec](https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization):

* A request without a valid token gets `401` with `WWW-Authenticate: Bearer resource_metadata="..."`. It points at the protected resource metadata: `/.well-known/oauth-protected-resource` on the `mcp.` host, or `/.well-known/oauth-protected-resource/v1/mcp` on the `api.` host.
* The authorization server metadata is at `https://api.cleo-pay.com/.well-known/oauth-authorization-server`, and at `https://api.stg.cleo-pay.com/.well-known/oauth-authorization-server` for the sandbox.
* Clients register with Dynamic Client Registration (`POST /oauth/register`), or use a Client ID Metadata Document (an `https` `client_id` URL). Public clients use `token_endpoint_auth_method: none`.
* PKCE with `S256` is required. `plain` is refused.
* Send `resource` with the server URL you connected to. A token or refresh request may leave `resource` out. If it sends one that differs from the authorization request's, it gets `invalid_target`.
* Redirect URIs can use `https` on any host, `http` only on `localhost`, `127.0.0.1` or `[::1]` (any port), or a private-use scheme in reverse domain form, such as `com.example.app:/callback`. A private-use URI needs a dot in its scheme or its host, so `myapp://callback` is refused. A redirect URI with a fragment or user info is refused. The sign-in page labels the app **Unverified app** unless the redirect host is `chatgpt.com`, `claude.ai` or `claude.com`.
* The authorization response carries `iss`. Revoke a token with `POST /oauth/revoke`.

#### Rate limits on sign-in

* Discovery (`/.well-known/...`), `POST /oauth/register`, `/oauth/authorize`, `POST /oauth/token`, `POST /oauth/revoke` and the sign-in page's own calls are limited per client IP address: 100 requests per minute to each endpoint.
* `POST /oauth/register` is also limited to 20 registrations per hour per IP address.
* Over the per-minute limit, the answer is `429` with a `Retry-After` header. Over the hourly registration limit, the answer is `429` without `Retry-After`. Wait up to an hour before you register again.
* `POST /oauth/register`, `/oauth/authorize`, `POST /oauth/token` and `POST /oauth/revoke` answer a `429` in the OAuth error shape, `{"error": "temporarily_unavailable", "error_description": "..."}`.
* One connect flow makes only a few calls to each endpoint, so a client that does not loop stays well under these limits.
* The MCP endpoint has a per-IP limit too. See [Rate limits](https://docs.cleo-pay.com/authentication.md#rate-limits).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.