stk_pushLABSCO SUMMARY
Built for the sandbox — the authors say it is not production ready.
The README asks you to do your own security testing, error handling and Safaricom compliance work before real money moves through it, and development has since moved to a different repository. Treat this as the version you experiment and learn with.
What it is
A Python server over Safaricom's Daraja API that lets an assistant start M-Pesa payment requests and generate payment QR codes, with a prompt for composing the request.
What you get
stk_push— send an STK push so the customer authorises the payment on their own phone; takesamountandphone_numberand returns the M-Pesa API responsegenerate_qr_code— a scannable payment QR built from merchant name, transaction reference, amount, transaction type and the credit party identifier- An
stk_push_promptthat assembles the payment request from a phone number, an amount and a stated purpose - OAuth authentication against Daraja handled by the server rather than by you
Requirements
Python 3.12 and Daraja API credentials — a consumer key and secret — in a .env copied from the example. Install with uv: uv venv, activate it, uv sync, then point your client at uv --directory <YOUR_PATH_TO_PARENT>/FOLDER/DarajaMCP run main.py. Use the sandbox environment for development and switch the URL for production.
Setup effort
Build from source — git clone https://github.com/jameskanyiri/DarajaMCP.git
USE CASES
Testing a payment flow while you build it
Fire an STK push at a sandbox number and read the raw M-Pesa response in the same conversation.
Producing a QR for a counter or an invoice
Generate the payment code from the merchant details, amount and transaction type.
Getting the request fields right
The prompt asks for the phone number, amount and purpose and assembles the call from them.
Learning what Daraja expects
Watch the request and response for a real call instead of reading the API reference cold.
8 tools
Listed in project docs. Your client may show a different list.
generate_qr_codecreate_sourcecreate_destinationcreate_workflowrun_workflowget_workflow_detailsfetch_documentsBEFORE YOU INSTALL
What to know first
Tools you get
8 tools named in the project's documentation.
Requires
- uv on PATH
- Python 3.12
Where it runs
Both documented setups run the server on your machine.
INSTALLATION
Connect your client
You clone this one yourself.
Server setup
git clone https://github.com/jameskanyiri/DarajaMCP.git
cd DarajaMCP
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv sync
cp .env.example .envMCP Clients
Claude Desktop — uv
{
"mcpServers": {
"daraja": {
"command": "uv",
"args": [
"--directory",
"<YOUR_PATH_TO_PARENT>/FOLDER/DarajaMCP",
"run",
"main.py"
]
}
}
}Claude Desktop — Full uv path
{
"mcpServers": {
"DarajaMCP": {
"command": "<YOUR_PATH_TO_PARENT>/.local/bin/uv",
"args": [
"--directory",
"<YOUR_PATH_TO_PARENT>/FOLDER/DarajaMCP",
"run",
"main.py"
]
}
}
}