Labsco
MCP SERVER

M-Pesa Payments

by gabrielmahia

Trigger M-Pesa payments and payouts, reconcile transactions, and send SMS or airtime across African networks.

Payments, Billing & SubscriptionsVerified
Summary
The M-Pesa surface an agent actually needs: collect, disburse, reconcile, and check who you are paying.

It goes past the usual STK-push wrapper — reversal, KRA remittance, Bill Manager invoicing and SIM-swap screening are all here, which is what makes it usable for real settlement rather than demos. Several tools return their result to a callback URL rather than inline, so you need a reachable endpoint before those paths work.

What it is

An MCP server for East African fintech APIs — M-Pesa through Safaricom's Daraja and messaging through Africa's Talking. It covers collection, disbursement, reconciliation and fraud signals, so an agent can take a payment and confirm it landed without custom integration work.

What you get
  • mpesa_stk_push and mpesa_stk_query — send a payment prompt to a customer's phone, then poll the result; ResultCode 0 is success, 1032 cancelled, 1037 timed out
  • mpesa_b2c — disburse from your shortcode to a phone, for payroll, field incentives, agent float or survey rewards
  • mpesa_business_paybill, mpesa_business_buygoods and mpesa_business_pochi — pay another paybill, a till, or a Pochi la Biashara wallet
  • mpesa_b2b_express_checkout — a USSD push to a merchant till for merchant-to-merchant payment
  • mpesa_transaction_status, mpesa_account_balance and mpesa_query_org_info — look up any transaction by receipt, read the shortcode balance, and validate a destination shortcode before sending
  • mpesa_pull_transactions — pull C2B transactions for reconciliation, up to a 48-hour range per call
  • mpesa_reversal — reverse a payment sent to the wrong number or for the wrong amount
  • mpesa_dynamic_qr — generate a QR code with the amount pre-filled, returned as base64
  • mpesa_ratiba_create — a standing order the customer authorises once, for subscriptions or rent
  • mpesa_bill_manager_optin, mpesa_bill_manager_invoice and mpesa_bill_manager_cancel — enrol once, then issue and cancel invoices customers pay by SMS link
  • mpesa_tax_remittance — remit to the Kenya Revenue Authority against a Payment Registration Number
  • mpesa_sim_swap_query and mpesa_imsi_query — recent SIM-swap and registration signals on a Safaricom number, before a high-value payout
  • sms_send and airtime_send — SMS to 1–1000 recipients and airtime top-ups across Kenya, Nigeria, Ghana, Tanzania, Uganda, Rwanda and more
  • get_model_hint — the model the project recommends pairing with these tools
Requirements

Daraja credentials — MPESA_CONSUMER_KEY, MPESA_CONSUMER_SECRET, MPESA_SHORTCODE, MPESA_PASSKEY and MPESA_CALLBACK_URL — with MPESA_SANDBOX set to false for production. The business-to-business, reversal, balance and status tools additionally need MPESA_INITIATOR_NAME and MPESA_SECURITY_CREDENTIAL, and deliver their result asynchronously to MPESA_RESULT_URL. SMS and airtime need AT_USERNAME and AT_API_KEY. Install with pip install mpesa-mcp or run it with uvx mpesa-mcp over stdio.

Setup effort

One command plus a key — pip install mpesa-mcp, then supply credentials