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

# Connect an AI agent over MCP

> Connect any compatible MCP client to Ionic and choose what its AI agent can do.

Connect your AI agent through any compatible MCP client to look up customers,
prepare invoices, and create checkout sessions in Ionic. Sign in to your
account and choose what the agent can do. Customers complete their own payments.

Connect using Ionic's MCP server at `https://api.ionicfi.com/mcp`. Refunds,
payouts, webhooks, and account settings remain in the dashboard and the API.

Your client must support remote MCP over Streamable HTTP and OAuth
authorization with PKCE (S256). Claude, ChatGPT, and Codex are examples;
other products and custom clients can connect with the same requirements.

Each connection becomes an agent in your account. It appears on the
**Agents** page with its own handle, such as `@juniper-claude`, and its own
grant for each environment you approve.

## How a connection works

**1. Add the server to your assistant**

Enter `https://api.ionicfi.com/mcp` as a remote MCP server. The steps for
each assistant are below.

**2. Sign in to Ionic**

The assistant opens Ionic in your browser. Sign in with your dashboard
account.

**3. Review the request**

The review shows the app, the account, and the address the browser
returns to. Choose **Test**, **Live**, or **Both** under **Environment**,
then choose permissions for each environment. Live changes start turned
off. The review expires after ten minutes.

**4. Allow the connection**

Select **Allow connection**, or **Allow live access** when live is
included. Ionic registers the assistant as an agent and grants it exactly
the permissions you chose. The browser returns to the assistant.

Any member of the account can connect an assistant, with permissions up to
their own. The first connection on an account without an agent handle prefix
claims one from the business name, which requires an owner or admin.

## Try your connection

For your first connection, choose **Test** and **View customers**. After
connecting with one of the clients below, ask:

```text theme={null}
Use Ionic to list up to 5 customers in test mode. Tell me which account
you used. Do not create or change anything.
```

The result should identify your account and test mode. An empty customer
list is valid. Find the call in the agent's **Activity** in Ionic.

Building your own AI agent? Follow [Connect your AI agent](https://docs.ionicfi.com/guides/agents.md)
for API-key setup.

## Setup examples

In your MCP client, add `https://api.ionicfi.com/mcp` as a remote server,
sign in to Ionic, and approve access. The examples below show where to do
this in several clients.

### Claude Code

Add the server, then sign in from Claude Code:

```bash theme={null}
claude mcp add --transport http ionic https://api.ionicfi.com/mcp
```

In Claude Code, run `/mcp`, select **ionic**, and choose **Authenticate**.

### Claude

In Claude on the web or Claude Desktop:

1. Open **Settings** and select **Connectors**.
2. Select **Add custom connector**.
3. Enter `Ionic` as the name and `https://api.ionicfi.com/mcp` as the URL.
4. Select **Connect** and complete the Ionic review.

Ionic registers Claude automatically, so the client ID and secret fields stay
empty.

### ChatGPT

ChatGPT connects to MCP servers in developer mode, which is available on the
web for Plus, Pro, Business, Enterprise, and Education plans.

1. Open **Settings**, select **Apps**, then **Advanced settings**, and turn on
   **Developer mode**.
2. Select **Create app**.
3. Enter `Ionic` as the name and `https://api.ionicfi.com/mcp` as the MCP
   server URL.
4. Choose **OAuth** for authentication and leave the client ID and secret
   empty. Ionic registers ChatGPT automatically.
5. Create the app and complete the Ionic review.

To use Ionic in a conversation, select **Developer mode** from the **+** menu
and choose **Ionic**.

### Codex

Add the server, then sign in:

```bash theme={null}
codex mcp add ionic --url https://api.ionicfi.com/mcp
codex mcp login ionic
```

The same server can be added directly to `~/.codex/config.toml`:

```toml theme={null}
[mcp_servers.ionic]
url = "https://api.ionicfi.com/mcp"
```

Then run `codex mcp login ionic`. The Codex CLI and the Codex IDE extension
share this configuration.

### Other products and custom clients

Use the same server URL and authorization flow. Ionic publishes its authorization details at
`https://api.ionicfi.com/.well-known/oauth-protected-resource/mcp` and
supports dynamic client registration.

## Permissions

The review lists the permissions an assistant can receive. Each permission
enables these tools:

| Permission | Name | Tools |
| - | - | - |
| `customers:read` | View customers | `list_customers`, `get_customer` |
| `customers:write` | Manage customers | `create_customer` |
| `invoices:read` | View invoices | `list_invoices`, `get_invoice` |
| `invoices:write` | Manage invoices | `create_invoice`, `add_invoice_line`, `remove_invoice_line`, `finalize_invoice` |
| `products:read` | View products and prices | `list_products`, `get_product`, `list_prices`, `get_price` |
| `products:write` | Manage products and prices | `create_product`, `update_product`, `set_product_default_price`, `create_price`, `update_price` |
| `payment_links:read` | View payment links | `list_payment_links`, `get_payment_link` |
| `payment_links:write` | Manage payment links | `create_payment_link`, `update_payment_link`, `activate_payment_link`, `deactivate_payment_link` |
| `sessions:read` | View checkout sessions | `list_checkout_sessions`, `get_checkout_session` |
| `sessions:write` | Create checkout sessions | `create_checkout_session` |
| `payments:read` | View payments | `list_transactions`, `get_transaction` |

Buyers complete their own payments on the payment links and checkout pages
an assistant creates. The full list, with descriptions, is available from
`GET /v1/agent_permissions`.

## Test and live

A connection approved for one environment works only in that environment. A
connection approved for both takes a `mode` on every tool call:

```json theme={null}
{"name": "list_customers", "arguments": {"mode": "test", "limit": 10}}
```

Each result names the account and mode it came from. A tool offers only the
modes where its permission was approved, so a connection with test writes and
live reads creates customers only in test.

## Change or remove access

* **Disconnect:** Owners and admins open **Settings**, then **Connected AI**,
  and select **Disconnect** on their own connection. Disconnecting stops both
  environments for that app and revokes its grants. The agent and its
  history stay on the **Agents** page.
* **Stop any member's assistant:** On the **Agents** page, suspend its agent
  or revoke its access.
* **Remove a permission:** On the agent's **Access** tab, remove it. Calls
  that need it are refused from the app's next call.
* **Add a permission:** On the agent's **Access** tab, select **Add
  permission**. A permission you approved when you connected the app works at
  once. For one you did not approve then, connect again from the assistant and
  approve it in the review; Ionic never widens what you approved in the app.
  Reconnecting the same app reuses its agent, unless that agent was
  deactivated.
* **Pause an assistant:** Suspend its agent on the **Agents** page. Every
  call is refused until you resume it, and connecting the same app again is
  refused with `AGENT_SUSPENDED` until then.

The assistant renews its sign-in automatically and stays connected until it
is disconnected or its agent is suspended or deactivated.

## Troubleshooting

| Message or code | Resolution |
| - | - |
| `AGENT_HANDLE_PREFIX_REQUIRED` | The account has no agent handle prefix. An owner or admin claims one on the **Agents** page, or approves the first connection. |
| `AGENT_SUSPENDED` | The business suspended this app's agent. An owner or admin resumes it on the **Agents** page, then the app connects again. |
| `AGENT_GRANT_EXISTS` | The assistant's agent already holds a grant for that environment, approved on the **Agents** page. Revoke that grant, then connect again. |
| The review has expired | Start the connection again from the assistant. A review lasts ten minutes. |
| A tool is missing | Its permission is not allowed for the app. Add it on the agent's **Access** tab. If you did not approve it when you connected the app, connect again from the assistant and approve it. |


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