automate mpesa transaction for ai application
# M-Pesa MCP Server (Go Implementation)
A Model Context Protocol (MCP) server for integrating M-Pesa payments with AI agents, built in Go.
> **⚠️ IMPORTANT: This handles real money transactions!**
> Before using in production, read Understanding the Payment Flow and review Security Best Practices. Always test thoroughly in sandbox mode first.
## 🎯 What This Does
This MCP server allows AI agents (like those built with Google ADK, LangChain, Claude Desktop) to:
- Initiate M-Pesa STK Push payments (prompt customers to pay from their phones)
- Generate M-Pesa QR codes for payment
- Check authentication token status
- **[NEW]** Handle M-Pesa payment callbacks (webhooks)
**New to this project?** → Start with the Quick Start Guide (5 minutes)
**Want to integrate?** → Check out Integration Examples
## 💰 Understanding the Payment Flow
This is critical to understand before using this server:
```
CUSTOMER (PartyA) → Pays Money → YOUR BUSINESS (PartyB)
254712345678 Your Shortcode/Till
```
**The money flow is ALWAYS:**
- **FROM**: Customer's M-Pesa account (the phone number you specify)
- **TO**: YOUR business account (configured in `.env` as `BUSINESS_SHORTCODE`)
**All payments go TO your business account, not to the agent or server operator.**
📖 **Read the full guide**: Payment Flow & Use Cases
## 📚 Documentation
### Getting Started
- Setup Guide - Detailed installation and configuration
- Payment Flow Guide - Understanding who pays who
### Integration
- Integration Guide - Connect with AI frameworks (Google ADK, LangChain, Claude, etc.)
- API Reference - Complete tool documentation
- Integration Examples - Working code examples
### Deployment & Operations
- Deployment Guide - Docker, Kubernetes, Cloud platforms
- Security Best Practices - Production security & compliance
- Troubleshooting - Common issues and solutions
### Additional Resources
- Use Cases & Examples - Real-world scenarios
- Callback Implementation - Handle paymen …