Metadata-Version: 2.5
Name: momo-mcp
Version: 0.1.0
Summary: MTN Mobile Money sandbox tools for AI agents, exposed over MCP.
Project-URL: Homepage, https://github.com/G2on61/momo-mcp
Project-URL: Repository, https://github.com/G2on61/momo-mcp
Project-URL: Issues, https://github.com/G2on61/momo-mcp/issues
Author-email: Gedeon ONDELE <gedeon@ondele.fr>
License: MIT
License-File: LICENSE
Keywords: ai-agents,claude,cursor,mcp,mobile-money,momo,mtn
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Requires-Dist: mcp<3,>=2.3
Requires-Dist: mtn-momo-collection<0.2,>=0.1
Provides-Extra: dev
Requires-Dist: mypy>=1.14; extra == 'dev'
Requires-Dist: pytest>=8.3; extra == 'dev'
Requires-Dist: ruff>=0.11; extra == 'dev'
Description-Content-Type: text/markdown

# 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)
[![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.

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

## Quick start

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

The server speaks MCP over stdio. It starts in demo mode.

### Claude Desktop / Cursor

Add this to your MCP client configuration:

```json
{
  "mcpServers": {
    "momo": {
      "command": "uv",
      "args": ["run", "--directory", "/absolute/path/to/momo-mcp", "momo-mcp"],
      "env": {
        "MOMO_MCP_MODE": "demo"
      }
    }
  }
}
```

After the package is published to PyPI, the command can be shortened to:

```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_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.
- 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
