MCP server for M-Pesa payments plus Africa's Talking SMS and airtime services across African telecom networks.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent โ or use 1-click editor setup below.
๐ก Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Inspect callable tools, capabilities, and parameters exposed to AI agents by Mpesa MCP.
mpesa_stk_pushTrigger M-Pesa STK Push โ sends payment prompt to customer's phone. Customer enters M-PESA PIN to complete payment. Returns CheckoutRequestID; poll mpesa_stk_query after 10-30 seconds.
mpesa_stk_queryCheck STK Push status. Poll 10-30s after mpesa_stk_push. ResultCode 0 = success, 1032 = cancelled, 1037 = timed out.
mpesa_b2cBusiness To Customer disbursement โ send money from shortcode to phone. Use for payroll, NGO field incentives, agent float, survey rewards. Result delivered async to MPESA_RESULT_URL. Requires MPESA_INITIATOR_NAME and MPESA_SECURITY_CREDENTIAL env vars.
mpesa_business_paybillPay directly from business shortcode to another paybill number. Use for supplier payments, utility bills, inter-business transfers. Requires MPESA_INITIATOR_NAME and MPESA_SECURITY_CREDENTIAL.
mpesa_business_buygoodsPay from business shortcode to a till/buy-goods number. Requires MPESA_INITIATOR_NAME and MPESA_SECURITY_CREDENTIAL.
mpesa_business_pochiPay from business shortcode to a Pochi la Biashara micro-SME wallet. Used for micro-enterprise supplier payments and informal sector settlements. Requires MPESA_INITIATOR_NAME and MPESA_SECURITY_CREDENTIAL.
MCP server for East African fintech APIs โ M-Pesa (Safaricom Daraja) and Africa's Talking
Give your AI agent the ability to trigger M-Pesa payments, check transaction status, send SMS, and top up airtime across 20+ African telecom networks.
Claude Sonnet 5 (released June 30, 2026) finishes multi-step M-PESA workflows without stopping short and self-corrects tool-call errors without prompting. Terminal-Bench score 80.4% vs Sonnet 4.6's 67.0% โ the benchmark most analogous to payment agent work.
M-Pesa processes more transactions per day than PayPal does in Africa. Africa's Talking reaches users in 20+ countries on basic phones via SMS and USSD. Neither has an MCP server.
This means every AI agent built today โ Claude, GPT, Gemini, or any MCP-compatible runtime โ cannot trigger an M-Pesa payment or send a Kiswahili SMS without custom integration work.
mpesa-mcp closes that gap in one pip install.
| Tool | Description |
|---|---|
mpesa_stk_push | Trigger STK Push payment prompt on customer's M-Pesa phone |
mpesa_stk_query | Check status of an STK Push request |
mpesa_transaction_status | Query any M-Pesa transaction by receipt number |
sms_send | Send SMS to 1โ1,000 recipients across African networks |
airtime_send | Send airtime top-up to any subscriber (KES, NGN, GHS, UGX, etc.) |
mpesa-mcp is available as a hosted MCP server on Glama:
mpesa-mcp was updated in response to NSA CSI U/OO/6030316-26 (May 2026) โ the NSA Artificial Intelligence Security Center's Cybersecurity Information Sheet on Model Context Protocol security.
The implementation below documents compliance against the NSA's MCP security framework, control by control.
| NSA Control | Implementation |
|---|---|
| Parameter validation | KE phone regex ^254[17]\d{8}$ + amount bounds [1โ150,000 KES] |
| Audit logging | Structured log per tool call; phone numbers SHA-256 hashed |
| Token lifecycle | OAuth token cached with expiry; auto-refreshed |
| Error containment | Structured error dicts; no raw exception propagation |
| HTTPS enforcement | All Daraja API calls HTTPS-only |
| No hardcoded secrets | All credentials via environment variables |
See SECURITY.md for the full compliance table.
Reference: NSA CSI_MCP_SECURITY.pdf โ May 2026, UNCLASSIFIED
Or run directly with uvx:
Set these environment variables before starting the server:
M-Pesa sandbox: https://developer.safaricom.co.ke โ create a free app to get test credentials.
174379bfb279f9aa9bdbcf158e97dd71a467cd2e0c893059b10f78e6b72ada1ed2c919Africa's Talking sandbox: https://account.africastalking.com โ use username=sandbox, any API key.
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
Set env vars in your shell before running claude.
Once connected, you can ask your AI agent:
"Send KES 500 STK Push to +254712345678 for order #1234"
"Check if the payment QKL8ABC123 has been received"
"Send an SMS to these 50 farmers with today's maize price: [list]"
"Top up KES 50 airtime for our field agents: [list of numbers]"
Field agent payment dispatch
"Send KES 300 STK Push to each of these 12 field agents for today's data collection: [list]"
The agent triggers 12 sequential STK pushes, tracks each checkout_request_id, and
polls for confirmation โ without any code from you.
Farmer alert + airtime
"SMS these 200 Garissa farmers that the river is rising. Then top up KES 20 airtime each so they can call in reports."
One prompt โ 200 SMS messages and 200 airtime top-ups across Safaricom, Airtel, and Telkom.
Payment reconciliation
"Check whether receipt OKL8M3B2HF was a successful payment and how much it was for"
Useful for support agents using Claude to verify M-Pesa transactions in real time.
All tools declare MCP tool annotations so clients can gate calls appropriately:
| Tool | readOnly | destructive | idempotent |
|---|---|---|---|
mpesa_stk_push | โ | โ | โ |
mpesa_stk_query | โ | โ | โ |
mpesa_transaction_status | โ | โ | โ |
sms_send | โ | โ | โ |
airtime_send | โ | โ | โ |
Claude Desktop and other MCP clients will request confirmation before triggering payment, SMS, or airtime operations.
Capabilities are advertised via .well-known/mcp.json โ the emerging MCP Server Cards standard. Registries and browsers can index this server's tools without connecting to it.
The MCP ecosystem benchmark (CData, 2026) found most MCP servers accurate 60โ75% of the time on complex queries โ particularly silent failures on write operations and partial parameter application.
mpesa-mcp is tested against all three Kenyan phone number formats, boundary amount values, and missing optional fields:
Write operations (STK push, SMS, airtime) have explicit validation before any API call is made.
Mojaloop (funded by the Gates Foundation) handles payment interoperability โ connecting banks, mobile money wallets, and merchants across DFSPs in East Africa and beyond.
mpesa-mcp handles the AI agent tooling layer โ enabling AI coding assistants to trigger and query M-Pesa payments programmatically.
These are complementary:
See the Mojaloop documentation contribution for more on this pattern.
mpesa-mcp implements MCP (Model Context Protocol) โ how an AI agent talks to tools.
There is a complementary protocol, A2A (Agent-to-Agent), which handles how agents talk to each other. They solve different problems and work together:
For most integrations you only need MCP. A2A becomes relevant when you're building multi-agent systems where a payment workflow coordinates with other specialized agents.
Factual signals from GitHub, npm, and our automated checks โ not a rating.
No reviews yet โ be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/gabrielmahia-mpesa-mcp)<a href="https://allmcps.com/mcp/gabrielmahia-mpesa-mcp"><img src="https://allmcps.com/api/badge/gabrielmahia-mpesa-mcp?style=directory" alt="Mpesa MCP on AllMCPs" /></a>