mcp-jazzcash
Enables AI agents to create hosted checkouts, charge mobile wallets, query transactions, and process refunds via the JazzCash payment API.
README
mcp-jazzcash
An open-source Model Context Protocol server for JazzCash — Pakistan's largest mobile-money platform. Plug it into Claude Desktop, Cursor, Cline, or any MCP-aware agent and let it create checkouts, charge mobile wallets, look up transactions, and issue refunds against the JazzCash REST API.
Sandbox-by-default. Bring your own merchant credentials. No secrets bundled.
Table of contents
- Why this exists
- Tools
- Quick start
- Configuration
- Wire it into Claude Desktop
- Use it from any MCP client
- How the signature works
- Endpoint overrides
- Security model
- Roadmap
- Contributing
- License
Why this exists
The Pakistani payments stack is fragmented and English-language documentation for AI agents is thin. This MCP gives any agent a stable, typed interface to JazzCash so you don't have to teach it the signature scheme, field names, and gotchas every time. Prompt your agent in plain English; let the server do the cryptography and HTTP.
Tools
| Tool | Purpose |
|---|---|
jazzcash_create_hosted_checkout |
Builds a signed Hosted Checkout (Page Redirection) form. Returns the action URL, hidden fields, and a ready-to-use HTML snippet your app can serve. |
jazzcash_charge_mobile_wallet |
Server-to-server MWALLET charge. Customer authorizes via MPIN on their phone. |
jazzcash_inquire_transaction |
Status lookup by pp_TxnRefNo. |
jazzcash_refund_transaction |
Full or partial refund (requires merchant role). |
jazzcash_environment_info |
Reports active environment, endpoint URLs, and which credentials are present. Never returns secrets. |
All amounts are passed as PKR paisa (rupees × 100) to avoid float rounding.
Quick start
git clone https://github.com/TehreemArbab/JazzCashMCP.git
cd JazzCashMCP
npm install
cp .env.example .env # then edit .env with your sandbox credentials
npm run build
npm start
The server speaks MCP over stdio, so npm start is most useful when launched by an MCP client (see below). To verify the build alone:
npm run typecheck
Configuration
Copy .env.example to .env and fill in credentials from your JazzCash merchant portal:
JAZZCASH_MERCHANT_ID=MC...
JAZZCASH_PASSWORD=...
JAZZCASH_INTEGRITY_SALT=...
JAZZCASH_ENV=sandbox
JAZZCASH_RETURN_URL=https://yourapp.example.com/jazzcash/callback
Sandbox credentials are issued at https://sandbox.jazzcash.com.pk. To go live, switch JAZZCASH_ENV=production and swap in your live merchant credentials — no code changes required.
| Variable | Required | Notes |
|---|---|---|
JAZZCASH_MERCHANT_ID |
yes | From the merchant portal. |
JAZZCASH_PASSWORD |
yes | API password, not your portal login. |
JAZZCASH_INTEGRITY_SALT |
yes | HMAC key for pp_SecureHash. |
JAZZCASH_ENV |
yes | sandbox or production. |
JAZZCASH_RETURN_URL |
only for hosted checkout | Where JazzCash redirects the customer post-payment. |
JAZZCASH_LANGUAGE |
no | Default EN. |
JAZZCASH_CURRENCY |
no | Default PKR. |
JAZZCASH_VERSION |
no | Default 1.1. |
JAZZCASH_*_URL |
no | Per-endpoint URL override; see Endpoint overrides. |
Wire it into Claude Desktop
Add this to claude_desktop_config.json:
{
"mcpServers": {
"jazzcash": {
"command": "node",
"args": ["C:/path/to/mcp-jazzcash/dist/index.js"],
"env": {
"JAZZCASH_MERCHANT_ID": "MC...",
"JAZZCASH_PASSWORD": "...",
"JAZZCASH_INTEGRITY_SALT": "...",
"JAZZCASH_ENV": "sandbox",
"JAZZCASH_RETURN_URL": "https://yourapp.example.com/jazzcash/callback"
}
}
}
}
Restart Claude Desktop, then try:
"Using the JazzCash MCP, create a hosted checkout for PKR 1500 with description 'Order #1023' and bill reference 'INV1023'."
Claude will call jazzcash_create_hosted_checkout and hand back the form HTML.
Use it from any MCP client
The server uses stdio transport, so it works with anything that speaks MCP — Cursor, Cline, Continue, Zed, and custom agents built on the MCP TypeScript SDK. Point the client at node /path/to/dist/index.js and pass the same env vars shown above.
How the signature works
JazzCash uses HMAC-SHA256 over alphabetically sorted, non-empty pp_* fields, joined with &, with the merchant's Integrity Salt as both the HMAC key and a prepended salt:
message = integritySalt + "&" + sortedField1Value + "&" + sortedField2Value + ...
hash = hex(HMAC_SHA256(key=integritySalt, message))
pp_SecureHash itself is excluded from the message. Empty values are skipped. The implementation lives in src/signature.ts — small enough to audit in 30 seconds.
Endpoint overrides
Default endpoint URLs ship for both sandbox and production. If JazzCash rotates a path, override the relevant variable without changing code:
JAZZCASH_HOSTED_CHECKOUT_URL=https://sandbox.jazzcash.com.pk/.../HostedCheckout
JAZZCASH_MOBILE_WALLET_URL=https://sandbox.jazzcash.com.pk/.../DoMWalletTransaction
JAZZCASH_INQUIRY_URL=https://sandbox.jazzcash.com.pk/.../StatusInquiry
JAZZCASH_REFUND_URL=https://sandbox.jazzcash.com.pk/.../DoRefundTransaction
Security model
- No bundled secrets. Credentials are read from environment variables only.
- No secrets in tool output.
jazzcash_environment_inforeturns only booleans for which credentials are configured. - Sandbox is the default. Production requires explicitly setting
JAZZCASH_ENV=production. - Stdio transport. The server has no network listener; it talks only to the parent MCP client process.
- Audit-friendly. Signature logic is isolated in one short file. No vendored crypto.
If you find a security issue, please open a private advisory on GitHub rather than a public issue.
Roadmap
- [ ] Card / Tokenization tools (Authorize, Capture, Retrieve/Delete Token)
- [ ] IPN webhook signature-verification helper
- [ ] Voucher / OTC payment flow
- [ ] CLI (
mcp-jazzcash inspect) for hash debugging - [ ] Published npm package + automated releases
Contributing
Issues and PRs welcome. A few ground rules:
- Don't paste real merchant credentials into bug reports — use the placeholder
JAZZCASH_*names. - Keep new tools framework-agnostic; the server should remain usable from any MCP client.
- Run
npm run typecheckbefore opening a PR.
License
MIT. Not affiliated with or endorsed by JazzCash, Mobilink Microfinance Bank, or VEON.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。