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

# MCP Server

> Use the Afriex Business API with AI assistants via the Model Context Protocol

The Afriex MCP server exposes the Afriex Business API as tools for AI assistants. It implements the [Model Context Protocol (MCP)](https://modelcontextprotocol.io), letting clients like Claude Desktop, Claude Code, and Cursor interact with the Afriex platform programmatically.

## How it works

Each Afriex Business API endpoint becomes an individually callable MCP tool. An AI assistant can create customers, send transactions, look up balances, and more, all via natural language.

## Authentication

You will need an Afriex Business API key from the [dashboard](https://business.afriex.com/). Connect your MCP client to `https://mcp.afriex.com/mcp`, then authenticate using one of two methods:

**Method 1: HTTP headers (recommended)**

Pass your API key directly in your MCP client config. The server captures these values and uses them for all subsequent Business API calls in the session:

| Header                 | Required | Description                                               |
| ---------------------- | -------- | --------------------------------------------------------- |
| `x-afriex-api-key`     | Yes      | Your Afriex Business API key                              |
| `x-afriex-environment` | No       | `production` or `development` (defaults to `development`) |

**Method 2: `authenticate` tool**

After connecting, call the `authenticate` tool as your first action:

```json theme={null}
{
  "apiKey": "your-api-key",
  "environment": "production"
}
```

See [Connecting MCP Clients](/mcp/connecting) for client-specific setup instructions.

## Available Tools (22)

### Authentication

| Tool           | Description                                                                    |
| -------------- | ------------------------------------------------------------------------------ |
| `authenticate` | Set your API key and environment (`production`/`development`) for this session |
| `session_info` | View current session config: masked API key, environment, and base URL         |

### Customers

| Tool                  | Description                                                     |
| --------------------- | --------------------------------------------------------------- |
| `create_customer`     | Create a new customer with name, email, phone, and country code |
| `list_customers`      | Retrieve a paginated list of customers                          |
| `get_customer`        | Get a customer by ID                                            |
| `delete_customer`     | Delete a customer by ID                                         |
| `update_customer_kyc` | Update KYC information for a customer                           |

### Transactions

| Tool                 | Description                                           |
| -------------------- | ----------------------------------------------------- |
| `create_transaction` | Create a `DEPOSIT`, `WITHDRAW`, or `SWAP` transaction |
| `list_transactions`  | Retrieve a paginated list of transactions             |
| `get_transaction`    | Get a transaction by ID                               |

### Payment Methods

| Tool                        | Description                                                                                    |
| --------------------------- | ---------------------------------------------------------------------------------------------- |
| `create_payment_method`     | Create a payment method (`BANK_ACCOUNT`, `SWIFT`, `MOBILE_MONEY`, `UPI`, `INTERAC`, `WE_CHAT`) |
| `list_payment_methods`      | Retrieve a paginated list of payment methods                                                   |
| `get_payment_method`        | Get a payment method by ID                                                                     |
| `delete_payment_method`     | Delete a payment method by ID                                                                  |
| `list_institutions`         | List banks/providers by country and channel                                                    |
| `resolve_institution_codes` | Resolve a SWIFT code or routing number to a bank name                                          |
| `resolve_payment_method`    | Resolve recipient info by account number or phone                                              |
| `get_crypto_wallet`         | Get or create a crypto wallet (USDT/USDC, production only)                                     |
| `get_virtual_account`       | Get or create a virtual account (production only)                                              |

### Organization

| Tool            | Description                                                                        |
| --------------- | ---------------------------------------------------------------------------------- |
| `get_balance`   | Fetch wallet balances for specified currencies                                     |
| `get_rates`     | Get real-time exchange rates                                                       |
| `topup_balance` | Top up sandbox balance with a specified amount and currency (sandbox/staging only) |
