# M-Pesa Daraja (pypi · mpesa-daraja-mcp)

Safaricom M-Pesa Daraja tools: STK Push, C2B, B2C, B2B, QR, Ratiba. Sandbox-first, idempotent.

- Trust score: 83/100 (high trust)
- Change this week: +18
- Registry status: active
- Liveness: live
- Owner verified: no
- Last scored: 2026-11-05

## Components

- pypi · `mpesa-daraja-mcp`: 83/100 (this document), [markdown](https://verifymcp.io/servers/mr-macharia-mpesa-daraja-mcp/mpesa-daraja-mcp.md), [page](https://verifymcp.io/servers/mr-macharia-mpesa-daraja-mcp/mpesa-daraja-mcp)

## Channel facts

- Registry: `pypi`
- Package: `mpesa-daraja-mcp`
- Version: `0.1.6`
- Transport: `stdio`

## Trust breakdown

How this component scores in each security and reliability category. Every signal is checked automatically from public evidence about the published package, including repeated runs of it in an isolated sandbox, and we only credit what we can confirm. Scores are 0–100 per category. Scoring method: https://verifymcp.io/docs/scoring (what has changed: https://verifymcp.io/docs/scoring/changelog)

Scored 2026-11-05.

- **Supply Chain Security**: 100/100
  - No malware found by supply-chain analysis.
  - No known CVEs affecting this package version or its production dependencies.
  - Runs hatchling.build at install time, a recognised build step with no custom scripting around it.
  - 4 of 45 dependencies flagged as unhealthy.
- **Provenance & Transparency**: 100/100
  - Source repository is publicly reachable at the declared URL.
  - Cryptographically verified build provenance (signed, bound to Mr-Macharia/mpesa-daraja-skills-and-mcp).
  - Clear OSI-approved license (MIT).
  - Actively maintained (last published 7 days ago).
  - Publishes a security disclosure policy (SECURITY.md).
- **Schema Quality & AI Usability**: 56/100
  - AI-judged instruction clarity (fair).
  - Tool/resource definitions use about 2073 tokens (~86/item across 24 items; 24 tools + 0 resources), lean.
  - Usage-examples check failed: none of the tools include examples.
- **Stability & Change Management**: 53/100
  - Stability observed for 16 of 30 days with no destabilising changes; credit accrues until the full window elapses.
- **Tool Coverage**: 71/100
  - 100% of tools have a non-trivial description (not blank, and not just the tool's name).
  - 0% of tool parameters carry a description.
  - Structured output schemas are declared (75% of tools); any adoption earns full credit.
- **Tool Safety**: 100/100
  - No prompt-injection markers were found in the server instructions, tool names or descriptions we captured.
  - All 5 tool(s) whose name or description implies an irreversible operation declare an MCP destructiveHint annotation.
  - An AI judge read all 25 captured unit(s) of tool text and found none that tries to manipulate the model reading it.
- **Capabilities**: 100/100
  - Implements a current MCP spec version (2026-07-28).

## Install

### How do I install the M-Pesa Daraja MCP server?

M-Pesa Daraja runs locally as a PyPI package, launched with uvx mpesa-daraja-mcp. Ready-made configuration for Claude, Cursor, VS Code, Codex and 5 more is on this page, copied from each client's own documentation.

### Claude

```bash
claude mcp add mr-macharia-mpesa-daraja-mcp -- uvx mpesa-daraja-mcp
```

### Cursor

```json
{
  "mcpServers": {
    "mr-macharia-mpesa-daraja-mcp": {
      "command": "uvx",
      "args": [
        "mpesa-daraja-mcp"
      ]
    }
  }
}
```

### VS Code

```json
{
  "servers": {
    "mr-macharia-mpesa-daraja-mcp": {
      "command": "uvx",
      "args": [
        "mpesa-daraja-mcp"
      ]
    }
  }
}
```

### Codex

```bash
codex mcp add mr-macharia-mpesa-daraja-mcp -- uvx mpesa-daraja-mcp
```

### opencode

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "mr-macharia-mpesa-daraja-mcp": {
      "type": "local",
      "command": [
        "uvx",
        "mpesa-daraja-mcp"
      ],
      "enabled": true
    }
  }
}
```

### OpenClaw

```bash
openclaw mcp add mr-macharia-mpesa-daraja-mcp --command uvx --arg mpesa-daraja-mcp
```

### Hermes

```yaml
mcp_servers:
  mr-macharia-mpesa-daraja-mcp:
    command: "uvx"
    args: ["mpesa-daraja-mcp"]
