能做什么
Safaricom M-Pesa Daraja tools: STK Push, C2B, B2C, B2B, QR, Ratiba. Sandbox-first, idempotent.
作者提供的原文
- 连接方式 在你的电脑上运行
- 账号或密钥 需要 DARAJA_CONSUMER_KEY, DARAJA_CONSUMER_SECRET, DARAJA_PASSKEY, DARAJA_SECURITY_CREDENTIAL, DARAJA_CALLBACK_TOKEN, DARAJA_INITIATOR_PASSWORD, DARAJA_MCP_TOKEN, DARAJA_FORWARD_SECRET
- 分类 开发者工具
可搭配使用
教 AI 做这类工作的 Skill,可与本项一起使用
andrej-karpathy-skills
A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.
graphify
Turn any codebase, with its docs, SQL schemas, configs, and PDFs, into a queryable knowledge graph. A /graphify skill for Claude Code, Cursor, Codex, and Gemini CLI: local deterministic AST parsing, every edge explained, no vector store.
为什么排在这里
列表按使用分(满分 100)排序,由以下部分组成
| 热度 | 0/80 | GitHub 星标或每周下载量:较大的计 60,较小的计 20 |
|---|---|---|
| 新鲜度 | 12/12 | 30 天内有发布或代码更新得满分 |
| 仍在响应 | 0/8 | 上次检查时云端端点有响应 |
| 使用分 | 12/100 |
质量: 基础检查通过 3/3 项(仅展示,不用于排序) · 上升势头: 暂无数据 (只用于“上升中”标签)
安装
选择你使用的 AI 应用,然后复制设置。
用一句话让 AI 帮你安装
请帮我安装 M-Pesa Daraja。按照 https://mcp.popnx.com/i/mr-macharia-mpesa-daraja-mcp.md 操作,先把命令给我看,等我同意后再运行。粘贴到能在你电脑上工作的 AI(如 Claude Code、Cursor)。它会读取我们的步骤,先给你看命令,等你同意。无需密钥,无需注册。 · 查看 AI 会读取的全文
通过 3/3 项检查 · 在你的电脑上运行 · ✓ 命令已检查 2026年11月14日
第一步:你用哪个 AI?
选择你用的应用,步骤会显示在下方。
可连接 Claude,但需要先准备
需要 M-Pesa Daraja 的密钥(在开发者网站创建) · 需要先在电脑上安装 Python (uv)(只需一次) · 仅限电脑上的 Claude 应用(Windows 或 Mac),网页和手机不可用
让 AI 帮你安装
把这段话复制到 Claude 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。
请在这台电脑上为 Claude 安装 MCP server M-Pesa Daraja,按顺序:1) 用 uv --version 检查是否有 uv。没有的话,请让我从 https://docs.astral.sh/uv/getting-started/installation/ 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):{ "mcpServers": { "mpesa-daraja": { "command": "uvx", "args": [ "mpesa-daraja-mcp" ], "env": { "DARAJA_CONSUMER_KEY": "your-value", "DARAJA_CONSUMER_SECRET": "your-value", "DARAJA_PASSKEY": "your-value", "DARAJA_SECURITY_CREDENTIAL": "your-value", "DARAJA_CALLBACK_TOKEN": "your-value", "DARAJA_INITIATOR_PASSWORD": "your-value", "DARAJA_MCP_TOKEN": "your-value", "DARAJA_FORWARD_SECRET": "your-value" } } } } 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) DARAJA_CONSUMER_KEY, DARAJA_CONSUMER_SECRET, DARAJA_PASSKEY, DARAJA_SECURITY_CREDENTIAL, DARAJA_CALLBACK_TOKEN, DARAJA_INITIATOR_PASSWORD, DARAJA_MCP_TOKEN, DARAJA_FORWARD_SECRET 先保留 "your-value",请我自己把真实值粘贴到文件或应用的输入框里。不要让我在对话里输入密钥。5) 按约定执行,然后确认 M-Pesa Daraja 的工具真的出现了。这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。
安装 uv(如果还没有)
已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter
uv --version- 显示版本号(例如 uv …)= 已安装,可跳过这一步
- 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
怎么打开终端
Mac:按 ⌘ + Space,输入 Terminal 后按 Enter
Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”
还没安装: uv 没有点选式安装程序。从 uv 官方页面复制适合你系统(macOS 或 Windows)的一行命令,粘贴到终端 · 不需要单独安装 Python,uv 会在需要时自动下载
装好后关掉终端再打开,重新运行同一条命令,应显示版本号:
uv --version安装一次,所有需要 uv 的工具都能用
打开电脑版 Claude 应用的设置文件
SettingsDeveloperEdit Config
粘贴这些设置并保存文件
{ "mcpServers": { "mpesa-daraja": { "command": "uvx", "args": [ "mpesa-daraja-mcp" ], "env": { "DARAJA_CONSUMER_KEY": "your-value", "DARAJA_CONSUMER_SECRET": "your-value", "DARAJA_PASSKEY": "your-value", "DARAJA_SECURITY_CREDENTIAL": "your-value", "DARAJA_CALLBACK_TOKEN": "your-value", "DARAJA_INITIATOR_PASSWORD": "your-value", "DARAJA_MCP_TOKEN": "your-value", "DARAJA_FORWARD_SECRET": "your-value" } } } }只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人
退出 Claude 再重新打开
试一试
用 M-Pesa Daraja 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Claude 说正在使用 M-Pesa Daraja,或回答中出现 M-Pesa Daraja 的工具名称,就表示连接成功
18 项可选设置(不填也能用)
上面的命令不填这些也能用。想调整时再按开发者的说明添加。
DARAJA_ENVsandbox(默认)或 production查看英文原文
sandbox (default) or productionDARAJA_SHORTCODEPaybill / 商户号(沙盒中为 174379)查看英文原文
Paybill / store number (174379 in sandbox)DARAJA_INITIATOR_NAMEAPI 操作员用户名(B2C、B2B、status、balance、reversal)查看英文原文
API operator username (B2C, B2B, status, balance, reversal)DARAJA_CALLBACK_BASE_URL回调 URL 使用的公开 HTTPS 基础地址查看英文原文
Public HTTPS base for callback URLsDARAJA_CALLBACK_LISTEN内置回调接收器的 host:port查看英文原文
host:port for the built-in callback receiverDARAJA_TOOLSETS逗号分隔列表:stk,c2b,payouts,ops,qr,ratiba,billmanager查看英文原文
Comma list: stk,c2b,payouts,ops,qr,ratiba,billmanagerDARAJA_READ_ONLY设为 true 时,隐藏所有涉及资金转移或写入的工具。查看英文原文
true hides every tool that moves money or writesDARAJA_APPROVAL_THRESHOLD超过此金额(先令)的付款需要在聊天中获得批准查看英文原文
Payouts above this many shillings need approval in the chatDARAJA_ALLOWED_RECIPIENTS付款(payouts)可发送至的电话号码或短代码的逗号分隔列表查看英文原文
Comma list of phones/shortcodes that payouts may go toDARAJA_ALLOW_LIVE_MONEY_MOVEMENT设为 true 以允许生产环境的收费和付款查看英文原文
true to allow production charges and payoutsDARAJA_CERT_PATHSafaricom 公共证书的路径,与 DARAJA_INITIATOR_PASSWORD 配合使用查看英文原文
Path to Safaricom's public certificate, used with DARAJA_INITIATOR_PASSWORDDARAJA_STATE_DB存储请求状态和回调的 SQLite 文件的路径。查看英文原文
Path of the SQLite file that stores request state and callbacksDARAJA_OUTPUT_DIR保存生成的 QR PNG 的目录查看英文原文
Directory where generated QR PNGs are savedDARAJA_CONFIG_DIR保存已保存配置的目录(默认:用户配置目录)查看英文原文
Directory holding the saved config (default: user config dir)DARAJA_DOTENV要加载的 .env 文件路径,替代项目中的文件查看英文原文
Path of a .env file to load instead of the project oneDARAJA_MCP_HOSTHTTP 模式的绑定地址(默认 127.0.0.1)查看英文原文
HTTP mode bind address (default 127.0.0.1)DARAJA_MCP_PORTHTTP 模式端口(默认 8000)查看英文原文
HTTP mode port (default 8000)DARAJA_FORWARD_URL您的应用 URL:每个回调都会通过 POST 发送到该地址,并附带 HMAC 签名查看英文原文
Your app's URL: every callback is POSTed on to it, HMAC-signed
说明为自动翻译,变量名保持原样;不确定时请查看原文。
菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同
ChatGPT 暂时无法连接 M-Pesa Daraja
M-Pesa Daraja 需要安装在你的电脑上,而 ChatGPT 只能连接在网上运行的服务器
你可以改用这些方式
A · 使用能连接 M-Pesa Daraja 的应用
- 需要 M-Pesa Daraja 的密钥(在开发者网站创建) · 需要先在电脑上安装 Python (uv)(只需一次) · 仅限电脑上的 Claude 应用(Windows 或 Mac),网页和手机不可用
- 需要 M-Pesa Daraja 的密钥(在开发者网站创建) · 需要先在电脑上安装 Python (uv)(只需一次)
- 需要 M-Pesa Daraja 的密钥(在开发者网站创建) · 需要先在电脑上安装 Python (uv)(只需一次)
- 需要 M-Pesa Daraja 的密钥(在开发者网站创建) · 需要先在电脑上安装 Python (uv)(只需一次)
B · 开发者工具 类中能连接 ChatGPT 的其他服务器
从同类中使用较多的里挑选,仅限用地址即可连接、无需密钥的
- Sentry✓ ChatGPT
- Compiler Explorer✓ ChatGPT
- GitDiagram✓ ChatGPT
可连接 Claude Code,但需要先准备
需要 M-Pesa Daraja 的密钥(在开发者网站创建) · 需要先在电脑上安装 Python (uv)(只需一次)
让 AI 帮你安装
把这段话复制到 Claude Code 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。
请在这台电脑上为 Claude Code 安装 MCP server M-Pesa Daraja,按顺序:1) 用 uv --version 检查是否有 uv。没有的话,请让我从 https://docs.astral.sh/uv/getting-started/installation/ 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):claude mcp add --scope user mpesa-daraja --env DARAJA_CONSUMER_KEY=your-value --env DARAJA_CONSUMER_SECRET=your-value --env DARAJA_PASSKEY=your-value --env DARAJA_SECURITY_CREDENTIAL=your-value --env DARAJA_CALLBACK_TOKEN=your-value --env DARAJA_INITIATOR_PASSWORD=your-value --env DARAJA_MCP_TOKEN=your-value --env DARAJA_FORWARD_SECRET=your-value -- uvx mpesa-daraja-mcp 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) DARAJA_CONSUMER_KEY, DARAJA_CONSUMER_SECRET, DARAJA_PASSKEY, DARAJA_SECURITY_CREDENTIAL, DARAJA_CALLBACK_TOKEN, DARAJA_INITIATOR_PASSWORD, DARAJA_MCP_TOKEN, DARAJA_FORWARD_SECRET 先保留 "your-value",请我自己把真实值粘贴到文件或应用的输入框里。不要让我在对话里输入密钥。5) 按约定执行,然后确认 M-Pesa Daraja 的工具真的出现了。这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。
安装 uv(如果还没有)
已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter
uv --version- 显示版本号(例如 uv …)= 已安装,可跳过这一步
- 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
怎么打开终端
Mac:按 ⌘ + Space,输入 Terminal 后按 Enter
Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”
还没安装: uv 没有点选式安装程序。从 uv 官方页面复制适合你系统(macOS 或 Windows)的一行命令,粘贴到终端 · 不需要单独安装 Python,uv 会在需要时自动下载
装好后关掉终端再打开,重新运行同一条命令,应显示版本号:
uv --version安装一次,所有需要 uv 的工具都能用
注册并创建 M-Pesa Daraja 的密钥
打开开发者网站,注册账户并创建 API 密钥,下一步要用。价格和免费方案请看开发者网站。
获取密钥的方法见下方开发者的 README
打开终端
Mac:按 Command+空格,输入 Terminal · Windows:打开 PowerShell
粘贴这条命令并按 Enter
claude mcp add --scope user mpesa-daraja --env DARAJA_CONSUMER_KEY=your-value --env DARAJA_CONSUMER_SECRET=your-value --env DARAJA_PASSKEY=your-value --env DARAJA_SECURITY_CREDENTIAL=your-value --env DARAJA_CALLBACK_TOKEN=your-value --env DARAJA_INITIATOR_PASSWORD=your-value --env DARAJA_MCP_TOKEN=your-value --env DARAJA_FORWARD_SECRET=your-value -- uvx mpesa-daraja-mcp按 Enter 前,把“your-value”改成你的密钥
只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人
在 Claude Code 中输入 /mcp
应能看到 M-Pesa Daraja 在列表中并显示已连接
试一试
用 M-Pesa Daraja 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Claude Code 说正在使用 M-Pesa Daraja,或回答中出现 M-Pesa Daraja 的工具名称,就表示连接成功
18 项可选设置(不填也能用)
上面的命令不填这些也能用。想调整时再按开发者的说明添加。
DARAJA_ENVsandbox(默认)或 production查看英文原文
sandbox (default) or productionDARAJA_SHORTCODEPaybill / 商户号(沙盒中为 174379)查看英文原文
Paybill / store number (174379 in sandbox)DARAJA_INITIATOR_NAMEAPI 操作员用户名(B2C、B2B、status、balance、reversal)查看英文原文
API operator username (B2C, B2B, status, balance, reversal)DARAJA_CALLBACK_BASE_URL回调 URL 使用的公开 HTTPS 基础地址查看英文原文
Public HTTPS base for callback URLsDARAJA_CALLBACK_LISTEN内置回调接收器的 host:port查看英文原文
host:port for the built-in callback receiverDARAJA_TOOLSETS逗号分隔列表:stk,c2b,payouts,ops,qr,ratiba,billmanager查看英文原文
Comma list: stk,c2b,payouts,ops,qr,ratiba,billmanagerDARAJA_READ_ONLY设为 true 时,隐藏所有涉及资金转移或写入的工具。查看英文原文
true hides every tool that moves money or writesDARAJA_APPROVAL_THRESHOLD超过此金额(先令)的付款需要在聊天中获得批准查看英文原文
Payouts above this many shillings need approval in the chatDARAJA_ALLOWED_RECIPIENTS付款(payouts)可发送至的电话号码或短代码的逗号分隔列表查看英文原文
Comma list of phones/shortcodes that payouts may go toDARAJA_ALLOW_LIVE_MONEY_MOVEMENT设为 true 以允许生产环境的收费和付款查看英文原文
true to allow production charges and payoutsDARAJA_CERT_PATHSafaricom 公共证书的路径,与 DARAJA_INITIATOR_PASSWORD 配合使用查看英文原文
Path to Safaricom's public certificate, used with DARAJA_INITIATOR_PASSWORDDARAJA_STATE_DB存储请求状态和回调的 SQLite 文件的路径。查看英文原文
Path of the SQLite file that stores request state and callbacksDARAJA_OUTPUT_DIR保存生成的 QR PNG 的目录查看英文原文
Directory where generated QR PNGs are savedDARAJA_CONFIG_DIR保存已保存配置的目录(默认:用户配置目录)查看英文原文
Directory holding the saved config (default: user config dir)DARAJA_DOTENV要加载的 .env 文件路径,替代项目中的文件查看英文原文
Path of a .env file to load instead of the project oneDARAJA_MCP_HOSTHTTP 模式的绑定地址(默认 127.0.0.1)查看英文原文
HTTP mode bind address (default 127.0.0.1)DARAJA_MCP_PORTHTTP 模式端口(默认 8000)查看英文原文
HTTP mode port (default 8000)DARAJA_FORWARD_URL您的应用 URL:每个回调都会通过 POST 发送到该地址,并附带 HMAC 签名查看英文原文
Your app's URL: every callback is POSTed on to it, HMAC-signed
说明为自动翻译,变量名保持原样;不确定时请查看原文。
菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同
可连接 Cursor,但需要先准备
需要 M-Pesa Daraja 的密钥(在开发者网站创建) · 需要先在电脑上安装 Python (uv)(只需一次)
让 AI 帮你安装
把这段话复制到 Cursor 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。
请在这台电脑上为 Cursor 安装 MCP server M-Pesa Daraja,按顺序:1) 用 uv --version 检查是否有 uv。没有的话,请让我从 https://docs.astral.sh/uv/getting-started/installation/ 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):{ "mcpServers": { "mpesa-daraja": { "command": "uvx", "args": [ "mpesa-daraja-mcp" ], "env": { "DARAJA_CONSUMER_KEY": "your-value", "DARAJA_CONSUMER_SECRET": "your-value", "DARAJA_PASSKEY": "your-value", "DARAJA_SECURITY_CREDENTIAL": "your-value", "DARAJA_CALLBACK_TOKEN": "your-value", "DARAJA_INITIATOR_PASSWORD": "your-value", "DARAJA_MCP_TOKEN": "your-value", "DARAJA_FORWARD_SECRET": "your-value" } } } } 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) DARAJA_CONSUMER_KEY, DARAJA_CONSUMER_SECRET, DARAJA_PASSKEY, DARAJA_SECURITY_CREDENTIAL, DARAJA_CALLBACK_TOKEN, DARAJA_INITIATOR_PASSWORD, DARAJA_MCP_TOKEN, DARAJA_FORWARD_SECRET 先保留 "your-value",请我自己把真实值粘贴到文件或应用的输入框里。不要让我在对话里输入密钥。5) 按约定执行,然后确认 M-Pesa Daraja 的工具真的出现了。这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。
安装 uv(如果还没有)
已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter
uv --version- 显示版本号(例如 uv …)= 已安装,可跳过这一步
- 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
怎么打开终端
Mac:按 ⌘ + Space,输入 Terminal 后按 Enter
Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”
还没安装: uv 没有点选式安装程序。从 uv 官方页面复制适合你系统(macOS 或 Windows)的一行命令,粘贴到终端 · 不需要单独安装 Python,uv 会在需要时自动下载
装好后关掉终端再打开,重新运行同一条命令,应显示版本号:
uv --version安装一次,所有需要 uv 的工具都能用
注册并创建 M-Pesa Daraja 的密钥
打开开发者网站,注册账户并创建 API 密钥,下一步要用。价格和免费方案请看开发者网站。
获取密钥的方法见下方开发者的 README
填写你的密钥
在 M-Pesa Daraja 的设置中,DARAJA_CONSUMER_KEY, DARAJA_CONSUMER_SECRET, DARAJA_PASSKEY, DARAJA_SECURITY_CREDENTIAL, DARAJA_CALLBACK_TOKEN, DARAJA_INITIATOR_PASSWORD, DARAJA_MCP_TOKEN, DARAJA_FORWARD_SECRET 还是空的,填入你的密钥并保存
只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人
在 Cursor 中以 Agent 模式打开 AI 聊天
试一试
用 M-Pesa Daraja 告诉我你能帮我做什么,然后做一件给我看✓ 如果 Cursor 说正在使用 M-Pesa Daraja,或回答中出现 M-Pesa Daraja 的工具名称,就表示连接成功
18 项可选设置(不填也能用)
上面的命令不填这些也能用。想调整时再按开发者的说明添加。
DARAJA_ENVsandbox(默认)或 production查看英文原文
sandbox (default) or productionDARAJA_SHORTCODEPaybill / 商户号(沙盒中为 174379)查看英文原文
Paybill / store number (174379 in sandbox)DARAJA_INITIATOR_NAMEAPI 操作员用户名(B2C、B2B、status、balance、reversal)查看英文原文
API operator username (B2C, B2B, status, balance, reversal)DARAJA_CALLBACK_BASE_URL回调 URL 使用的公开 HTTPS 基础地址查看英文原文
Public HTTPS base for callback URLsDARAJA_CALLBACK_LISTEN内置回调接收器的 host:port查看英文原文
host:port for the built-in callback receiverDARAJA_TOOLSETS逗号分隔列表:stk,c2b,payouts,ops,qr,ratiba,billmanager查看英文原文
Comma list: stk,c2b,payouts,ops,qr,ratiba,billmanagerDARAJA_READ_ONLY设为 true 时,隐藏所有涉及资金转移或写入的工具。查看英文原文
true hides every tool that moves money or writesDARAJA_APPROVAL_THRESHOLD超过此金额(先令)的付款需要在聊天中获得批准查看英文原文
Payouts above this many shillings need approval in the chatDARAJA_ALLOWED_RECIPIENTS付款(payouts)可发送至的电话号码或短代码的逗号分隔列表查看英文原文
Comma list of phones/shortcodes that payouts may go toDARAJA_ALLOW_LIVE_MONEY_MOVEMENT设为 true 以允许生产环境的收费和付款查看英文原文
true to allow production charges and payoutsDARAJA_CERT_PATHSafaricom 公共证书的路径,与 DARAJA_INITIATOR_PASSWORD 配合使用查看英文原文
Path to Safaricom's public certificate, used with DARAJA_INITIATOR_PASSWORDDARAJA_STATE_DB存储请求状态和回调的 SQLite 文件的路径。查看英文原文
Path of the SQLite file that stores request state and callbacksDARAJA_OUTPUT_DIR保存生成的 QR PNG 的目录查看英文原文
Directory where generated QR PNGs are savedDARAJA_CONFIG_DIR保存已保存配置的目录(默认:用户配置目录)查看英文原文
Directory holding the saved config (default: user config dir)DARAJA_DOTENV要加载的 .env 文件路径,替代项目中的文件查看英文原文
Path of a .env file to load instead of the project oneDARAJA_MCP_HOSTHTTP 模式的绑定地址(默认 127.0.0.1)查看英文原文
HTTP mode bind address (default 127.0.0.1)DARAJA_MCP_PORTHTTP 模式端口(默认 8000)查看英文原文
HTTP mode port (default 8000)DARAJA_FORWARD_URL您的应用 URL:每个回调都会通过 POST 发送到该地址,并附带 HMAC 签名查看英文原文
Your app's URL: every callback is POSTed on to it, HMAC-signed
说明为自动翻译,变量名保持原样;不确定时请查看原文。
菜单名称已于 2026年11月11日 对照 Cursor 帮助页面核实 · 你的界面可能因版本略有不同
可连接 VS Code,但需要先准备
需要 M-Pesa Daraja 的密钥(在开发者网站创建) · 需要先在电脑上安装 Python (uv)(只需一次)
让 AI 帮你安装
把这段话复制到 VS Code 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。
请在这台电脑上为 VS Code 安装 MCP server M-Pesa Daraja,按顺序:1) 用 uv --version 检查是否有 uv。没有的话,请让我从 https://docs.astral.sh/uv/getting-started/installation/ 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):{ "servers": { "mpesa-daraja": { "type": "stdio", "command": "uvx", "args": [ "mpesa-daraja-mcp" ], "env": { "DARAJA_CONSUMER_KEY": "your-value", "DARAJA_CONSUMER_SECRET": "your-value", "DARAJA_PASSKEY": "your-value", "DARAJA_SECURITY_CREDENTIAL": "your-value", "DARAJA_CALLBACK_TOKEN": "your-value", "DARAJA_INITIATOR_PASSWORD": "your-value", "DARAJA_MCP_TOKEN": "your-value", "DARAJA_FORWARD_SECRET": "your-value" } } } } 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) DARAJA_CONSUMER_KEY, DARAJA_CONSUMER_SECRET, DARAJA_PASSKEY, DARAJA_SECURITY_CREDENTIAL, DARAJA_CALLBACK_TOKEN, DARAJA_INITIATOR_PASSWORD, DARAJA_MCP_TOKEN, DARAJA_FORWARD_SECRET 先保留 "your-value",请我自己把真实值粘贴到文件或应用的输入框里。不要让我在对话里输入密钥。5) 按约定执行,然后确认 M-Pesa Daraja 的工具真的出现了。这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。
安装 uv(如果还没有)
已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter
uv --version- 显示版本号(例如 uv …)= 已安装,可跳过这一步
- 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
怎么打开终端
Mac:按 ⌘ + Space,输入 Terminal 后按 Enter
Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”
还没安装: uv 没有点选式安装程序。从 uv 官方页面复制适合你系统(macOS 或 Windows)的一行命令,粘贴到终端 · 不需要单独安装 Python,uv 会在需要时自动下载
装好后关掉终端再打开,重新运行同一条命令,应显示版本号:
uv --version安装一次,所有需要 uv 的工具都能用
注册并创建 M-Pesa Daraja 的密钥
打开开发者网站,注册账户并创建 API 密钥,下一步要用。价格和免费方案请看开发者网站。
获取密钥的方法见下方开发者的 README
填写你的密钥
在 M-Pesa Daraja 的设置中,DARAJA_CONSUMER_KEY, DARAJA_CONSUMER_SECRET, DARAJA_PASSKEY, DARAJA_SECURITY_CREDENTIAL, DARAJA_CALLBACK_TOKEN, DARAJA_INITIATOR_PASSWORD, DARAJA_MCP_TOKEN, DARAJA_FORWARD_SECRET 还是空的,填入你的密钥并保存
只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人
在 VS Code 中以 Agent 模式打开 AI 聊天
试一试
用 M-Pesa Daraja 告诉我你能帮我做什么,然后做一件给我看✓ 如果 VS Code 说正在使用 M-Pesa Daraja,或回答中出现 M-Pesa Daraja 的工具名称,就表示连接成功
18 项可选设置(不填也能用)
上面的命令不填这些也能用。想调整时再按开发者的说明添加。
DARAJA_ENVsandbox(默认)或 production查看英文原文
sandbox (default) or productionDARAJA_SHORTCODEPaybill / 商户号(沙盒中为 174379)查看英文原文
Paybill / store number (174379 in sandbox)DARAJA_INITIATOR_NAMEAPI 操作员用户名(B2C、B2B、status、balance、reversal)查看英文原文
API operator username (B2C, B2B, status, balance, reversal)DARAJA_CALLBACK_BASE_URL回调 URL 使用的公开 HTTPS 基础地址查看英文原文
Public HTTPS base for callback URLsDARAJA_CALLBACK_LISTEN内置回调接收器的 host:port查看英文原文
host:port for the built-in callback receiverDARAJA_TOOLSETS逗号分隔列表:stk,c2b,payouts,ops,qr,ratiba,billmanager查看英文原文
Comma list: stk,c2b,payouts,ops,qr,ratiba,billmanagerDARAJA_READ_ONLY设为 true 时,隐藏所有涉及资金转移或写入的工具。查看英文原文
true hides every tool that moves money or writesDARAJA_APPROVAL_THRESHOLD超过此金额(先令)的付款需要在聊天中获得批准查看英文原文
Payouts above this many shillings need approval in the chatDARAJA_ALLOWED_RECIPIENTS付款(payouts)可发送至的电话号码或短代码的逗号分隔列表查看英文原文
Comma list of phones/shortcodes that payouts may go toDARAJA_ALLOW_LIVE_MONEY_MOVEMENT设为 true 以允许生产环境的收费和付款查看英文原文
true to allow production charges and payoutsDARAJA_CERT_PATHSafaricom 公共证书的路径,与 DARAJA_INITIATOR_PASSWORD 配合使用查看英文原文
Path to Safaricom's public certificate, used with DARAJA_INITIATOR_PASSWORDDARAJA_STATE_DB存储请求状态和回调的 SQLite 文件的路径。查看英文原文
Path of the SQLite file that stores request state and callbacksDARAJA_OUTPUT_DIR保存生成的 QR PNG 的目录查看英文原文
Directory where generated QR PNGs are savedDARAJA_CONFIG_DIR保存已保存配置的目录(默认:用户配置目录)查看英文原文
Directory holding the saved config (default: user config dir)DARAJA_DOTENV要加载的 .env 文件路径,替代项目中的文件查看英文原文
Path of a .env file to load instead of the project oneDARAJA_MCP_HOSTHTTP 模式的绑定地址(默认 127.0.0.1)查看英文原文
HTTP mode bind address (default 127.0.0.1)DARAJA_MCP_PORTHTTP 模式端口(默认 8000)查看英文原文
HTTP mode port (default 8000)DARAJA_FORWARD_URL您的应用 URL:每个回调都会通过 POST 发送到该地址,并附带 HMAC 签名查看英文原文
Your app's URL: every callback is POSTed on to it, HMAC-signed
说明为自动翻译,变量名保持原样;不确定时请查看原文。
菜单名称已于 2026年11月11日 对照 VS Code 帮助页面核实 · 你的界面可能因版本略有不同
开发者专用:终端命令和 JSON 设置
安装在电脑上
Claude Code
claude mcp add --scope user mpesa-daraja --env DARAJA_CONSUMER_KEY=your-value --env DARAJA_CONSUMER_SECRET=your-value --env DARAJA_PASSKEY=your-value --env DARAJA_SECURITY_CREDENTIAL=your-value --env DARAJA_CALLBACK_TOKEN=your-value --env DARAJA_INITIATOR_PASSWORD=your-value --env DARAJA_MCP_TOKEN=your-value --env DARAJA_FORWARD_SECRET=your-value -- uvx mpesa-daraja-mcpClaude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"mpesa-daraja": {
"command": "uvx",
"args": [
"mpesa-daraja-mcp"
],
"env": {
"DARAJA_CONSUMER_KEY": "your-value",
"DARAJA_CONSUMER_SECRET": "your-value",
"DARAJA_PASSKEY": "your-value",
"DARAJA_SECURITY_CREDENTIAL": "your-value",
"DARAJA_CALLBACK_TOKEN": "your-value",
"DARAJA_INITIATOR_PASSWORD": "your-value",
"DARAJA_MCP_TOKEN": "your-value",
"DARAJA_FORWARD_SECRET": "your-value"
}
}
}
}Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"mpesa-daraja": {
"command": "uvx",
"args": [
"mpesa-daraja-mcp"
],
"env": {
"DARAJA_CONSUMER_KEY": "your-value",
"DARAJA_CONSUMER_SECRET": "your-value",
"DARAJA_PASSKEY": "your-value",
"DARAJA_SECURITY_CREDENTIAL": "your-value",
"DARAJA_CALLBACK_TOKEN": "your-value",
"DARAJA_INITIATOR_PASSWORD": "your-value",
"DARAJA_MCP_TOKEN": "your-value",
"DARAJA_FORWARD_SECRET": "your-value"
}
}
}
}VS Code (mcp.json)
{
"servers": {
"mpesa-daraja": {
"type": "stdio",
"command": "uvx",
"args": [
"mpesa-daraja-mcp"
],
"env": {
"DARAJA_CONSUMER_KEY": "your-value",
"DARAJA_CONSUMER_SECRET": "your-value",
"DARAJA_PASSKEY": "your-value",
"DARAJA_SECURITY_CREDENTIAL": "your-value",
"DARAJA_CALLBACK_TOKEN": "your-value",
"DARAJA_INITIATOR_PASSWORD": "your-value",
"DARAJA_MCP_TOKEN": "your-value",
"DARAJA_FORWARD_SECRET": "your-value"
}
}
}
}需要你填写的值
DARAJA_CONSUMER_KEY机密 必填 envDaraja 应用的 Consumer Key。查看英文原文
Daraja app Consumer KeyDARAJA_CONSUMER_SECRET机密 必填 envDaraja 应用的 Consumer Secret。查看英文原文
Daraja app Consumer SecretDARAJA_ENVenvsandbox(默认)或 production查看英文原文
sandbox (default) or productionDARAJA_SHORTCODEenvPaybill / 商户号(沙盒中为 174379)查看英文原文
Paybill / store number (174379 in sandbox)DARAJA_PASSKEY机密 必填 envM-Pesa Express 密钥(STK Push)查看英文原文
M-Pesa Express passkey (STK Push)DARAJA_INITIATOR_NAMEenvAPI 操作员用户名(B2C、B2B、status、balance、reversal)查看英文原文
API operator username (B2C, B2B, status, balance, reversal)DARAJA_SECURITY_CREDENTIAL机密 必填 env已加密的发起方密码查看英文原文
Encrypted initiator passwordDARAJA_CALLBACK_BASE_URLenv回调 URL 使用的公开 HTTPS 基础地址查看英文原文
Public HTTPS base for callback URLsDARAJA_CALLBACK_LISTENenv内置回调接收器的 host:port查看英文原文
host:port for the built-in callback receiverDARAJA_CALLBACK_TOKEN机密 必填 env16 个以上的随机字符;用于回调的秘密路径查看英文原文
16+ random characters; secret path for callbacksDARAJA_TOOLSETSenv逗号分隔列表:stk,c2b,payouts,ops,qr,ratiba,billmanager查看英文原文
Comma list: stk,c2b,payouts,ops,qr,ratiba,billmanagerDARAJA_READ_ONLYenv设为 true 时,隐藏所有涉及资金转移或写入的工具。查看英文原文
true hides every tool that moves money or writesDARAJA_APPROVAL_THRESHOLDenv超过此金额(先令)的付款需要在聊天中获得批准查看英文原文
Payouts above this many shillings need approval in the chatDARAJA_ALLOWED_RECIPIENTSenv付款(payouts)可发送至的电话号码或短代码的逗号分隔列表查看英文原文
Comma list of phones/shortcodes that payouts may go toDARAJA_ALLOW_LIVE_MONEY_MOVEMENTenv设为 true 以允许生产环境的收费和付款查看英文原文
true to allow production charges and payoutsDARAJA_INITIATOR_PASSWORD机密 必填 env发起者密码,启动时加密为 SecurityCredential(可替代 DARAJA_SECURITY_CREDENTIAL)查看英文原文
Initiator password, encrypted into SecurityCredential at startup (alternative to DARAJA_SECURITY_CREDENTIAL)DARAJA_CERT_PATHenvSafaricom 公共证书的路径,与 DARAJA_INITIATOR_PASSWORD 配合使用查看英文原文
Path to Safaricom's public certificate, used with DARAJA_INITIATOR_PASSWORDDARAJA_STATE_DBenv存储请求状态和回调的 SQLite 文件的路径。查看英文原文
Path of the SQLite file that stores request state and callbacksDARAJA_OUTPUT_DIRenv保存生成的 QR PNG 的目录查看英文原文
Directory where generated QR PNGs are savedDARAJA_CONFIG_DIRenv保存已保存配置的目录(默认:用户配置目录)查看英文原文
Directory holding the saved config (default: user config dir)DARAJA_DOTENVenv要加载的 .env 文件路径,替代项目中的文件查看英文原文
Path of a .env file to load instead of the project oneDARAJA_MCP_TOKEN机密 必填 envHTTP 模式的 Bearer 令牌(至少 32 个随机字符)。查看英文原文
Bearer token for HTTP mode (32+ random characters)DARAJA_MCP_HOSTenvHTTP 模式的绑定地址(默认 127.0.0.1)查看英文原文
HTTP mode bind address (default 127.0.0.1)DARAJA_MCP_PORTenvHTTP 模式端口(默认 8000)查看英文原文
HTTP mode port (default 8000)DARAJA_FORWARD_URLenv您的应用 URL:每个回调都会通过 POST 发送到该地址,并附带 HMAC 签名查看英文原文
Your app's URL: every callback is POSTed on to it, HMAC-signedDARAJA_FORWARD_SECRET机密 必填 env用于转发回调的 HMAC 密钥(至少 16 个字符)查看英文原文
HMAC secret for forwarded callbacks (16+ characters)
说明为自动翻译,变量名保持原样;不确定时请查看原文。
这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。
一览
哪些应用可以使用它
依据这个服务器的连接方式和各应用自己的文档,检查于 2026年11月10日。
在你的电脑上运行,适用于
ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast
它能做什么
它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。
基础检查i
我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月20日
- ✓ 通过
作者与仓库一致
注册名称已通过 GitHub 账户 Mr-Macharia 验证,该账户拥有此仓库
- ✓ 通过
仍在维护
代码最后更新于16天前
- ✓ 通过
有许可证
使用 MIT
- – 不适用
端点有响应
它在你的电脑上运行,没有互联网端点
- – 不适用
使用 OAuth 登录
在你的电脑上运行,改用本地设置
- … 尚未检查
工具描述中没有隐藏指令
它在你的电脑上运行;我们只能读取互联网端点的工具列表
已公开的漏洞(OSV.dev)
OSV.dev 中没有 mpesa-daraja-mcp@0.1.6 的记录
只检查这个版本的包本身,不包括所有依赖 · 检查于 2026年11月15日
作者:申请重新检查或报告信息错误
给作者:在 README 中加徽章
如果你是作者,可把这段代码贴到 README。徽章会链接回本页。
[](https://mcp.popnx.com/en/servers/mr-macharia-mpesa-daraja-mcp)讨论
提问、分享技巧或报告无法使用。按“有帮助”数量排序。
用户评价
还没有评价
与“开发者工具”中的其他服务器比较i
- 星标数多于此分类中其他 6202 个服务器的 0%
- 发布到注册中心的时间比此分类中其他 6202 个服务器的 57% 更新
- 基础检查结果等于或优于此分类中其他 6202 个服务器的 99%
与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。
常见问题
M-Pesa Daraja 安全吗?
它在 3 项适用的基础检查中通过了 3 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。
它需要哪些密钥或代码?
你需要填写:DARAJA_CONSUMER_KEY, DARAJA_CONSUMER_SECRET, DARAJA_PASSKEY, DARAJA_SECURITY_CREDENTIAL, DARAJA_CALLBACK_TOKEN, DARAJA_INITIATOR_PASSWORD, DARAJA_MCP_TOKEN, DARAJA_FORWARD_SECRET
它在我的电脑上运行还是在云端?
它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。
它还在维护吗?
GitHub 仓库最后更新于16天前,最新版本(0.1.6)于22天前进入注册中心。
哪些应用可以使用它?
支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Python (uv)。
有什么可以替代它?
同一分类中有:GitDiagram, Appllama, Cloudflare MCP, Omnara, Repowise
功能相近的其他选择
同一分类、其他作者、命令已通过检查。官方的排在前面,再按星标排序。
如何看卡片:↓ 每周下载量i★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i
GitDiagram
Architecture diagrams, explanations and Mermaid source for public GitHub repositories.
Appllama
Study screens, flows and paywalls from top-earning iOS apps, then build from what wins.
Omnara
Deploy durable AI agents with Omnara, an open-source managed-agent platform.
Repowise
Codebase intelligence for AI coding agents: graph, git history, docs, decisions, code health.
| 本项 M-Pesa Daraja | GitDiagram | Appllama | Cloudflare MCP | Omnara | Repowise | |
|---|---|---|---|---|---|---|
| 运行位置 | 需要安装在电脑上 | 在云端运行,无需安装 | 在云端运行,无需安装 | 在云端运行,无需安装 | 在云端运行,无需安装 | 云端或安装在电脑上都可以 |
| 需要密钥 | 是 | 否 | 否 | 否 | 否 | 否 |
| 可在 Claude 中按 + 添加 | 否 | 否 | 否 | 是 | 否 | 否 |
| 基础检查 | 3/3 | 4/4 | 4/4 | 4/4 | 4/4 | 5/5 |
| 许可证 | MIT | MIT | MIT | Apache-2.0 | Apache-2.0 | AGPL-3.0 |
| 价格 | 登记中未列出费用 | 登记中未列出费用 | 登记中未列出费用 | 登记中未列出费用 | 登记中未列出费用 | 登记中未列出费用 |
作者的 README
打开 README
按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。
mpesa-daraja
Renamed from
mpesa-daraja-mcpin 0.1.5. The old package name still installs this one.
The MCP server in the M-Pesa Daraja Agent Kit. It lets an AI agent call Safaricom's Daraja API safely.
An MCP server that exposes Safaricom's Daraja APIs as tools, so an agent (Claude Code, Codex, Cursor, Gemini CLI, any MCP client) can collect payments, check whether they went through, and operate M-Pesa from a chat. It starts in the sandbox, and nothing live happens until you switch it on.
It pairs with the Agent Skills in the same kit: the skills teach an agent *how* to integrate M-Pesa, and this server lets it *call* Daraja. You can use either on its own.
Who it's for
- Developers building payment integrations: ask your agent to run a request against the sandbox and read the real response.
- Learners finding out how the Daraja API works: send real requests to a safe test environment and see what comes back.
- Businesses and teams that want an AI agent to handle payments: collecting them, checking whether they went through, and reconciling them.
Install
Let your agent do it. Paste this into Claude Code, Codex, Cursor, Gemini CLI or any coding agent:
Add the M-Pesa Daraja MCP server to yourself, named "mpesa", with the command: uvx mpesa-daraja-mcp
It needs no keys in your config. If uv is missing, tell me how to install it first. Don't ask me for my Daraja keys. Tell me to run uvx mpesa-daraja-mcp init in my own terminal, which saves them privately, then to restart you. After I restart you, call mpesa_check_credentials and tell me if everything works.
Or do it yourself. You need uv. The wizard asks for your Daraja keys (secrets are typed hidden), checks them live with Safaricom, saves them to a file only you can read, and registers the server with Claude Code, Codex, Gemini CLI or Cursor:
uvx mpesa-daraja-mcp init
Then restart your agent and ask: *"Check my M-Pesa credentials, then send a KES 1 STK push to 0712345678 and tell me when it's paid."* The full Agent Kit, with the skills and more examples, is in the main README.
Tools
| Tool | Daraja API | Moves money |
|---|---|---|
mpesa_explain_code | — offline error/result code lookup | |
mpesa_normalize_phone | — offline 07… → 2547… | |
mpesa_generate_stk_password | — offline Password + EAT Timestamp | |
mpesa_parse_callback | — offline parse of any callback payload | |
mpesa_setup_status | — offline: what's configured and missing per toolset (no values) | |
mpesa_check_credentials | OAuth token (never returned) | |
mpesa_get_result | Final status by idempotency key or any Daraja ID (from captured callbacks; STK falls back to STK Query) | |
mpesa_stk_push_and_wait | M-Pesa Express: push, then wait for callback / poll query; returns SUCCESS, FAILED or UNKNOWN | ✅ |
mpesa_stk_push / mpesa_stk_query | M-Pesa Express, fire-and-forget / status | ✅ / |
mpesa_c2b_register_urls / mpesa_c2b_simulate | C2B v2 (simulate = sandbox only) | |
mpesa_pull_transactions | Pull Transactions query | |
mpesa_b2c_payment | B2C v3, B2Pochi | ✅ |
mpesa_b2b_payment | BusinessPayBill, BusinessBuyGoods, BusinessPayToBulk (B2C top-up), PayTaxToKRA | ✅ |
mpesa_b2b_express_checkout | B2B USSD push | ✅ |
mpesa_transaction_status / mpesa_account_balance | Status / Balance (async result) | |
mpesa_reverse_transaction | Reversal | ✅ |
mpesa_generate_dynamic_qr | Dynamic QR, saved as a PNG file (path returned, not the image) | |
mpesa_ratiba_create_standing_order | M-Pesa Ratiba | ✅ |
mpesa_bill_manager_optin / mpesa_bill_manager_send_invoice / mpesa_bill_manager_cancel_invoice | Bill Manager |
Tool annotations mark money-moving tools as destructiveHint, so MCP clients ask for approval.
Safety
- Defaults to the sandbox.
- In production, money-moving tools refuse to run unless
DARAJA_ALLOW_LIVE_MONEY_MOVEMENT=true. - Optional guardrails, all off until set:
DARAJA_READ_ONLY=truehides every tool that moves money or writes. Use it for support bots, reconciliation and learning.DARAJA_APPROVAL_THRESHOLD=5000: B2C, B2B, tax and reversals above KES 5,000 pause for a yes/no in the chat (MCP elicitation). Clients that can't show the prompt get a refusal, and nothing is sent. Collections (STK, B2B Express, Ratiba) never prompt, because the payer enters their own PIN.DARAJA_ALLOWED_RECIPIENTS=0712345678,600000: payouts may go only to these phones and shortcodes.- For a B2C refund, pass
refund_ofwith the original M-Pesa receipt; it appears in the approval prompt and the remarks. - Callback URLs must be HTTPS; C2B URLs with
mpesa/safaricomin them are rejected up front. - Tokens and secrets are never returned in tool output.
- Responses with
ResponseCode "0"are tagged_note: ACCEPTED for processing only, so the agent does not report them as completed payments. - Idempotent money tools. Each request is stored under an idempotency key. Repeating the key returns the stored request (
duplicate: true) instead of paying again. - Only a definitively FAILED request is re-sent.
- ACCEPTED or UNKNOWN requests (queue timeouts, network errors) are never re-sent until their result is known.
- B2C, B2B and B2B Express require an explicit
idempotency_key, e.g.refund-order-1042. Reversal, tax and Ratiba derive one from the transaction ID, the PRN and phone + name respectively. For STK the key is optional.
Configuration
| Variable | Required | Notes |
|---|---|---|
DARAJA_ENV | sandbox (default) or production | |
DARAJA_CONSUMER_KEY, DARAJA_CONSUMER_SECRET | ✅ | From your Daraja app |
DARAJA_SHORTCODE | most tools | Paybill / store number (174379 in sandbox) |
DARAJA_PASSKEY | STK | Lipa na M-Pesa passkey |
DARAJA_INITIATOR_NAME | B2C/B2B/status/balance/reversal | API operator username |
DARAJA_SECURITY_CREDENTIAL | same | Pre-encrypted credential, or set the next two |
DARAJA_INITIATOR_PASSWORD + DARAJA_CERT_PATH | Server encrypts the password with the cert at startup | |
DARAJA_CALLBACK_BASE_URL | e.g. https://abc.ngrok-free.app; tools append /mpesa/stk/callback, /mpesa/b2c/result, … | |
DARAJA_ALLOW_LIVE_MONEY_MOVEMENT | true to allow production charges/payouts | |
DARAJA_CALLBACK_LISTEN | e.g. 127.0.0.1:8787: starts the built-in callback receiver | |
DARAJA_CALLBACK_TOKEN | with receiver | 16+ random characters. Callback URLs become /cb/ /… |
DARAJA_STATE_DB | SQLite file for requests and results (default ~/.mpesa-mcp/state.db) | |
DARAJA_TOOLSETS | Comma list of stk,c2b,payouts,ops,qr,ratiba,billmanager (core is always on). Default: all | |
DARAJA_READ_ONLY | true hides every tool that moves money or writes | |
DARAJA_APPROVAL_THRESHOLD | Payouts above this many shillings need a yes in the chat | |
DARAJA_ALLOWED_RECIPIENTS | Comma list of phones/shortcodes that payouts may go to | |
DARAJA_OUTPUT_DIR | Where QR PNGs are saved (default ~/.mpesa-mcp/qr) | |
DARAJA_FORWARD_URL | Your app's endpoint. Each callback is POSTed on to it, signed. See forwarding | |
DARAJA_FORWARD_SECRET | with forwarding | 16+ random characters, used for the X-Mpesa-Signature HMAC |
DARAJA_MCP_TOKEN | HTTP mode | 32+ random characters; clients send Authorization: Bearer |
DARAJA_MCP_HOST, DARAJA_MCP_PORT | HTTP mode bind address and port (default 127.0.0.1:8000) |
Commands and configuration files
Install once with uv tool install mpesa-daraja-mcp to get the mpesa command (or prefix any command with uvx mpesa-daraja-mcp instead of mpesa):
mpesa init # guided: keys (hidden input), live check, save, register with your agents
mpesa status # what's configured (masked), the guardrails, and a live key check mpesa dev # callback receiver + tunnel (cloudflared or ngrok) + a live log of callbacks mpesa serve [--http] # the MCP server: stdio for local agents, HTTP for remote ones mpesa up --domain pay.example.com # self-host with Docker and automatic HTTPS mpesa pay stk 0712345678 10 --ref order-42 # waits for the PIN and shows the outcome mpesa pay b2c 0712345678 500 --key refund-42 --refund-of NLJ7RT61SV mpesa result · mpesa balance · mpesa explain 1032 mpesa skills install # copy the Agent Skills into Claude Code, Codex, Cursor, … mpesa upgrade
Every data command takes --json, and mpesa --verbose … logs each HTTP request to Daraja. A failed STK Push shows the --key to retry it with. Payments use the same guardrails as the MCP tools, and approvals are asked in the terminal. uvx mpesa-daraja-mcp with no arguments is the MCP server on stdio, which is what your agent runs.
The server needs no flags or environment variables in your agent's config. Settings are read in this order, highest first:
- Environment variables, e.g. from the client's
envblock. - A project `.env` in the folder the agent starts the server in, or the file named by
DARAJA_DOTENV. OnlyDARAJA_*lines are read. - The user config file that
setupwrites:~/.config/mpesa-daraja-mcp/config.env(Windows:%APPDATA%\mpesa-daraja-mcp\config.env; override the folder withDARAJA_CONFIG_DIR). It is readable only by you.
The server starts even when unconfigured. Tools then explain what's missing, and mpesa_setup_status lists the gaps for each toolset without revealing any values.
To register by hand: claude mcp add --scope user mpesa -- uvx mpesa-daraja-mcp. Every other agent is covered in docs/clients.md. The mpesa-daraja and mpesa-mcp commands are aliases.
Remote access (HTTP mode)
mpesa serve --http serves MCP at /mcp and Daraja callbacks at /cb/ /… on one port, for n8n, cloud agents and teammates. It needs DARAJA_MCP_TOKEN, and starts read-only with every payout needing approval unless you say otherwise. Docker, HTTPS and n8n guides: https://github.com/Mr-Macharia/mpesa-daraja-skills-and-mcp/blob/main/docs/self-hosting.md
Results and callbacks
Every money or async tool returns one shape:
{"status": "ACCEPTED | SUCCESS | FAILED | UNKNOWN", "message": "...", "idempotency_key": "...",
"duplicate": false, "ids": {"checkout_request_id": "..."}, "receipt": "...", "result_code": "...", "explanation": "...", "raw": {}}
To let the agent see final results, enable the built-in receiver:
export DARAJA_CALLBACK_LISTEN=127.0.0.1:8787
export DARAJA_CALLBACK_TOKEN=$(python -c "import secrets; print(secrets.token_urlsafe(24))") ngrok http 8787 # sandbox; use a reverse proxy with TLS in production export DARAJA_CALLBACK_BASE_URL=https://
Callbacks are stored in DARAJA_STATE_DB:
mpesa_get_result(id)reads them.mpesa_stk_push_and_waitreturns the final outcome in one call.- Queue-timeout callbacks are recorded as UNKNOWN.
- C2B validation requests are always accepted. Use yo