原型 · 预览版:收录官方注册中心里的全部服务器,每 30 分钟同步一次。使用 Google 登录即可撰写评价。原型 · 每 30 分钟更新
PopNx MCP为使用 AI 的人准备的 MCP 服务器 · 用大白话讲清楚 登录

M-Pesa Daraja

作者:Mr-Macharia版本 0.1.6i★ 3 (整个仓库的星标)i在你的电脑上运行代码仓库 ↗
注册名称io.github.Mr-Macharia/mpesa-daraja-mcp

安装方法

能做什么

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,可与本项一起使用

rea

Reverse engineer anything with agents, from app behavior down to native binaries.

作者:morluto★ 468,7331 个 skill

Skill · 操作手册

andrej-karpathy-skills

A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.

作者:multica-ai★ 234,3321 个 skill

Skill · 操作手册未注明许可证

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.

作者:Graphify-Labs★ 150,2871 个 skill

Skill · 操作手册

为什么排在这里

列表按使用分(满分 100)排序,由以下部分组成

热度0/80GitHub 星标或每周下载量:较大的计 60,较小的计 20
新鲜度12/1230 天内有发布或代码更新得满分
仍在响应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 会请你自己粘贴到文件或应用的输入框里。

  1. 安装 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 下载页 ↗

    装好后关掉终端再打开,重新运行同一条命令,应显示版本号: uv --version

    安装一次,所有需要 uv 的工具都能用

  2. 注册并创建 M-Pesa Daraja 的密钥

    打开开发者网站,注册账户并创建 API 密钥,下一步要用。价格和免费方案请看开发者网站。

    获取密钥的方法见下方开发者的 README

  3. 打开电脑版 Claude 应用的设置文件

    SettingsDeveloperEdit Config

  4. 粘贴这些设置并保存文件

    {
      "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"
          }
        }
      }
    }

    只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人

  5. 退出 Claude 再重新打开

  6. 试一试

    用 M-Pesa Daraja 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 Claude 说正在使用 M-Pesa Daraja,或回答中出现 M-Pesa Daraja 的工具名称,就表示连接成功

18 项可选设置(不填也能用)

