MTN Mobile Money

v0.1.1
io.github.G2on61/momo-mcp Checked 2 days ago Published 2 days ago

Sandbox-first MTN Mobile Money tools for AI agents, over 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. 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. AI agents are good at calling tools, but payment APIs are still awkward: authentication, product-specific endpoints, reference ids, status polling and sandbox setup.

Summary extracted from the README.

momo-mcp

CI PyPI License: MIT

MTN Mobile Money sandbox tools for AI agents, over 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 SDK.

Quick start

uvx momo-mcp

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

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:

{
  "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:

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:

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

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

License

MIT