PayDesk MCP

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.

Category
访问服务器

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 5432 with a database named paydesk)
  • Git & pip

Installation

  1. Clone the repository:

    git clone <repository_url>
    cd paydesk-mcp
    
  2. Create a virtual environment:

    python -m venv .venv
    .venv\Scripts\activate   # On Windows
    source .venv/bin/activate # On Unix/macOS
    
  3. Install dependencies:

    pip install -r requirements.txt
    

Configure Environment

  1. Copy the template file:

    cp .env.example .env
    
  2. 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.msc and start MongoDB, postgresql-x64-18, and Redis services.
  • 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.py or default database seeders):
    python seed/seed_malicious_tickets.py
    
    Inserts demo support tickets into MongoDB with special payloads to test prompt injection defenses.

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:

  1. Get Merchant Balance:

    • Tool: get_merchant_balance
    • Arguments: {"merchant_id": "MER-1005"}
  2. Get Recent Transactions:

    • Tool: get_recent_transactions
    • Arguments: {"merchant_id": "MER-1005", "limit": 5}
  3. Check Merchant Health:

    • Tool: check_merchant_health
    • Arguments: {"merchant_id": "MER-1005"}
  4. Retrieve Support Tickets:

    • Tool: get_support_ticket
    • Arguments: {"ticket_id": "TCK-501"}

Troubleshooting

  • Redis connection failed: Ensure Redis is running and listening on port 6379. Run netstat -ano | findstr 6379.
  • Mongo not running: Check if the MongoDB service is active. Check pymongo.errors.ServerSelectionTimeoutError.
  • Postgres authentication failed: Check POSTGRES_USER and POSTGRES_PASSWORD in .env and verify PostgreSQL is listening on port 5432.
  • Missing .env: Ensure you ran cp .env.example .env and didn't leave variables blank. Described startup errors will prevent execution.
  • Port already in use: Change MCP_PORT in .env if 8000 is occupied.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选