UNPKG

@phqb/mcp-server

Version:

PHQB MCP Payment Server - AI-powered payment processing for Claude and other AI assistants

208 lines (150 loc) • 5.72 kB
# PHQB MCP Server šŸ¤– **AI-powered payment processing for Claude and other AI assistants** PHQB MCP Server is a Model Context Protocol (MCP) compatible server that enables AI assistants like Claude to create payments, manage orders, process refunds, and analyze payment data through natural language conversations. ## ✨ Features ### šŸŽÆ 16 Professional Payment Tools #### šŸ’³ Payment Creation (3 tools) - **create_wechat_payment** - WeChat Pay specific QR codes - **create_alipay_payment** - Alipay specific QR codes - **create_auto_payment** - Smart aggregated payment with one QR code for WeChat + Alipay #### šŸ“‹ Order Management (4 tools) - **get_order_details** - Detailed order information - **search_orders** - Advanced order search with filters - **get_recent_orders** - Recent order history (up to 100 orders) - **cancel_order** - Cancel unpaid orders #### šŸ’° Refund Management (3 tools) - **create_refund** - Create full or partial refunds - **get_refund_status** - Track refund processing status - **get_refund_history** - Refund history and statistics #### šŸ“Š Analytics & Insights (3 tools) - **get_payment_stats** - Payment statistics with trends - **get_revenue_summary** - Comprehensive revenue analysis - **get_top_products** - Best-selling products/services ranking #### šŸ‘„ Customer Management (2 tools) - **get_customer_info** - Customer payment history and profile - **get_customer_stats** - Customer behavior analytics ### šŸ”’ Security & Permissions - **API Key Authentication** - Secure access with PHQB API keys - **Fine-grained Permissions** - Tool access based on API key permissions - **Rate Limiting** - Plan-based usage limits (Free/Pro/Advanced) - **Usage Logging** - Complete audit trail of AI tool usage ## šŸš€ Quick Start ### 1. Installation ```bash npm install -g @phqb/mcp-server ``` ### 2. Get Your API Key 1. Visit [PHQB Dashboard](https://www.phqb.com/dashboard?tab=apikey) 2. Create a new API Key with MCP permissions 3. Copy your API Key ### 3. Configure Claude Desktop Add to your Claude Desktop configuration file: **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json` **Windows**: `%APPDATA%\Claude\claude_desktop_config.json` ```json { "mcpServers": { "phqb-payment": { "command": "npx", "args": ["@phqb/mcp-server"], "env": { "PHQB_API_KEY": "your-api-key-here", "PHQB_API_URL": "https://www.phqb.com" } } } } ``` ### 4. Restart Claude Desktop Restart Claude Desktop to load the PHQB payment tools. ### 5. Start Using AI Payments! Try these example prompts in Claude: ``` "Create a payment link for $99 for my AI programming course" "Show me today's payment statistics" "Check the status of order PHQB_123456789" "Create a refund for order PHQB_123456789 due to customer request" ``` ## šŸ› ļø CLI Usage ### Test Connection ```bash phqb-mcp test --api-key "your-api-key" ``` ### List Available Tools ```bash phqb-mcp tools --api-key "your-api-key" ``` ### Start Server Manually ```bash phqb-mcp start --api-key "your-api-key" ``` ## šŸ“‹ Plan Limitations | Feature | Free | Pro | Advanced | |---------|------|-----|----------| | **API Keys** | 2 | 10 | Unlimited | | **MCP Tools** | 2 tools | 8 tools | 16 tools | | **Daily Calls** | 50 | 500 | Unlimited | | **Payment Creation** | āœ… | āœ… | āœ… | | **Order Management** | āŒ | āœ… | āœ… | | **Refund Processing** | āŒ | āŒ | āœ… | | **Analytics** | āŒ | Basic | Advanced | | **Customer Management** | āŒ | āŒ | āœ… | ## šŸŽÆ Use Cases ### šŸ’¼ Business Automation - **AI Sales Assistant**: "Create payment links for new customers" - **Customer Service**: "Process refunds and check order status" - **Financial Reporting**: "Generate monthly revenue reports" ### šŸ›’ E-commerce Integration - **Product Sales**: "Create payment for premium course $199" - **Subscription Management**: "Check customer payment history" - **Inventory Tracking**: "Show top-selling products this month" ### šŸ“Š Data Analysis - **Revenue Insights**: "Analyze payment trends over last 90 days" - **Customer Behavior**: "Find high-value customers for marketing" - **Performance Metrics**: "Calculate conversion rates and success metrics" ## šŸ”§ Advanced Configuration ### Environment Variables ```bash export PHQB_API_KEY="your-api-key" export PHQB_API_URL="https://www.phqb.com" # Optional ``` ### Custom Base URL (for development) ```json { "mcpServers": { "phqb-payment": { "command": "npx", "args": ["@phqb/mcp-server"], "env": { "PHQB_API_KEY": "your-api-key", "PHQB_API_URL": "http://localhost:3000" } } } } ``` ## šŸ› Troubleshooting ### Common Issues **"Invalid API Key" Error** - Verify your API key is correct - Check API key permissions include MCP tools - Ensure API key is active and not expired **"Permission Denied" Error** - Your API key lacks required permissions - Upgrade your PHQB plan for more tools - Edit API key permissions in dashboard **"Rate Limit Exceeded" Error** - You've exceeded your plan's daily/hourly limits - Upgrade to Pro or Advanced plan - Wait for rate limit reset ### Getting Help - šŸ“– [Documentation](https://www.phqb.com/docs/mcp) - šŸ’¬ [Support](https://www.phqb.com/support) - šŸ› [Report Issues](https://github.com/nzleo/phqb/issues) ## šŸ“„ License MIT License - see [LICENSE](LICENSE) file for details. ## šŸ¤ Contributing We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details. --- **Made with ā¤ļø by the PHQB Team** 🌐 [Website](https://www.phqb.com) • šŸ“š [Docs](https://www.phqb.com/docs) • 🐦 [Twitter](https://twitter.com/phqb_com)