```

### Netclaw

```json
{
  "McpServers": {
    "mr-macharia-mpesa-daraja-mcp": {
      "Transport": "stdio",
      "Command": "uvx",
      "Arguments": [
        "mpesa-daraja-mcp"
      ]
    }
  }
}
```

### Vellum

```bash
assistant mcp add mr-macharia-mpesa-daraja-mcp -t stdio -c uvx -a mpesa-daraja-mcp
```

### Other

```json
{
  "mcpServers": {
    "mr-macharia-mpesa-daraja-mcp": {
      "command": "uvx",
      "args": [
        "mpesa-daraja-mcp"
      ]
    }
  }
}
```

## Changelog

Every change recorded for this component, newest first. Days that predate change tracking, or that we cannot explain, say so: "we were watching and nothing happened" and "we were not watching" are different claims.

### 2026-11-05 (score 83, +15)

- [security improvement] Malware scan: unverified → pass

### 2026-11-04 (score 68, +1)

No change was recorded against any check on this day. Stability & Change Management went from 47 to 50. That category is still filling its 30-day observation window: 14 days of observed history at the previous scan, 15 at this one. The score rises as the window fills, whether or not the server changes.

### 2026-11-02 (score 67, −14)

- [security regression] Malware scan: pass → unverified

### 2026-11-01 (score 81, +15)

- [security improvement] Malware scan: unverified → pass

### 2026-10-31 (score 66, +1)

No change was recorded against any check on this day. Stability & Change Management went from 33 to 37. That category is still filling its 30-day observation window: 10 days of observed history at the previous scan, 11 at this one. The score rises as the window fills, whether or not the server changes.

### 2026-10-29 (score 65, −15)

- [security regression] Malware scan: pass → unverified
- [security regression] Stability: 0.27 → unverified
- [security regression] Tool safety: pass → unverified
- [functional regression] Capabilities: pass → unverified
- [functional regression] Tool coverage: 100 → unverified
- [functional] First check of Schema quality: unverified
- [functional] Package version: 0.1.4 → 0.1.6
- [functional] Package version: 0.1.4 → 0.1.5

### 2026-10-28 (score 80, +1)

No change was recorded against any check on this day. Stability & Change Management went from 23 to 27. That category is still filling its 30-day observation window: 7 days of observed history at the previous scan, 8 at this one. The score rises as the window fills, whether or not the server changes.

### 2026-10-26 (score 79, +1)

No change was recorded against any check on this day. Stability & Change Management went from 17 to 20. That category is still filling its 30-day observation window: 5 days of observed history at the previous scan, 6 at this one. The score rises as the window fills, whether or not the server changes.

## MCP tools (24)

### `mpesa_explain_code` (~64 tokens)

Explain a Daraja errorCode (e.g. 400.002.02, 500.001.1001) or ResultCode (e.g. 1032, 2001, C2B00012).

Input parameters:

- `code` (string, required)

### `mpesa_normalize_phone` (~44 tokens)

Convert a Kenyan phone number (07.., +254.., 7..) into Daraja's 2547XXXXXXXX format.

Input parameters:

- `phone` (string, required)

### `mpesa_generate_stk_password` (~55 tokens)

Build the STK Push Password = base64(shortcode + passkey + timestamp) with an EAT timestamp.

Input parameters:

- `passkey` (string, required)
- `shortcode` (string, required)
- `timestamp`

### `mpesa_parse_callback` (~48 tokens)

Parse any Daraja callback (STK, C2B, Result envelopes, Ratiba, B2B Express, Bill Manager) into flat fields.

Input parameters:

- `payload` (object, required)

### `mpesa_setup_status` (~48 tokens)

Show what is configured (names and sources only, never values), what each toolset is missing,
and how the user can fix it. Call this first when a tool reports missing configuration.

### `mpesa_check_credentials` (~29 tokens)

Verify the configured consumer key/secret by fetching an OAuth token. Never returns the token itself.

### `mpesa_get_result` (~76 tokens)

Final status of a request by idempotency_key or any Daraja ID (CheckoutRequestID, ConversationID...).

Reads callbacks captured by the built-in receiver. For STK requests with no callback yet,
refresh=True asks Daraja via STK Query.

Input parameters:

- `id` (string, required)
- `refresh` (boolean)

Output parameters:

- `duplicate` (boolean)
- `explanation` (string|null)
- `idempotency_key` (string|null)
- `ids` (object)
- `message` (string)
- `raw` (object|null)
- `receipt` (string|null)
- `result_code` (string|null)
- `status` (string)

### `mpesa_stk_push` (~145 tokens)

Send an M-Pesa Express (STK Push) PIN prompt and return immediately with status ACCEPTED.

Prefer mpesa_stk_push_and_wait when the final result is needed. For Buy Goods, pass the Till as
party_b (DARAJA_SHORTCODE stays the store number). Pass idempotency_key (e.g. the order ID) to
prevent double prompts.

Input parameters:

- `account_reference` (string, required)
- `amount` (integer, required)
- `callback_url`
- `description` (string)
- `idempotency_key`
- `party_b`
- `phone` (string, required)
- `transaction_type` (string)

Output parameters:

- `duplicate` (boolean)
- `explanation` (string|null)
- `idempotency_key` (string|null)
- `ids` (object)
- `message` (string)
- `raw` (object|null)
- `receipt` (string|null)
- `result_code` (string|null)
- `status` (string)

### `mpesa_stk_push_and_wait` (~110 tokens)

Send an STK Push and wait for the final result (SUCCESS / FAILED / UNKNOWN) in one call.

Uses callbacks from the built-in receiver when configured, and STK Query otherwise.

Input parameters:

- `account_reference` (string, required)
- `amount` (integer, required)
- `description` (string)
- `idempotency_key`
- `party_b`
- `phone` (string, required)
- `timeout_s` (integer)
- `transaction_type` (string)

Output parameters:

- `duplicate` (boolean)
- `explanation` (string|null)
- `idempotency_key` (string|null)
- `ids` (object)
- `message` (string)
- `raw` (object|null)
- `receipt` (string|null)
- `result_code` (string|null)
- `status` (string)

### `mpesa_stk_query` (~42 tokens)

Final status of an STK Push. status=ACCEPTED means Safaricom is still processing it.

Input parameters:

- `checkout_request_id` (string, required)

Output parameters:

- `duplicate` (boolean)
- `explanation` (string|null)
- `idempotency_key` (string|null)
- `ids` (object)
- `message` (string)
- `raw` (object|null)
- `receipt` (string|null)
- `result_code` (string|null)
- `status` (string)

### `mpesa_c2b_register_urls` (~65 tokens)

Register C2B Confirmation and Validation URLs for a Paybill/Till. In production this is effectively one-time.

Input parameters:

- `confirmation_url` (string, required)
- `response_type` (string)
- `shortcode`
- `validation_url` (string, required)

### `mpesa_c2b_simulate` (~63 tokens)

Simulate a customer C2B payment (SANDBOX ONLY). Register URLs first.

Input parameters:

- `amount` (integer, required)
- `bill_ref`
- `command` (string)
- `phone` (string)
- `shortcode`

### `mpesa_pull_transactions` (~73 tokens)

Fetch C2B transactions for a window ('YYYY-MM-DD HH:MM:SS') via Pull Transactions.

Recovers missed confirmations. Production only, for shortcodes registered for Pull.

Input parameters:

- `end` (string, required)
- `offset` (integer)
- `shortcode`
- `start` (string, required)

### `mpesa_b2c_payment` (~151 tokens)

Pay a customer wallet (or Pochi la Biashara with BusinessPayToPochi).

idempotency_key is required (e.g. 'refund-order-1042'): repeating it never pays twice.
For a refund, pass refund_of = the original M-Pesa receipt (e.g. 'NLJ7RT61SV').

Input parameters:

- `amount` (integer, required)
- `command` (string)
- `idempotency_key` (string, required)
- `occasion` (string)
- `party_a`
- `phone` (string, required)
- `refund_of`
- `remarks` (string, required)
- `result_url`
- `timeout_url`

Output parameters:

- `duplicate` (boolean)
- `explanation` (string|null)
- `idempotency_key` (string|null)
- `ids` (object)
- `message` (string)
- `raw` (object|null)
- `receipt` (string|null)
- `result_code` (string|null)
- `status` (string)

### `mpesa_b2b_payment` (~154 tokens)

Pay a business: BusinessPayBill (Paybill + account), BusinessBuyGoods (Till), BusinessPayToBulk
(B2C utility top-up) or PayTaxToKRA (receiver 572572, account_reference = KRA PRN).

idempotency_key is required except for PayTaxToKRA, where the PRN is the key.

Input parameters:

- `account_reference` (string, required)
- `amount` (integer, required)
- `command` (string)
- `idempotency_key`
- `party_a`
- `receiver_shortcode` (string, required)
- `remarks` (string)
- `requester_phone`
- `result_url`
- `timeout_url`

Output parameters:

- `duplicate` (boolean)
- `explanation` (string|null)
- `idempotency_key` (string|null)
- `ids` (object)
- `message` (string)
- `raw` (object|null)
- `receipt` (string|null)
- `result_code` (string|null)
- `status` (string)

### `mpesa_b2b_express_checkout` (~94 tokens)

Push a USSD prompt to a merchant's till operator to pay your Paybill (B2B Express Checkout).

Input parameters:

- `amount` (integer, required)
- `callback_url`
- `idempotency_key` (string, required)
- `merchant_till` (string, required)
- `partner_name` (string, required)
- `payment_ref` (string, required)
- `vendor_paybill` (string, required)

Output parameters:

- `duplicate` (boolean)
- `explanation` (string|null)
- `idempotency_key` (string|null)
- `ids` (object)
- `message` (string)
- `raw` (object|null)
- `receipt` (string|null)
- `result_code` (string|null)
- `status` (string)

### `mpesa_transaction_status` (~89 tokens)

Ask M-Pesa for the final state of a transaction by receipt or OriginatorConversationID.
The answer arrives on the ResultURL; read it with mpesa_get_result using the returned ID.

Input parameters:

- `identifier_type` (string)
- `original_conversation_id`
- `party_a`
- `result_url`
- `timeout_url`
- `transaction_id`

Output parameters:

- `duplicate` (boolean)
- `explanation` (string|null)
- `idempotency_key` (string|null)
- `ids` (object)
- `message` (string)
- `raw` (object|null)
- `receipt` (string|null)
- `result_code` (string|null)
- `status` (string)

### `mpesa_account_balance` (~46 tokens)

Request shortcode balances. The parsed balances arrive via mpesa_get_result using the returned ID.

Input parameters:

- `party_a`
- `result_url`
- `timeout_url`

Output parameters:

- `duplicate` (boolean)
- `explanation` (string|null)
- `idempotency_key` (string|null)
- `ids` (object)
- `message` (string)
- `raw` (object|null)
- `receipt` (string|null)
- `result_code` (string|null)
- `status` (string)

### `mpesa_reverse_transaction` (~90 tokens)

Reverse a C2B payment received on your shortcode (needs a human-approved reason).

transaction_id is the original M-Pesa receipt. One reversal per transaction_id: repeats return
the stored request.

Input parameters:

- `amount` (integer, required)
- `receiver_shortcode`
- `remarks` (string, required)
- `result_url`
- `timeout_url`
- `transaction_id` (string, required)

Output parameters:

- `duplicate` (boolean)
- `explanation` (string|null)
- `idempotency_key` (string|null)
- `ids` (object)
- `message` (string)
- `raw` (object|null)
- `receipt` (string|null)
- `result_code` (string|null)
- `status` (string)

### `mpesa_generate_dynamic_qr` (~127 tokens)

Generate an M-Pesa Dynamic QR and save it as a PNG; returns the file path (not the image, to save context).
trx_code: BG Buy Goods, PB Paybill, WA agent withdraw, SM send money, SB send to business.
cpi = till/paybill/phone.

Input parameters:

- `amount` (integer, required)
- `cpi` (string, required)
- `include_base64` (boolean)
- `merchant_name` (string, required)
- `ref_no` (string, required)
- `size` (integer)
- `trx_code` (string)

### `mpesa_ratiba_create_standing_order` (~153 tokens)

Create an M-Pesa Ratiba standing order (the customer consents with their PIN). One order per phone + name.
Dates YYYYMMDD. frequency: 1 one-off, 2 daily, 3 weekly, 4 monthly, 5 bi-monthly,
6 quarterly, 7 half-year, 8 yearly.

Input parameters:

- `account_reference` (string, required)
- `amount` (integer, required)
- `callback_url`
- `description` (string)
- `end_date` (string, required)
- `frequency` (string, required)
- `name` (string, required)
- `phone` (string, required)
- `start_date` (string, required)
- `till` (boolean)

Output parameters:

- `duplicate` (boolean)
- `explanation` (string|null)
- `idempotency_key` (string|null)
- `ids` (object)
- `message` (string)
- `raw` (object|null)
- `receipt` (string|null)
- `result_code` (string|null)
- `status` (string)

### `mpesa_bill_manager_optin` (~64 tokens)

Onboard the shortcode to M-Pesa Bill Manager (required once before sending invoices). Returns an app_key.

Input parameters:

- `callback_url`
- `email` (string, required)
- `official_contact` (string, required)
- `send_reminders` (boolean)

### `mpesa_bill_manager_send_invoice` (~119 tokens)

Send one Bill Manager e-invoice by SMS.

billed_period like 'August 2026', due_date 'YYYY-MM-DD', items: [{'itemName': ..., 'amount': ...}].

Input parameters:

- `account_reference` (string, required)
- `amount` (integer, required)
- `billed_period` (string, required)
- `due_date` (string, required)
- `external_reference` (string, required)
- `full_name` (string, required)
- `invoice_name` (string, required)
- `items`
- `phone` (string, required)

### `mpesa_bill_manager_cancel_invoice` (~37 tokens)

Cancel an unpaid Bill Manager invoice (partially/fully paid invoices cannot be cancelled).

Input parameters:

- `external_reference` (string, required)

## Diagnostics

Captured diagnostic sections: Provenance, Install scripts, Dependencies. The full working is on the page: https://verifymcp.io/servers/mr-macharia-mpesa-daraja-mcp/mpesa-daraja-mcp#diagnostics

## Score history

- 2026-11-05: 83
- 2026-11-04: 68
- 2026-11-03: 67
- 2026-11-02: 67
- 2026-11-01: 81
- 2026-10-31: 66
- 2026-10-30: 65
- 2026-10-29: 65
- 2026-10-28: 80
- 2026-10-27: 79
- 2026-10-26: 79
- 2026-10-25: 78
- 2026-10-24: 78
- 2026-10-23: 77
- 2026-10-22: 76
- 2026-10-21: 76
- 2026-10-20: 55

## Common questions

### What is the M-Pesa Daraja MCP server?

M-Pesa Daraja is an MCP server listed in the public MCP registry as io.github.Mr-Macharia/mpesa-daraja-mcp. Safaricom M-Pesa Daraja tools: STK Push, C2B, B2C, B2B, QR, Ratiba. Sandbox-first, idempotent. This page covers its PyPI package (mpesa-daraja-mcp).

### Is the M-Pesa Daraja MCP server safe to use?

M-Pesa Daraja scores 83 out of 100 on VerifyMCP. We found no known CVEs affecting it as of 5 November 2026. Its build provenance is signed and verified. That is a record of what we were able to check automatically, not an endorsement. The category breakdown on this page shows every signal behind the number, including the ones we could not confirm.

### What tools does the M-Pesa Daraja MCP server expose?

M-Pesa Daraja exposes 24 tools: mpesa_explain_code, mpesa_normalize_phone, mpesa_generate_stk_password, mpesa_parse_callback, mpesa_setup_status, and 19 more. Their descriptions and schemas cost roughly 1,986 tokens of context every time the server is loaded.

### Is the M-Pesa Daraja MCP server still maintained?

M-Pesa Daraja is still listed as active in the MCP registry. We last reached this channel on 5 November 2026. Those dates come from our own scans of the registry and the channel itself, not from anything the publisher announced.

### What licence is the M-Pesa Daraja MCP server under?

M-Pesa Daraja declares the MIT licence, which is OSI-approved. That covers the source only, and says nothing about the cost of any service it calls.

### What did VerifyMCP test on the M-Pesa Daraja MCP server?

VerifyMCP ran 16 checks on M-Pesa Daraja, covering Malware scan, Known CVEs, Install scripts, Dependency health and 12 more. Endpoint Security and Transport & Reachability do not apply to a PyPI package, so they were not tested. The score does not measure everything, and the scoring documentation lists what it leaves out.

## Links

- PyPI project: https://pypi.org/project/mpesa-daraja-mcp/
- Socket report: https://socket.dev/pypi/package/mpesa-daraja-mcp
- Repository: https://github.com/Mr-Macharia/mpesa-daraja-skills-and-mcp
- Changelog RSS feed: https://verifymcp.io/servers/mr-macharia-mpesa-daraja-mcp/mpesa-daraja-mcp.xml
- Changelog JSON feed: https://verifymcp.io/servers/mr-macharia-mpesa-daraja-mcp/mpesa-daraja-mcp/changelog.json
- Trust report (JSON): https://verifymcp.io/servers/mr-macharia-mpesa-daraja-mcp/mpesa-daraja-mcp.json
- HTML version of this page: https://verifymcp.io/servers/mr-macharia-mpesa-daraja-mcp/mpesa-daraja-mcp
