PayDesk MCP
PayDesk MCP is a production-grade Model Context Protocol (MCP) server that exposes payment gateway APIs, tools, prompts, and resources. It bridges the gap between an AI assistant and three underlying database systems to resemble real payment services like Stripe, Razorpay, or PayPal.
README
PayDesk MCP
PayDesk MCP is a production-grade Model Context Protocol (MCP) server that exposes payment gateway APIs, tools, prompts, and resources. It bridges the gap between an AI assistant (like Claude, Gemini, or ChatGPT) and three underlying database systems to resemble real payment services like Stripe, Razorpay, or PayPal.
Architecture
The server aggregates data across Redis, MongoDB, and PostgreSQL to provide consolidated ledger, dispute, support, and session APIs.
User
↓
AI Assistant
↓
[Bearer Auth JWT]
↓
FastMCP Server
↓
┌───────┼──────────────┐
↓ ↓ ↓
Redis MongoDB PostgreSQL
- Redis: Caches merchant profiles, active developer API keys, dashboard sessions, and rate-limiting buckets.
- MongoDB: Stores disputes, support tickets, transaction metadata, and webhook delivery logs.
- PostgreSQL: Implements the double-entry accounting ledger, payouts, fee schedules, and balances.
Features
- Authentication: JWT Bearer token validation via Starlette HTTP middleware.
- Authorization & Scoping: Centralized merchant scoping preventing cross-merchant access.
- Audit Logging: Automatic logging of tool execution, arguments, and outcomes into MongoDB.
- Database Adapters: Validation of configuration secrets loaded securely via
python-dotenv. - MCP Tools: 36 specialized tools for key management, dispute evidence, bank payouts, and payment statistics.
- MCP Resources: 15 endpoints providing read-only states (e.g. balance, open tickets, system AML/KYC policies).
- MCP Prompts: 10 pre-registered system templates aiding LLMs in payment operation diagnostics.
Prerequisites
- Python: 3.10 or higher
- Redis: 6.x or higher (Listening on port
6379) - MongoDB: 5.x or higher (Listening on port
27017) - PostgreSQL: 15.x or higher (Listening on port
5432with a database namedpaydesk) - Git & pip
Installation
-
Clone the repository:
git clone <repository_url> cd paydesk-mcp -
Create a virtual environment:
python -m venv .venv .venv\Scripts\activate # On Windows source .venv/bin/activate # On Unix/macOS -
Install dependencies:
pip install -r requirements.txt
Configure Environment
-
Copy the template file:
cp .env.example .env -
Fill in your environment credentials in
.env: Ensure your local PostgreSQL database, username, and password (JaiBagga02@by default or custom) are set.
Start Databases
Option A: Local Native Services
- Windows Services: Open
services.mscand startMongoDB,postgresql-x64-18, andRedisservices. - WSL/Linux Services:
sudo service redis-server start sudo service mongodb start sudo service postgresql start
Option B: Docker Compose
If you prefer Docker, start all three databases using:
docker run -d --name paydesk-redis -p 6379:6379 redis:alpine
docker run -d --name paydesk-mongo -p 27017:27017 mongo:latest
docker run -d --name paydesk-postgres -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=JaiBagga02@ -e POSTGRES_DB=paydesk postgres:alpine
Seed Data
To populate transaction and dispute records:
- Transactions & Ledger Data: Run the postgres/mongo seeding script if available (e.g.,
seed/seed_malicious_tickets.pyor default database seeders):
Inserts demo support tickets into MongoDB with special payloads to test prompt injection defenses.python seed/seed_malicious_tickets.py
Run Server
Run the server natively:
python server.py
Or run using FastMCP CLI:
fastmcp run server.py
Expected Startup Output
Starting PayDesk MCP server on 127.0.0.1:8000 with log level 'info'...
INFO: Started server process [12345]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on https://127.0.0.1:8000 (Press CTRL+C to quit)
Open MCP Inspector
To test tools and resources inside a visual debugger:
npx @modelcontextprotocol/inspector fastmcp run server.py
This launches a browser-based UI to invoke tools and read resources dynamically.
Example Tool Calls
When interacting with the MCP server, the LLM can invoke these commands:
-
Get Merchant Balance:
- Tool:
get_merchant_balance - Arguments:
{"merchant_id": "MER-1005"}
- Tool:
-
Get Recent Transactions:
- Tool:
get_recent_transactions - Arguments:
{"merchant_id": "MER-1005", "limit": 5}
- Tool:
-
Check Merchant Health:
- Tool:
check_merchant_health - Arguments:
{"merchant_id": "MER-1005"}
- Tool:
-
Retrieve Support Tickets:
- Tool:
get_support_ticket - Arguments:
{"ticket_id": "TCK-501"}
- Tool:
Troubleshooting
- Redis connection failed: Ensure Redis is running and listening on port
6379. Runnetstat -ano | findstr 6379. - Mongo not running: Check if the MongoDB service is active. Check
pymongo.errors.ServerSelectionTimeoutError. - Postgres authentication failed: Check
POSTGRES_USERandPOSTGRES_PASSWORDin.envand verify PostgreSQL is listening on port5432. - Missing .env: Ensure you ran
cp .env.example .envand didn't leave variables blank. Described startup errors will prevent execution. - Port already in use: Change
MCP_PORTin.envif8000is occupied.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.