Skip to main content
Glama
README.md
# momo-mcp

[![CI](https://github.com/G2on61/momo-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/G2on61/momo-mcp/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/momo-mcp.svg)](https://pypi.org/project/momo-mcp/)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

**MTN Mobile Money sandbox tools for AI agents, over MCP.**

<!-- mcp-name: io.github.G2on61/momo-mcp -->

`momo-mcp` lets Claude Code, Cursor, Codex and other MCP clients test MTN MoMo
flows without reading a 200-page API spec first. It runs in **demo mode by
default**: no credentials, no network calls, no real money.

Ask your agent:

> Create a sandbox collection of 100 EUR for +237650000000, then check its status.

The agent gets a reference id, a PENDING status, and a clear next step. The
first status check moves the demo transaction to SUCCESSFUL so the full flow is
visible without any network call.

## Why

AI agents are good at calling tools, but payment APIs are still awkward:
authentication, product-specific endpoints, reference ids, status polling and
sandbox setup. `momo-mcp` exposes a small, safe tool surface so an agent can:

- inspect the active product and configuration;
- list MoMo products and capabilities;
- read a balance;
- check whether a number is active;
- create a sandbox collection request;
- read a transaction status;
- verify the amount, currency and external id before delivering goods.

It is built on top of the published
[`mtn-momo-collection`](https://pypi.org/project/mtn-momo-collection/) SDK.

## Quick start

```bash
uvx momo-mcp
```

The server speaks MCP over stdio. It starts in demo mode. To work from source:

```bash
git clone https://github.com/G2on61/momo-mcp.git
cd momo-mcp
uv run momo-mcp
```

### Claude Desktop / Cursor

Add this to your MCP client configuration:

```json
{
  "mcpServers": {
    "momo": {
      "command": "uvx",
      "args": ["momo-mcp"],
      "env": {
        "MOMO_MCP_MODE": "demo"
      }
    }
  }
}
```

## Tools

| Tool | What it does |
|---|---|
| `momo_get_config` | Shows mode, product and whether live credentials are present. |
| `momo_list_products` | Lists collections, disbursements and remittances capabilities. |
| `momo_get_balance` | Reads the active product balance. |
| `momo_check_msisdn` | Checks whether a number is active. |
| `momo_request_collection` | Creates a collection request and returns a reference id. |
| `momo_get_transaction_status` | Reads a collection, disbursement or remittance status. |
| `momo_verify_transaction` | Verifies amount, currency and external id before fulfillment. |
| `momo_list_demo_transactions` | Lists transactions created in the current demo process. |

## Demo mode vs live sandbox

Demo mode is the default and is intentionally fake:

```bash
MOMO_MCP_MODE=demo uv run momo-mcp
```

Live sandbox mode calls the MTN sandbox API. You need a subscription key and
sandbox API user/key:

```bash
export MOMO_MCP_MODE=live
export MOMO_PRODUCT=collections
export MOMO_SUBSCRIPTION_KEY="..."
export MOMO_API_USER="..."
export MOMO_API_KEY="..."
export MOMO_TARGET_ENVIRONMENT="sandbox"
uv run momo-mcp
```

Live mode only accepts `MOMO_TARGET_ENVIRONMENT=sandbox`. Any other target is
refused unless `MOMO_MCP_ALLOW_PRODUCTION=1` is set explicitly. Collection
amounts are capped by `MOMO_MCP_MAX_AMOUNT`, which defaults to `1000.00`.

Optional variables:

| Variable | Default | Description |
|---|---|---|
| `MOMO_PRODUCT` | `collections` | `collections`, `disbursements` or `remittances`. |
| `MOMO_TARGET_ENVIRONMENT` | `sandbox` | MTN target environment. |
| `MOMO_BASE_URL` | MTN sandbox URL | Override the API base URL. |
| `MOMO_TIMEOUT` | `30` | Request timeout in seconds. |
| `MOMO_MAX_RETRIES` | `2` | Retry count for transient failures. |
| `MOMO_MCP_MAX_AMOUNT` | `1000.00` | Maximum collection amount accepted by this server. |
| `MOMO_MCP_ALLOW_PRODUCTION` | unset | Must be `1` to allow a non-sandbox target environment. |

## Security

- Demo mode is the default. It never contacts MTN and never moves money.
- Live mode refuses non-sandbox targets unless `MOMO_MCP_ALLOW_PRODUCTION=1`.
- Collection amounts are capped by `MOMO_MCP_MAX_AMOUNT` (default `1000.00`).
- Secrets are read from environment variables and are never returned by tools.
- `momo_get_config` reports whether credentials exist, not their values.
- `momo_verify_transaction` only returns `verified: true` when MTN reports
  `SUCCESSFUL` and the amount, currency and `external_id` match the expected order.
- If a live collection request loses its response, the tool returns the original
  `reference_id` with `status: UNKNOWN` and tells the agent to verify that
  reference id instead of creating a second request.
- A rejected request returns `status: FAILED` and must not be polled.
- Do not point this server at production without an explicit review of limits,
  approvals, idempotency and audit logging.

## Development

```bash
uv sync --extra dev
uv run ruff check .
uv run mypy
uv run pytest
```

## License

MIT