mpesa-mcp
v0.7.3M-Pesa Daraja and Africa's Talking MCP server: 24 tools; live payments and SMS need confirmation.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
mpesa_stk_push M-Pesa STK Push
Send an M-PESA payment prompt (STK Push) to a customer's phone for them to approve with their PIN. Use when a customer is to pay your business shortcode. The customer must approve on the handset: nothing is taken without their PIN. Returns success, checkout_request_id, merchant_request_id, response code, message and the sandbox flag; success means the prompt was SENT, not that the customer paid, so poll mpesa_stk_query. In live mode it prompts a real phone.
| Parameter | Type | Description |
|---|---|---|
account_ref * | string | Account reference shown to customer on phone (max 12 chars) |
amount * | integer | Amount in KES (whole number, min 1, max 150000) |
phone * | string | Customer phone (any Kenyan format: +254..., 07..., 254...) |
description | string | Transaction description (max 13 chars) |
mpesa_stk_query M-Pesa STK Query
Check the status of an STK Push using its checkout_request_id. Use 10 to 30 seconds after mpesa_stk_push to learn whether the customer paid, cancelled or the request is still processing. Returns the Daraja status for that request with the sandbox flag. Read-only.
| Parameter | Type | Description |
|---|---|---|
checkout_request_id * | string | CheckoutRequestID from mpesa_stk_push response |
mpesa_ratiba_create M-Pesa Ratiba (standing order)
Create an M-PESA Ratiba standing order: a recurring payment from a customer's M-PESA to your paybill or till (subscriptions, loan or SACCO repayments, school fees). Use when a customer has agreed to pay the same amount on a schedule. Safaricom sends the customer a PIN prompt; nothing is created until they approve on their phone, and the final result arrives at the callback URL. Returns success (the request was ACCEPTED, not yet approved), the response reference, and the schedule: frequency, dates, number of payments and total commitment in KES (null where Safaricom's frequency is ambiguous). R…
| Parameter | Type | Description |
|---|---|---|
account_ref * | string | Account reference the customer sees, e.g. a loan or member number (1 to 12 characters) |
amount * | integer | Amount in KES taken on EACH payment (whole number, 1 to 150000) |
end_date * | string | Last date the order may run, YYYY-MM-DD or YYYYMMDD; on or after the start date |
phone * | string | Customer phone that pays, any Kenyan format (+254..., 07..., 254...) |
standing_order_name * | string | Name of the standing order; must be unique for this customer (Safaricom rejects a repeat), 1 to 60 characters |
start_date * | string | First payment date, YYYY-MM-DD or YYYYMMDD; today or later |
description | string | Short description; Safaricom keeps the first 13 characters |
frequency | string | How often: one_off, daily, weekly, monthly, bi_monthly, quarterly, half_year or yearly; Safaricom's codes 1 to 8 are also accepted |
receiver_type | string | Where the money goes: paybill (your MPESA_SHORTCODE as a PayBill) or till (as a Buy Goods till) |
mpesa_b2c M-Pesa B2C
Send money from your business shortcode to a customer's phone (Business to Customer). Use only when the user has explicitly approved this exact payment. MOVES MONEY: in live mode the person approves this exact payment through the client (a client that cannot show that prompt is refused by default; only in the opt-in param and auto modes is confirm_send=true, set only after the user approves, the fallback), and it refuses amounts above the per-transaction cap (MPESA_MAX_AMOUNT_KES, default KES 20,000); the sandbox is never restricted. Returns success, the Daraja response and the sandbox flag, o…
| Parameter | Type | Description |
|---|---|---|
amount * | integer | Amount in KES to send |
phone * | string | Recipient phone number (any Kenyan format) |
command_id | string | SalaryPayment | BusinessPayment | PromotionPayment |
confirm_send | boolean | Required in live mode: set true ONLY after the user has explicitly approved this exact payment (recipient and amount). Ignored in sandbox. |
occasion | string | Optional occasion label |
remarks | string | Remarks (max 100 chars) |
mpesa_business_paybill Business Pay Bill (B2B)
Pay from your business shortcode directly to another paybill number (B2B PayBill). Use only when the user has explicitly approved this exact payment. MOVES MONEY: in live mode the person approves this exact payment through the client (a client that cannot show that prompt is refused by default; only in the opt-in param and auto modes is confirm_send=true, set only after the user approves, the fallback), and it refuses amounts above the per-transaction cap (MPESA_MAX_AMOUNT_KES, default KES 20,000); the sandbox is never restricted. Returns success, the Daraja response and the sandbox flag, or a…
| Parameter | Type | Description |
|---|---|---|
account_reference * | string | Account number at destination paybill |
amount * | integer | Amount in KES |
receiver_paybill * | string | Destination paybill shortcode |
confirm_send | boolean | Required in live mode: set true ONLY after the user has explicitly approved this exact payment (recipient and amount). Ignored in sandbox. |
remarks | string | Transaction remarks |
mpesa_business_buygoods Business Buy Goods (B2B)
Pay from your business shortcode to a till (Buy Goods) number. Use only when the user has explicitly approved this exact payment. MOVES MONEY: in live mode the person approves this exact payment through the client (a client that cannot show that prompt is refused by default; only in the opt-in param and auto modes is confirm_send=true, set only after the user approves, the fallback), and it refuses amounts above the per-transaction cap (MPESA_MAX_AMOUNT_KES, default KES 20,000); the sandbox is never restricted. Returns success, the Daraja response and the sandbox flag, or a refusal saying what…
| Parameter | Type | Description |
|---|---|---|
amount * | integer | Amount in KES |
till_number * | string | Destination till number (Buy Goods) |
confirm_send | boolean | Required in live mode: set true ONLY after the user has explicitly approved this exact payment (recipient and amount). Ignored in sandbox. |
remarks | string | Transaction remarks |
mpesa_business_pochi Business to Pochi la Biashara
Pay from your business shortcode to a Pochi la Biashara micro-business wallet by phone number. Use only when the user has explicitly approved this exact payment. MOVES MONEY: in live mode the person approves this exact payment through the client (a client that cannot show that prompt is refused by default; only in the opt-in param and auto modes is confirm_send=true, set only after the user approves, the fallback), and it refuses amounts above the per-transaction cap (MPESA_MAX_AMOUNT_KES, default KES 20,000); the sandbox is never restricted. Returns success, the Daraja response and the sandbo…
| Parameter | Type | Description |
|---|---|---|
amount * | integer | Amount in KES |
phone * | string | Pochi wallet owner phone number |
confirm_send | boolean | Required in live mode: set true ONLY after the user has explicitly approved this exact payment (recipient and amount). Ignored in sandbox. |
remarks | string | Remarks |
mpesa_transaction_status M-Pesa Transaction Status
Query the status of any M-PESA transaction by its receipt number. Use when you need to confirm what happened to a payment, or to reconcile one against your records after an STK Push, B2C or reversal. Returns the Daraja response for that transaction, whose full details can arrive asynchronously on your result URL. Read-only; it changes nothing.
| Parameter | Type | Description |
|---|---|---|
transaction_id * | string | M-Pesa receipt number e.g. QKL8XXXXXX |
mpesa_account_balance M-Pesa Account Balance
Query the balance of your business M-PESA account (shortcode or till). Use when someone asks how much is in the account. identifier_type 4 (default) means an organisation shortcode. Returns the Daraja response, with the balance delivered on your result URL. Read-only.
| Parameter | Type | Description |
|---|---|---|
identifier_type | string | 1=MSISDN, 2=Till, 4=Shortcode/Paybill |
remarks | string | Query remarks |
mpesa_query_org_info Query Org Info
Validate a shortcode and return its registered organisation name and tariff type. Use before paying a paybill or till to confirm who will actually receive the money, which helps catch a mistyped number or a lookalike business name. Returns the Daraja organisation details (registered name and tariff type). Read-only; it changes nothing.
| Parameter | Type | Description |
|---|---|---|
shortcode * | string | Shortcode to validate (paybill or till number) |
mpesa_pull_transactions Pull C2B Transactions
Pull C2B transactions in a date range for reconciliation. Use when reconciling payments received. start_date and end_date use YYYY-MM-DD HH:MM:SS; offset pages through results from 0. Returns count, the transactions, the response code and message. Read-only.
| Parameter | Type | Description |
|---|---|---|
end_date * | string | End date YYYY-MM-DD HH:MM:SS |
start_date * | string | Start date YYYY-MM-DD HH:MM:SS |
offset | integer | Pagination offset (0-based) |
mpesa_reversal M-Pesa Reversal
Reverse an erroneous M-PESA transaction by its receipt number. Use only when the user has explicitly approved reversing this exact transaction. MOVES MONEY: in live mode the person approves this exact payment through the client (a client that cannot show that prompt is refused by default; only in the opt-in param and auto modes is confirm_send=true, set only after the user approves, the fallback), and it refuses amounts above the per-transaction cap (MPESA_MAX_AMOUNT_KES, default KES 20,000); the sandbox is never restricted. Returns success, the Daraja response and the sandbox flag, or a refus…
| Parameter | Type | Description |
|---|---|---|
amount * | integer | Amount to reverse in KES |
transaction_id * | string | M-Pesa receipt to reverse e.g. QKL8XXXXXX |
confirm_send | boolean | Required in live mode: set true ONLY after the user has explicitly approved this exact payment (recipient and amount). Ignored in sandbox. |
remarks | string | Reason for reversal |
mpesa_dynamic_qr Dynamic QR Code
Generate a dynamic M-PESA QR code for a specific amount and reference. Use when a customer should pay by scanning. Returns qr_base64 (a PNG), qr_data_url usable in an HTML img tag, and the merchant, amount and reference. The QR encodes the amount you pass, so check it before showing it to a customer. Read-only; it changes nothing.
| Parameter | Type | Description |
|---|---|---|
amount * | integer | Amount in KES to encode in QR |
merchant_name * | string | Business/merchant name to display on QR |
ref_no * | string | Transaction reference number |
qr_size | integer | QR image size in pixels (300-1000) |
trx_code | string | BG=Buy Goods, PB=Paybill, WA=Wallet, SM=Send Money, SB=Lipa Shortcode |
mpesa_tax_remittance Tax Remittance to KRA
Remit tax from your M-PESA business account to the Kenya Revenue Authority. Use only when the user has explicitly approved this exact remittance. MOVES MONEY: in live mode the person approves this exact payment through the client (a client that cannot show that prompt is refused by default; only in the opt-in param and auto modes is confirm_send=true, set only after the user approves, the fallback), and it refuses amounts above the per-transaction cap (MPESA_MAX_AMOUNT_KES, default KES 20,000); the sandbox is never restricted. Returns success, the Daraja response and the sandbox flag, or a ref…
| Parameter | Type | Description |
|---|---|---|
account_reference * | string | KRA Payment Registration Number (PRN) |
amount * | integer | Tax amount in KES |
confirm_send | boolean | Required in live mode: set true ONLY after the user has explicitly approved this exact payment (recipient and amount). Ignored in sandbox. |
remarks | string | Remittance remarks |
mpesa_b2b_express_checkout B2B Express Checkout
Start a B2B Express Checkout: a USSD push to another merchant's till so they approve a payment from your account. Use only when the user has explicitly approved this exact payment. MOVES MONEY: in live mode the person approves this exact payment through the client (a client that cannot show that prompt is refused by default; only in the opt-in param and auto modes is confirm_send=true, set only after the user approves, the fallback), and it refuses amounts above the per-transaction cap (MPESA_MAX_AMOUNT_KES, default KES 20,000); the sandbox is never restricted. Returns success, the Daraja resp…
| Parameter | Type | Description |
|---|---|---|
account_reference * | string | Account reference for the transaction |
amount * | integer | Amount in KES |
receiver_till * | string | Recipient till number |
confirm_send | boolean | Required in live mode: set true ONLY after the user has explicitly approved this exact payment (recipient and amount). Ignored in sandbox. |
remarks | string | Remarks |
mpesa_bill_manager_optin Bill Manager — Opt In
Enrol your business in M-PESA Bill Manager, a one-time setup for sending invoices with payment links. Use before creating invoices. Takes the notification email and an optional logo and callback URL. Returns the Daraja response. Changes your Bill Manager registration.
| Parameter | Type | Description |
|---|---|---|
email * | string | Business email for Bill Manager notifications |
callback_url | string | Callback URL for Bill Manager events |
logo_url | string | HTTPS URL to your business logo (PNG/JPG) |
mpesa_bill_manager_invoice Bill Manager — Create Invoice
Create a Bill Manager invoice: the customer receives an SMS with the amount and a way to pay. Use when billing a customer. Sends an SMS to the customer's phone in live mode, so have the user approve the customer, amount and due date first. Returns the Daraja response for the invoice.
| Parameter | Type | Description |
|---|---|---|
amount * | number | Invoice amount in KES |
billing_ref * | string | Customer billing account reference |
due_date * | string | Payment due date YYYY-MM-DD |
external_ref * | string | Your internal invoice/reference number |
invoice_name * | string | Invoice description shown to customer |
phone * | string | Customer phone to receive SMS notification |
account_ref | string | Account reference for the payment |
mpesa_bill_manager_cancel Bill Manager — Cancel Invoice
Cancel an outstanding Bill Manager invoice by its external reference. Use when an invoice was raised in error or is no longer due. Returns the Daraja response. Cancels the invoice, so have the user approve it first; the customer will no longer be able to pay it, and a cancelled invoice cannot be restored through this tool.
| Parameter | Type | Description |
|---|---|---|
external_reference * | string | The externalReference used when creating the invoice |
mpesa_sim_swap_query SIM Swap Query
Check whether a phone number's SIM was recently swapped, a fraud signal before sending money. Use before a disbursement to an unfamiliar or high-value recipient. This queries personal data about a subscriber: do so only with a lawful basis and any consent required under the Data Protection Act 2019. Returns phone, swap_detected, last_swap_date, a risk level (HIGH if swapped) and a recommendation. Read-only.
| Parameter | Type | Description |
|---|---|---|
phone * | string | Phone number to check for SIM swap activity |
mpesa_imsi_query IMSI Query — Phone Verification
Verify a Safaricom number: registration date, SIM age, last swap date and a hashed IMSI, with risk indicators (recently swapped; SIM age below 30 as returned by the API). Use for identity or fraud checks before onboarding or paying. This queries personal data about a subscriber: do so only with a lawful basis and any consent required under the Data Protection Act 2019. Returns those fields and the risk indicators. Read-only.
| Parameter | Type | Description |
|---|---|---|
phone * | string | Phone number to verify |
sms_send Send SMS
Send an SMS to a list of recipients through Africa's Talking (at most MPESA_MAX_SMS_RECIPIENTS per call, default 50). Use only when the user has explicitly approved this exact message and recipient list. SENDS TO REAL PEOPLE: in live mode the person approves this exact message and recipient list through the client (a client that cannot show that prompt is refused by default; only in the opt-in param and auto modes is confirm_send=true, set only after the user approves, the fallback), and it refuses more recipients than the per-call cap (MPESA_MAX_SMS_RECIPIENTS, default 50); the sandbox is nev…
| Parameter | Type | Description |
|---|---|---|
message * | string | SMS message text. Unicode supported (Kiswahili etc.) |
recipients * | array | Phone numbers in E.164 format e.g. ['+254712345678'] |
confirm_send | boolean | Required in live mode: set true ONLY after the user has explicitly approved sending this exact message to these recipients. |
sender_id | string | Optional pre-registered alphanumeric sender ID |
airtime_send Send Airtime
Send airtime to a phone (Safaricom, Airtel, MTN, Vodafone and others) in a currency. Use only when the user has explicitly approved this exact top-up. MOVES MONEY: in live mode the person approves this exact top-up through the client (a client that cannot show that prompt is refused by default; only in the opt-in param and auto modes is confirm_send=true, set only after the user approves, the fallback), and it refuses amounts above the per-transaction cap (MPESA_MAX_AMOUNT_KES, default KES 20,000); the sandbox is never restricted. Returns the Africa's Talking response or a refusal saying what…
| Parameter | Type | Description |
|---|---|---|
amount * | string | Amount as string e.g. '50'. Denominated in currency_code, NOT always KES. |
phone * | string | Recipient phone in E.164 format e.g. '+254712345678' |
confirm_send | boolean | Required in live mode: set true ONLY after the user has explicitly approved this exact payment (recipient and amount). Ignored in sandbox. |
currency_code | string | ISO currency: KES, TZS, UGX, RWF, NGN, GHS, ZAR, ETB, MWK, ZMW. MUST match the recipient's country — a mismatch is rejected, not silently sent. |
get_model_hint Model Hint
Returns neutral guidance on choosing a model for these tools; no model is recommended and no benchmark or pricing claims are made. Use when someone asks which model to pair with this server. Takes no arguments. Returns a null recommendation, guidance, a deprecation note and the tool count (23). Read-only.
mpesa_session_report M-Pesa Session Report
Report this server session's spending limits and what the server itself has authorised so far. Use before a payment to check the budget left, or after one to verify what was actually authorised, from the server's own record and not the model's account. Returns the per-payment cap, the session budget, spent and remaining, whether a recipient allowlist is active, counts, and the last ten authorisations or refusals with recipients masked. Read-only.