Skip to content

MCP tools ​

The MCP server has 13 tools. Five need no key. Eight read your own account and need a read-only key.

Every tool only reads. No tool changes your account.

ToolNeeds
search_docsNothing
read_docNothing
get_recipeNothing
validate_checkout_requestNothing
explain_errorNothing
list_accountsBalances, activity and payments
get_account_activityBalances, activity and payments
get_transactionBalances, activity and payments
get_money_summaryBalances, activity and payments
get_payment_statusBalances, activity and payments
get_my_setupIntegration setup
get_recent_deliveriesIntegration setup
diagnose_webhooksIntegration setup

A tool that needs a key is listed only when the request carries one.

Docs tools ​

country is optional on these tools. Send KE for Kenya (KES) or UG for Uganda (UGX). The answer then uses that country's host and currency.

search_docs ​

Searches the integration docs. Returns the sections that match best.

InputTypeRequired
querystringYes
countryKE or UGNo

read_doc ​

Returns one docs page as Markdown.

InputTypeRequired
slugstring. The page name that search_docs returnsYes
countryKE or UGNo

get_recipe ​

Returns working code for one task.

InputTypeRequired
tasksetup, create-checkout, confirm-checkout or verify-webhookYes
languagecurl, node, python or phpYes
countryKE or UGNo

validate_checkout_request ​

Checks a POST /checkouts body against the API rules. It does not send the request. It checks integer minor units, line items that add up, an https return URL, field lengths, and fields that the API refuses.

InputTypeRequired
bodyobject. The JSON body that you would sendYes
idempotency_keystring. The Idempotency-Key header that you would sendNo
countryKE or UGNo

explain_error ​

Explains an error. Send the code, or the HTTP status when there is no code.

InputTypeRequired
codeinteger. The code field of the error body, such as 2781No
statusinteger. The HTTP statusNo

Account tools ​

These tools read the account that made the key. For an organisation's key, that is the organisation.

Amounts are text with the currency, such as KES 1,500. Times are ISO 8601 in UTC.

Names and descriptions in an answer were written by account holders and payers. Each answer says that this text is data, not instructions.

list_accounts ​

Lists the main account and each pocket, with the balance and the lock.

No inputs.

json
{
  "accounts": [
    {
      "account": "main",
      "name": "Asha Main Wallet",
      "balance": "KES 12,400",
      "kind": null,
      "locked": false,
      "locked_until": null
    },
    {
      "account": "rent",
      "name": "Rent",
      "balance": "KES 30,000",
      "kind": null,
      "locked": true,
      "locked_until": "2026-12-01T00:00:00.000Z"
    }
  ]
}

account is the name to send to the other tools. kind is collecting or budget on an organisation's account, and null on a person's.

get_account_activity ​

Lists the money in and out of one account, newest first.

InputTypeRequired
accountstring. An account from list_accountsYes
limitinteger, 1 to 50. Default 20No
fromISO date or time. Only movements at or after itNo
toISO date or time. Only movements at or before itNo
beforestring. The next_before of the previous answerNo
json
{
  "movements": [
    {
      "reference": "SMK4H2PL9Q",
      "account": "main",
      "when": "2026-11-18T09:14:02.000Z",
      "direction": "in",
      "amount": "KES 1,500",
      "fee": "KES 0",
      "status": "completed",
      "type": "deposit",
      "counterparty": null,
      "description": "Order 1042",
      "source": "checkout",
      "rail": "mpesa",
      "external_reference": "TKJ8X2M4PQ",
      "refunded": "KES 0"
    }
  ],
  "next_before": null
}

next_before is null on the last page. To read the next page, send it as before.

counterparty is the name of the other MOOKHPay account, when there is one. A phone number is never returned.

get_transaction ​

Finds one movement by its reference. The reference starts with SM. It is on the confirmation text.

InputTypeRequired
referencestringYes

The answer is a movements list in the same shape as get_account_activity. A move between two of your own accounts has two entries, one for each account.