上面的命令不填这些也能用。想调整时再按开发者的说明添加。

  • DARAJA_ENV sandbox(默认)或 production
    查看英文原文sandbox (default) or production
  • DARAJA_SHORTCODE Paybill / 商户号(沙盒中为 174379)
    查看英文原文Paybill / store number (174379 in sandbox)
  • DARAJA_INITIATOR_NAME API 操作员用户名(B2C、B2B、status、balance、reversal)
    查看英文原文API operator username (B2C, B2B, status, balance, reversal)
  • DARAJA_CALLBACK_BASE_URL 回调 URL 使用的公开 HTTPS 基础地址
    查看英文原文Public HTTPS base for callback URLs
  • DARAJA_CALLBACK_LISTEN 内置回调接收器的 host:port
    查看英文原文host:port for the built-in callback receiver
  • DARAJA_TOOLSETS 逗号分隔列表:stk,c2b,payouts,ops,qr,ratiba,billmanager
    查看英文原文Comma list: stk,c2b,payouts,ops,qr,ratiba,billmanager
  • DARAJA_READ_ONLY 设为 true 时,隐藏所有涉及资金转移或写入的工具。
    查看英文原文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 付款(payouts)可发送至的电话号码或短代码的逗号分隔列表
    查看英文原文Comma list of phones/shortcodes that payouts may go to
  • DARAJA_ALLOW_LIVE_MONEY_MOVEMENT 设为 true 以允许生产环境的收费和付款
    查看英文原文true to allow production charges and payouts
  • DARAJA_CERT_PATH Safaricom 公共证书的路径,与 DARAJA_INITIATOR_PASSWORD 配合使用
    查看英文原文Path to Safaricom's public certificate, used with DARAJA_INITIATOR_PASSWORD
  • DARAJA_STATE_DB 存储请求状态和回调的 SQLite 文件的路径。
    查看英文原文Path of the SQLite file that stores request state and callbacks
  • DARAJA_OUTPUT_DIR 保存生成的 QR PNG 的目录
    查看英文原文Directory where generated QR PNGs are saved
  • DARAJA_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 one
  • DARAJA_MCP_HOST HTTP 模式的绑定地址(默认 127.0.0.1)
    查看英文原文HTTP mode bind address (default 127.0.0.1)
  • DARAJA_MCP_PORT HTTP 模式端口(默认 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 的其他服务器

从同类中使用较多的里挑选,仅限用地址即可连接、无需密钥的

可连接 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 会请你自己粘贴到文件或应用的输入框里。

  1. 安装 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 下载页 ↗

    装好后关掉终端再打开,重新运行同一条命令,应显示版本号: uv --version

    安装一次,所有需要 uv 的工具都能用

  2. 注册并创建 M-Pesa Daraja 的密钥

    打开开发者网站,注册账户并创建 API 密钥,下一步要用。价格和免费方案请看开发者网站。

    获取密钥的方法见下方开发者的 README

  3. 打开终端

    Mac:按 Command+空格,输入 Terminal · Windows:打开 PowerShell

  4. 粘贴这条命令并按 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”改成你的密钥

    只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人

  5. 在 Claude Code 中输入 /mcp

    应能看到 M-Pesa Daraja 在列表中并显示已连接

  6. 试一试

    用 M-Pesa Daraja 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 Claude Code 说正在使用 M-Pesa Daraja,或回答中出现 M-Pesa Daraja 的工具名称,就表示连接成功

18 项可选设置(不填也能用)

上面的命令不填这些也能用。想调整时再按开发者的说明添加。

  • DARAJA_ENV sandbox(默认)或 production
    查看英文原文sandbox (default) or production
  • DARAJA_SHORTCODE Paybill / 商户号(沙盒中为 174379)
    查看英文原文Paybill / store number (174379 in sandbox)
  • DARAJA_INITIATOR_NAME API 操作员用户名(B2C、B2B、status、balance、reversal)
    查看英文原文API operator username (B2C, B2B, status, balance, reversal)
  • DARAJA_CALLBACK_BASE_URL 回调 URL 使用的公开 HTTPS 基础地址
    查看英文原文Public HTTPS base for callback URLs
  • DARAJA_CALLBACK_LISTEN 内置回调接收器的 host:port
    查看英文原文host:port for the built-in callback receiver
  • DARAJA_TOOLSETS 逗号分隔列表:stk,c2b,payouts,ops,qr,ratiba,billmanager
    查看英文原文Comma list: stk,c2b,payouts,ops,qr,ratiba,billmanager
  • DARAJA_READ_ONLY 设为 true 时,隐藏所有涉及资金转移或写入的工具。
    查看英文原文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 付款(payouts)可发送至的电话号码或短代码的逗号分隔列表
    查看英文原文Comma list of phones/shortcodes that payouts may go to
  • DARAJA_ALLOW_LIVE_MONEY_MOVEMENT 设为 true 以允许生产环境的收费和付款
    查看英文原文true to allow production charges and payouts
  • DARAJA_CERT_PATH Safaricom 公共证书的路径,与 DARAJA_INITIATOR_PASSWORD 配合使用
    查看英文原文Path to Safaricom's public certificate, used with DARAJA_INITIATOR_PASSWORD
  • DARAJA_STATE_DB 存储请求状态和回调的 SQLite 文件的路径。
    查看英文原文Path of the SQLite file that stores request state and callbacks
  • DARAJA_OUTPUT_DIR 保存生成的 QR PNG 的目录
    查看英文原文Directory where generated QR PNGs are saved
  • DARAJA_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 one
  • DARAJA_MCP_HOST HTTP 模式的绑定地址(默认 127.0.0.1)
    查看英文原文HTTP mode bind address (default 127.0.0.1)
  • DARAJA_MCP_PORT HTTP 模式端口(默认 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 会请你自己粘贴到文件或应用的输入框里。

  1. 安装 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 下载页 ↗

    装好后关掉终端再打开,重新运行同一条命令,应显示版本号: uv --version

    安装一次,所有需要 uv 的工具都能用

  2. 注册并创建 M-Pesa Daraja 的密钥

    打开开发者网站,注册账户并创建 API 密钥,下一步要用。价格和免费方案请看开发者网站。

    获取密钥的方法见下方开发者的 README

  3. 点击这个按钮打开 Cursor

    在 Cursor 中打开

    Cursor 会请你确认安装,点击 Install

  4. 填写你的密钥

    在 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 还是空的,填入你的密钥并保存

    只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人

  5. 在 Cursor 中以 Agent 模式打开 AI 聊天

  6. 试一试

    用 M-Pesa Daraja 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 Cursor 说正在使用 M-Pesa Daraja,或回答中出现 M-Pesa Daraja 的工具名称,就表示连接成功

18 项可选设置(不填也能用)

上面的命令不填这些也能用。想调整时再按开发者的说明添加。

  • DARAJA_ENV sandbox(默认)或 production
    查看英文原文sandbox (default) or production
  • DARAJA_SHORTCODE Paybill / 商户号(沙盒中为 174379)
    查看英文原文Paybill / store number (174379 in sandbox)
  • DARAJA_INITIATOR_NAME API 操作员用户名(B2C、B2B、status、balance、reversal)
    查看英文原文API operator username (B2C, B2B, status, balance, reversal)
  • DARAJA_CALLBACK_BASE_URL 回调 URL 使用的公开 HTTPS 基础地址
    查看英文原文Public HTTPS base for callback URLs
  • DARAJA_CALLBACK_LISTEN 内置回调接收器的 host:port
    查看英文原文host:port for the built-in callback receiver
  • DARAJA_TOOLSETS 逗号分隔列表:stk,c2b,payouts,ops,qr,ratiba,billmanager
    查看英文原文Comma list: stk,c2b,payouts,ops,qr,ratiba,billmanager
  • DARAJA_READ_ONLY 设为 true 时,隐藏所有涉及资金转移或写入的工具。
    查看英文原文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 付款(payouts)可发送至的电话号码或短代码的逗号分隔列表
    查看英文原文Comma list of phones/shortcodes that payouts may go to
  • DARAJA_ALLOW_LIVE_MONEY_MOVEMENT 设为 true 以允许生产环境的收费和付款
    查看英文原文true to allow production charges and payouts
  • DARAJA_CERT_PATH Safaricom 公共证书的路径,与 DARAJA_INITIATOR_PASSWORD 配合使用
    查看英文原文Path to Safaricom's public certificate, used with DARAJA_INITIATOR_PASSWORD
  • DARAJA_STATE_DB 存储请求状态和回调的 SQLite 文件的路径。
    查看英文原文Path of the SQLite file that stores request state and callbacks
  • DARAJA_OUTPUT_DIR 保存生成的 QR PNG 的目录
    查看英文原文Directory where generated QR PNGs are saved
  • DARAJA_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 one
  • DARAJA_MCP_HOST HTTP 模式的绑定地址(默认 127.0.0.1)
    查看英文原文HTTP mode bind address (default 127.0.0.1)
  • DARAJA_MCP_PORT HTTP 模式端口(默认 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 会请你自己粘贴到文件或应用的输入框里。

  1. 安装 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 下载页 ↗

    装好后关掉终端再打开,重新运行同一条命令,应显示版本号: uv --version

    安装一次,所有需要 uv 的工具都能用

  2. 注册并创建 M-Pesa Daraja 的密钥

    打开开发者网站,注册账户并创建 API 密钥,下一步要用。价格和免费方案请看开发者网站。

    获取密钥的方法见下方开发者的 README

  3. 点击这个按钮打开 VS Code

    在 VS Code 中打开

    VS Code 会请你确认安装,点击 Install

  4. 填写你的密钥

    在 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 还是空的,填入你的密钥并保存

    只把密钥粘贴到应用的输入框里,不要粘贴到聊天中或发给任何人

  5. 在 VS Code 中以 Agent 模式打开 AI 聊天

  6. 试一试

    用 M-Pesa Daraja 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 VS Code 说正在使用 M-Pesa Daraja,或回答中出现 M-Pesa Daraja 的工具名称,就表示连接成功

18 项可选设置(不填也能用)

上面的命令不填这些也能用。想调整时再按开发者的说明添加。

  • DARAJA_ENV sandbox(默认)或 production
    查看英文原文sandbox (default) or production
  • DARAJA_SHORTCODE Paybill / 商户号(沙盒中为 174379)
    查看英文原文Paybill / store number (174379 in sandbox)
  • DARAJA_INITIATOR_NAME API 操作员用户名(B2C、B2B、status、balance、reversal)
    查看英文原文API operator username (B2C, B2B, status, balance, reversal)
  • DARAJA_CALLBACK_BASE_URL 回调 URL 使用的公开 HTTPS 基础地址
    查看英文原文Public HTTPS base for callback URLs
  • DARAJA_CALLBACK_LISTEN 内置回调接收器的 host:port
    查看英文原文host:port for the built-in callback receiver
  • DARAJA_TOOLSETS 逗号分隔列表:stk,c2b,payouts,ops,qr,ratiba,billmanager
    查看英文原文Comma list: stk,c2b,payouts,ops,qr,ratiba,billmanager
  • DARAJA_READ_ONLY 设为 true 时,隐藏所有涉及资金转移或写入的工具。
    查看英文原文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 付款(payouts)可发送至的电话号码或短代码的逗号分隔列表
    查看英文原文Comma list of phones/shortcodes that payouts may go to
  • DARAJA_ALLOW_LIVE_MONEY_MOVEMENT 设为 true 以允许生产环境的收费和付款
    查看英文原文true to allow production charges and payouts
  • DARAJA_CERT_PATH Safaricom 公共证书的路径,与 DARAJA_INITIATOR_PASSWORD 配合使用
    查看英文原文Path to Safaricom's public certificate, used with DARAJA_INITIATOR_PASSWORD
  • DARAJA_STATE_DB 存储请求状态和回调的 SQLite 文件的路径。
    查看英文原文Path of the SQLite file that stores request state and callbacks
  • DARAJA_OUTPUT_DIR 保存生成的 QR PNG 的目录
    查看英文原文Directory where generated QR PNGs are saved
  • DARAJA_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 one
  • DARAJA_MCP_HOST HTTP 模式的绑定地址(默认 127.0.0.1)
    查看英文原文HTTP mode bind address (default 127.0.0.1)
  • DARAJA_MCP_PORT HTTP 模式端口(默认 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 帮助页面核实 · 你的界面可能因版本略有不同

其他支持 MCP 的应用(如 Windsurf、Zed、Gemini CLI)添加方式各不相同,请在应用列表中查看

查看所有支持 MCP 的应用 →

JSON 设置在下方“开发者专用”中

卡住了?问问正在用 M-Pesa Daraja 的人💬 讨论 →
开发者专用:终端命令和 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-mcp

Claude 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 机密 必填 env
    Daraja 应用的 Consumer Key。
    查看英文原文Daraja app Consumer Key
  • DARAJA_CONSUMER_SECRET 机密 必填 env
    Daraja 应用的 Consumer Secret。
    查看英文原文Daraja app Consumer Secret
  • DARAJA_ENV env
    sandbox(默认)或 production
    查看英文原文sandbox (default) or production
  • DARAJA_SHORTCODE env
    Paybill / 商户号(沙盒中为 174379)
    查看英文原文Paybill / store number (174379 in sandbox)
  • DARAJA_PASSKEY 机密 必填 env
    M-Pesa Express 密钥(STK Push)
    查看英文原文M-Pesa Express passkey (STK Push)
  • DARAJA_INITIATOR_NAME env
    API 操作员用户名(B2C、B2B、status、balance、reversal)
    查看英文原文API operator username (B2C, B2B, status, balance, reversal)
  • DARAJA_SECURITY_CREDENTIAL 机密 必填 env
    已加密的发起方密码
    查看英文原文Encrypted initiator password
  • DARAJA_CALLBACK_BASE_URL env
    回调 URL 使用的公开 HTTPS 基础地址
    查看英文原文Public HTTPS base for callback URLs
  • DARAJA_CALLBACK_LISTEN env
    内置回调接收器的 host:port
    查看英文原文host:port for the built-in callback receiver
  • DARAJA_CALLBACK_TOKEN 机密 必填 env
    16 个以上的随机字符;用于回调的秘密路径
    查看英文原文16+ random characters; secret path for callbacks
  • DARAJA_TOOLSETS env
    逗号分隔列表:stk,c2b,payouts,ops,qr,ratiba,billmanager
    查看英文原文Comma list: stk,c2b,payouts,ops,qr,ratiba,billmanager
  • DARAJA_READ_ONLY env
    设为 true 时,隐藏所有涉及资金转移或写入的工具。
    查看英文原文true hides every tool that moves money or writes
  • DARAJA_APPROVAL_THRESHOLD env
    超过此金额(先令)的付款需要在聊天中获得批准
    查看英文原文Payouts above this many shillings need approval in the chat
  • DARAJA_ALLOWED_RECIPIENTS env
    付款(payouts)可发送至的电话号码或短代码的逗号分隔列表
    查看英文原文Comma list of phones/shortcodes that payouts may go to
  • DARAJA_ALLOW_LIVE_MONEY_MOVEMENT env
    设为 true 以允许生产环境的收费和付款
    查看英文原文true to allow production charges and payouts
  • DARAJA_INITIATOR_PASSWORD 机密 必填 env
    发起者密码,启动时加密为 SecurityCredential(可替代 DARAJA_SECURITY_CREDENTIAL)
    查看英文原文Initiator password, encrypted into SecurityCredential at startup (alternative to DARAJA_SECURITY_CREDENTIAL)
  • DARAJA_CERT_PATH env
    Safaricom 公共证书的路径,与 DARAJA_INITIATOR_PASSWORD 配合使用
    查看英文原文Path to Safaricom's public certificate, used with DARAJA_INITIATOR_PASSWORD
  • DARAJA_STATE_DB env
    存储请求状态和回调的 SQLite 文件的路径。
    查看英文原文Path of the SQLite file that stores request state and callbacks
  • DARAJA_OUTPUT_DIR env
    保存生成的 QR PNG 的目录
    查看英文原文Directory where generated QR PNGs are saved
  • DARAJA_CONFIG_DIR env
    保存已保存配置的目录(默认:用户配置目录)
    查看英文原文Directory holding the saved config (default: user config dir)
  • DARAJA_DOTENV env
    要加载的 .env 文件路径,替代项目中的文件
    查看英文原文Path of a .env file to load instead of the project one
  • DARAJA_MCP_TOKEN 机密 必填 env
    HTTP 模式的 Bearer 令牌(至少 32 个随机字符)。
    查看英文原文Bearer token for HTTP mode (32+ random characters)
  • DARAJA_MCP_HOST env
    HTTP 模式的绑定地址(默认 127.0.0.1)
    查看英文原文HTTP mode bind address (default 127.0.0.1)
  • DARAJA_MCP_PORT env
    HTTP 模式端口(默认 8000)
    查看英文原文HTTP mode port (default 8000)
  • DARAJA_FORWARD_URL env
    您的应用 URL:每个回调都会通过 POST 发送到该地址,并附带 HMAC 签名
    查看英文原文Your app's URL: every callback is POSTed on to it, HMAC-signed
  • DARAJA_FORWARD_SECRET 机密 必填 env
    用于转发回调的 HMAC 密钥(至少 16 个字符)
    查看英文原文HMAC secret for forwarded callbacks (16+ characters)

说明为自动翻译,变量名保持原样;不确定时请查看原文。

这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。

一览

GitHub 星标i
3 (整个仓库的星标)
该仓库包含多个 MCP 条目,星标在排名中只计算一次
每周下载量i
47/周
连接方式
在你的电脑上运行
最新版本i
0.1.6
发布到注册中心i
2026年10月29日
代码最后更新i
2026年11月4日
作者
Mr-Macharia
软件包
pypi: mpesa-daraja-mcp
注册状态
活跃

哪些应用可以使用它

依据这个服务器的连接方式和各应用自己的文档,检查于 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日

我们检查什么 → · JSON

作者:申请重新检查或报告信息错误
给作者:在 README 中加徽章

如果你是作者,可把这段代码贴到 README。徽章会链接回本页。

[![Featured on PopNx MCP](https://mcp.popnx.com/badge/mr-macharia-mpesa-daraja-mcp.svg)](https://mcp.popnx.com/en/servers/mr-macharia-mpesa-daraja-mcp)

讨论

提问、分享技巧或报告无法使用。按“有帮助”数量排序。

还没有帖子,欢迎第一个提问或分享。

此处内容由用户撰写,不代表 PopNx 团队。

登录后发帖

用户评价

还没有评价

登录后写评价

与“开发者工具”中的其他服务器比较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.

作者:ahmedkhaleel2004广泛使用★ 1.9万2个月前更新

在云端运行✓ 服务方 · gitdiagram.comPopNx 团队已实际试用

Appllama

Study screens, flows and paywalls from top-earning iOS apps, then build from what wins.

作者:Appllama广泛使用★ 52333个月前更新

在云端运行✓ 服务方 · appllama.io

Omnara

Deploy durable AI agents with Omnara, an open-source managed-agent platform.

作者:omnara-ai广泛使用★ 34232个月前更新

在云端运行✓ 服务方 · omnara.com

Repowise

Codebase intelligence for AI coding agents: graph, git history, docs, decisions, code health.

作者:repowise-dev广泛使用↓ 6506/周★ 8177 整个仓库的星标7天前更新

电脑或云端✓ 服务方 · repowise.dev
与相似项目对比
本项
M-Pesa Daraja
GitDiagramAppllamaCloudflare MCPOmnaraRepowise
运行位置需要安装在电脑上在云端运行,无需安装在云端运行,无需安装在云端运行,无需安装在云端运行,无需安装云端或安装在电脑上都可以
需要密钥是否否否否否
可在 Claude 中按 + 添加否否否是否否
基础检查3/34/44/44/44/45/5
许可证MITMITMITApache-2.0Apache-2.0AGPL-3.0
价格登记中未列出费用登记中未列出费用登记中未列出费用登记中未列出费用登记中未列出费用登记中未列出费用

作者的 README

打开 README

按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。

mpesa-daraja

Renamed from mpesa-daraja-mcp in 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

ToolDaraja APIMoves 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_credentialsOAuth token (never returned)
mpesa_get_resultFinal status by idempotency key or any Daraja ID (from captured callbacks; STK falls back to STK Query)
mpesa_stk_push_and_waitM-Pesa Express: push, then wait for callback / poll query; returns SUCCESS, FAILED or UNKNOWN✅
mpesa_stk_push / mpesa_stk_queryM-Pesa Express, fire-and-forget / status✅ /
mpesa_c2b_register_urls / mpesa_c2b_simulateC2B v2 (simulate = sandbox only)
mpesa_pull_transactionsPull Transactions query
mpesa_b2c_paymentB2C v3, B2Pochi✅
mpesa_b2b_paymentBusinessPayBill, BusinessBuyGoods, BusinessPayToBulk (B2C top-up), PayTaxToKRA✅
mpesa_b2b_express_checkoutB2B USSD push✅
mpesa_transaction_status / mpesa_account_balanceStatus / Balance (async result)
mpesa_reverse_transactionReversal✅
mpesa_generate_dynamic_qrDynamic QR, saved as a PNG file (path returned, not the image)
mpesa_ratiba_create_standing_orderM-Pesa Ratiba✅
mpesa_bill_manager_optin / mpesa_bill_manager_send_invoice / mpesa_bill_manager_cancel_invoiceBill 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=true hides 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_of with the original M-Pesa receipt; it appears in the approval prompt and the remarks.
  • Callback URLs must be HTTPS; C2B URLs with mpesa/safaricom in 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

VariableRequiredNotes
DARAJA_ENVsandbox (default) or production
DARAJA_CONSUMER_KEY, DARAJA_CONSUMER_SECRET✅From your Daraja app
DARAJA_SHORTCODEmost toolsPaybill / store number (174379 in sandbox)
DARAJA_PASSKEYSTKLipa na M-Pesa passkey
DARAJA_INITIATOR_NAMEB2C/B2B/status/balance/reversalAPI operator username
DARAJA_SECURITY_CREDENTIALsamePre-encrypted credential, or set the next two
DARAJA_INITIATOR_PASSWORD + DARAJA_CERT_PATHServer encrypts the password with the cert at startup
DARAJA_CALLBACK_BASE_URLe.g. https://abc.ngrok-free.app; tools append /mpesa/stk/callback, /mpesa/b2c/result, …
DARAJA_ALLOW_LIVE_MONEY_MOVEMENTtrue to allow production charges/payouts
DARAJA_CALLBACK_LISTENe.g. 127.0.0.1:8787: starts the built-in callback receiver
DARAJA_CALLBACK_TOKENwith receiver16+ random characters. Callback URLs become /cb/ /…
DARAJA_STATE_DBSQLite file for requests and results (default ~/.mpesa-mcp/state.db)
DARAJA_TOOLSETSComma list of stk,c2b,payouts,ops,qr,ratiba,billmanager (core is always on). Default: all
DARAJA_READ_ONLYtrue hides every tool that moves money or writes
DARAJA_APPROVAL_THRESHOLDPayouts above this many shillings need a yes in the chat
DARAJA_ALLOWED_RECIPIENTSComma list of phones/shortcodes that payouts may go to
DARAJA_OUTPUT_DIRWhere QR PNGs are saved (default ~/.mpesa-mcp/qr)
DARAJA_FORWARD_URLYour app's endpoint. Each callback is POSTed on to it, signed. See forwarding
DARAJA_FORWARD_SECRETwith forwarding16+ random characters, used for the X-Mpesa-Signature HMAC
DARAJA_MCP_TOKENHTTP mode32+ random characters; clients send Authorization: Bearer
DARAJA_MCP_HOST, DARAJA_MCP_PORTHTTP 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:

  1. Environment variables, e.g. from the client's env block.
  2. A project `.env` in the folder the agent starts the server in, or the file named by DARAJA_DOTENV. Only DARAJA_* lines are read.
  3. The user config file that setup writes: ~/.config/mpesa-daraja-mcp/config.env (Windows: %APPDATA%\mpesa-daraja-mcp\config.env; override the folder with DARAJA_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_wait returns the final outcome in one call.
  • Queue-timeout callbacks are recorded as UNKNOWN.
  • C2B validation requests are always accepted. Use yo

只显示了开头部分;其余内容请在仓库中阅读