MCP directory
MD

M-Pesa Daraja

by github.com/Mr-Macharia · v0.1.6 · updated Oct 29, 2026

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

PyPI

Run it locally

Install the package and point your AI client at it.

PyPI

uvx mpesa-daraja-mcp==0.1.6

Environment variables

  • DARAJA_CONSUMER_KEYrequiredsecret

    Daraja app Consumer Key

  • DARAJA_CONSUMER_SECRETrequiredsecret

    Daraja app Consumer Secret

  • DARAJA_ENV

    sandbox (default) or production

  • DARAJA_SHORTCODE

    Paybill / store number (174379 in sandbox)

  • DARAJA_PASSKEYsecret

    M-Pesa Express passkey (STK Push)

  • DARAJA_INITIATOR_NAME

    API operator username (B2C, B2B, status, balance, reversal)

  • DARAJA_SECURITY_CREDENTIALsecret

    Encrypted initiator password

  • DARAJA_CALLBACK_BASE_URL

    Public HTTPS base for callback URLs

  • DARAJA_CALLBACK_LISTEN

    host:port for the built-in callback receiver

  • DARAJA_CALLBACK_TOKENsecret

    16+ random characters; secret path for callbacks

  • DARAJA_TOOLSETS

    Comma list: stk,c2b,payouts,ops,qr,ratiba,billmanager

  • DARAJA_READ_ONLY

    true hides every tool that moves money or writes

  • DARAJA_APPROVAL_THRESHOLD

    Payouts above this many shillings need approval in the chat

  • DARAJA_ALLOWED_RECIPIENTS

    Comma list of phones/shortcodes that payouts may go to

  • DARAJA_ALLOW_LIVE_MONEY_MOVEMENT

    true to allow production charges and payouts

  • DARAJA_INITIATOR_PASSWORDsecret

    Initiator password, encrypted into SecurityCredential at startup (alternative to DARAJA_SECURITY_CREDENTIAL)

  • DARAJA_CERT_PATH

    Path to Safaricom's public certificate, used with DARAJA_INITIATOR_PASSWORD

  • DARAJA_STATE_DB

    Path of the SQLite file that stores request state and callbacks

  • DARAJA_OUTPUT_DIR

    Directory where generated QR PNGs are saved

  • DARAJA_CONFIG_DIR

    Directory holding the saved config (default: user config dir)

  • DARAJA_DOTENV

    Path of a .env file to load instead of the project one

  • DARAJA_MCP_TOKENsecret

    Bearer token for HTTP mode (32+ random characters)

  • DARAJA_MCP_HOST

    HTTP mode bind address (default 127.0.0.1)

  • DARAJA_MCP_PORT

    HTTP mode port (default 8000)

  • DARAJA_FORWARD_URL

    Your app's URL: every callback is POSTed on to it, HMAC-signed

  • DARAJA_FORWARD_SECRETsecret

    HMAC secret for forwarded callbacks (16+ characters)

More MCP servers