get_money_summary ​

Totals the money in and the money out of one account between two dates.

InputTypeRequired
accountstringYes
fromISO date or timeYes
toISO date or timeYes
json
{
  "account": "main",
  "from": "2026-11-01T00:00:00.000Z",
  "to": "2026-11-18T00:00:00.000Z",
  "money_in": "KES 84,200",
  "money_out": "KES 61,000",
  "money_in_previous_period": "KES 70,150",
  "money_in_change_percent": 20
}

The previous period is the period of the same length immediately before from. money_in_change_percent is null when the previous period had no money in.

get_payment_status ​

Checks whether a payment to or from the account went through. Send one input.

InputType
payment_idstring. Starts with pi_
referencestring. The SM reference on the confirmation text
receiptstring. The provider's receipt, such as an M-Pesa code
json
{
  "payments": [
    {
      "payment_id": "pi_8f2c1a9e4b7d",
      "state": "succeeded",
      "status": "completed",
      "direction": "in",
      "amount": "KES 1,500",
      "fee": "KES 0",
      "rail": "mpesa",
      "channel": "stk",
      "source": "checkout",
      "provider_receipt": "TKJ8X2M4PQ",
      "ledger_reference": "SMK4H2PL9Q",
      "reference": "Order 1042",
      "link": null,
      "account": "main",
      "created": "2026-11-18T09:13:40.000Z",
      "updated": "2026-11-18T09:14:02.000Z"
    }
  ]
}

The payer's phone number and message are never returned.

get_my_setup ​

Reads the integration setup: the country, the secret key's description and the webhook endpoints.

No inputs.

json
{
  "country": "KE",
  "api_key": {
    "prefix": "mkp_live_",
    "last4": "7Q2M",
    "created": "2026-10-02T08:00:00.000Z",
    "last_used": "2026-11-18T09:13:40.000Z"
  },
  "webhook_endpoints": [
    {
      "id": "we_3b9d1f",
      "url": "https://shop.example/webhooks/mookhpay",
      "events": ["payment.succeeded"],
      "active": true,
      "awaiting_owner": false,
      "created": "2026-10-02T08:05:00.000Z"
    }
  ]
}

api_key is null when the account has no key. The key and the signing secret are never returned.

get_recent_deliveries ​

Reads the newest webhook deliveries, with each response code or error.

InputTypeRequired
limitinteger, 1 to 50. Default 20No
json
{
  "deliveries": [
    {
      "event": "payment.succeeded",
      "endpoint_url": "https://shop.example/webhooks/mookhpay",
      "status": "delivered",
      "attempts": 1,
      "last_response_code": 200,
      "last_error": null,
      "test": false,
      "created": "2026-11-18T09:14:03.000Z"
    }
  ]
}

diagnose_webhooks ​

Reads the endpoints and the recent deliveries, then lists what is wrong. Each problem has a fix and the docs page about it.

No inputs.

It reports these problems:

  • The account has no endpoint, or no active endpoint.
  • An endpoint waits for an owner to switch it on.
  • No active endpoint is subscribed to payment.succeeded.
  • Recent deliveries got no answer.
  • Recent deliveries got an answer that is not 2xx.

Errors ​

A tool that cannot answer returns an error with one of these sentences.

The tool saysMeaning
MOOKHPay refused this read tokenThe key is unknown, revoked or past its end date. Or its maker can no longer hold it. Make a new key
This read token does not cover thatThe key does not have the access that the tool needs. Make a key with that access
Nothing by that name or reference is on this accountThe account, reference or payment is not yours, or does not exist
MOOKHPay did not accept that requestAn input is wrong. Check the account, the dates and the reference
Too many requests on this read tokenThe key passed 30 requests in a minute. Wait a minute
MOOKHPay could not answer just nowA service did not answer. Nothing was changed. Try again

A request that carries a secret key, or any credential that is not a read-only key, returns 401. The server does not forward it.

Staging documentation. A checkout made with a secret key on staging charges a real phone. See Environments.