CL Razorpay MCP Server
Integrates with Razorpay's payment infrastructure to manage orders, process payments, handle refunds, and query settlements via the Model Context Protocol. Features stateless, multi-tenant architecture with secure per-request authentication using API keys.
README
CL Razorpay MCP Server
Interact with Razorpay's payment infrastructure — orders, payments, refunds, and settlements — via API.
A Model Context Protocol (MCP) server that exposes Razorpay's REST API for managing orders, capturing payments, processing refunds, and querying settlements.
Overview
The CL Razorpay MCP Server provides stateless, multi-tenant access to the Razorpay API:
- Order management — create, fetch, update, and list orders
- Payment operations — fetch, capture, and update payments
- Refund handling — issue full or partial refunds, query refund status
- Settlement queries — list and inspect settlement records
Perfect for:
- Automating payment operations from AI agents or internal tools
- Querying transaction history and settlement data programmatically
- Building Claude-powered finance dashboards or customer support bots
Authentication
This server is stateless and multi-tenant. Every tenant-facing tool accepts key_id and key_secret on each call. Credentials are never stored server-side.
Obtain your API keys from the Razorpay Dashboard:
- Log in to your Razorpay Dashboard.
- Navigate to Settings → API Keys.
- Click Generate Test Key (for sandbox) or Generate Live Key.
- Copy the Key ID and Key Secret — the secret is shown only once.
Use the test-mode keys against https://api.razorpay.com/v1 — Razorpay's sandbox is live mode with test credentials, no separate base URL needed.
Tools
<details> <summary><code>health_check</code> — Verify server is running</summary>
Lightweight ping that confirms the MCP server is live. No auth required.
Inputs: none
Output:
{ "status": "ok", "server": "CL Razorpay MCP Server" }
</details>
Orders
<details> <summary><code>create_order</code> — Create a new Razorpay order</summary>
Creates an order that is required before initiating a payment on the frontend SDK.
Inputs:
key_id(string, required) — Razorpay API key IDkey_secret(string, required) — Razorpay API key secretamount(integer, required) — Amount in smallest currency unit (e.g. paise for INR; ₹500 =50000)currency(string, required) — ISO 4217 currency code, e.g."INR"receipt(string, optional) — Merchant receipt number (max 40 chars)notes(object, optional) — Key-value metadata to attachpartial_payment(boolean, optional) — Whether partial payments are allowed (default:false)
Output:
{
"id": "order_XXXXXXXXXX",
"entity": "order",
"amount": 50000,
"currency": "INR",
"status": "created",
"receipt": "receipt_001",
"created_at": 1690000000
}
Usage Example:
POST /mcp/razorpay/create_order
{
"key_id": "rzp_test_XXXXXXXX",
"key_secret": "XXXXXXXXXXXXXXXX",
"amount": 50000,
"currency": "INR",
"receipt": "receipt_001"
}
</details>
<details> <summary><code>fetch_order</code> — Fetch a single order by ID</summary>
Retrieves full details of a specific order.
Inputs:
key_id(string, required)key_secret(string, required)order_id(string, required) — e.g."order_XXXXXXXXXX"
Output: Full order object as returned by Razorpay API.
</details>
<details> <summary><code>fetch_all_orders</code> — List all orders with pagination</summary>
Retrieves a paginated list of orders, optionally filtered by creation timestamp.
Inputs:
key_id(string, required)key_secret(string, required)count(integer, optional) — Number to return (default:10, max:100)skip(integer, optional) — Offset for pagination (default:0)from_timestamp(integer, optional) — Unix epoch; fetch orders created after thisto_timestamp(integer, optional) — Unix epoch; fetch orders created before this
</details>
<details> <summary><code>fetch_payments_for_order</code> — Fetch payments linked to an order</summary>
Retrieves all payment attempts made against a specific order ID.
Inputs:
key_id(string, required)key_secret(string, required)order_id(string, required) — e.g."order_XXXXXXXXXX"
</details>
<details> <summary><code>update_order</code> — Update notes on an order</summary>
Updates the notes key-value map on an existing order.
Inputs:
key_id(string, required)key_secret(string, required)order_id(string, required)notes(object, required) — Key-value pairs to set
</details>
Payments
<details> <summary><code>fetch_payment</code> — Fetch a single payment by ID</summary>
Retrieves details of a specific payment.
Inputs:
key_id(string, required)key_secret(string, required)payment_id(string, required) — e.g."pay_XXXXXXXXXX"
</details>
<details> <summary><code>fetch_all_payments</code> — List all payments with pagination</summary>
Retrieves a paginated list of payments with optional timestamp filters.
Inputs:
key_id(string, required)key_secret(string, required)count(integer, optional) — default10, max100skip(integer, optional) — default0from_timestamp(integer, optional)to_timestamp(integer, optional)
</details>
<details> <summary><code>capture_payment</code> — Capture an authorized payment</summary>
Changes a payment from authorized to captured. Amount must exactly match the authorized amount.
Inputs:
key_id(string, required)key_secret(string, required)payment_id(string, required) — e.g."pay_XXXXXXXXXX"amount(integer, required) — Must match the authorized amount exactlycurrency(string, required) — e.g."INR"
</details>
<details> <summary><code>update_payment</code> — Update notes on a payment</summary>
Updates the notes key-value map on an existing payment.
Inputs:
key_id(string, required)key_secret(string, required)payment_id(string, required)notes(object, required)
</details>
Refunds
<details> <summary><code>create_refund</code> — Issue a full or partial refund</summary>
Creates a refund for a captured payment. Omit amount for a full refund.
Inputs:
key_id(string, required)key_secret(string, required)payment_id(string, required) — e.g."pay_XXXXXXXXXX"amount(integer, optional) — Partial refund amount; omit for full refundspeed(string, optional) —"normal"(default) or"optimum"notes(object, optional) — Key-value metadatareceipt(string, optional) — Merchant receipt for the refund
Output:
{
"id": "rfnd_XXXXXXXXXX",
"entity": "refund",
"amount": 50000,
"payment_id": "pay_XXXXXXXXXX",
"speed_processed": "normal",
"status": "processed"
}
</details>
<details> <summary><code>fetch_refund</code> — Fetch a single refund by ID</summary>
Inputs:
key_id(string, required)key_secret(string, required)refund_id(string, required) — e.g."rfnd_XXXXXXXXXX"
</details>
<details> <summary><code>fetch_all_refunds</code> — List all refunds with pagination</summary>
Inputs:
key_id(string, required)key_secret(string, required)count(integer, optional) — default10, max100skip(integer, optional) — default0from_timestamp(integer, optional)to_timestamp(integer, optional)
</details>
<details> <summary><code>fetch_refunds_for_payment</code> — Fetch refunds for a payment</summary>
Inputs:
key_id(string, required)key_secret(string, required)payment_id(string, required) — e.g."pay_XXXXXXXXXX"count(integer, optional) — default10skip(integer, optional) — default0
</details>
<details> <summary><code>update_refund</code> — Update notes on a refund</summary>
Inputs:
key_id(string, required)key_secret(string, required)refund_id(string, required)notes(object, required)
</details>
Settlements
<details> <summary><code>fetch_all_settlements</code> — List all settlements with pagination</summary>
Inputs:
key_id(string, required)key_secret(string, required)count(integer, optional) — default10, max100skip(integer, optional) — default0from_timestamp(integer, optional)to_timestamp(integer, optional)
</details>
<details> <summary><code>fetch_settlement</code> — Fetch a single settlement by ID</summary>
Inputs:
key_id(string, required)key_secret(string, required)settlement_id(string, required) — e.g."setl_XXXXXXXXXX"
</details>
<details> <summary><strong>API Parameters Reference</strong></summary>
Common Parameters
count— Number of records to return (integer, 1–100, default 10)skip— Number of records to skip for pagination (integer, default 0)from_timestamp— Unix epoch integer; lower bound oncreated_atto_timestamp— Unix epoch integer; upper bound oncreated_at
Resource ID Formats
Order:
order_{alphanumeric}
Example: order_OE1jIbY9HrFaXw
Payment:
pay_{alphanumeric}
Example: pay_OE1jIbY9HrFaXw
Refund:
rfnd_{alphanumeric}
Example: rfnd_OE1jIbY9HrFaXw
Settlement:
setl_{alphanumeric}
Example: setl_OE1jIbY9HrFaXw
</details>
<details> <summary><strong>API Key Guide</strong></summary>
All tools require Razorpay API credentials. Here's how to obtain them:
Step 1: Sign Up / Log In
- Go to Razorpay Dashboard
- Sign up or log into your account
Step 2: Generate API Keys
- Navigate to Settings → API Keys
- Click Generate Test Key for sandbox or Regenerate Live Key for production
- Download or copy both Key ID and Key Secret immediately
Step 3: Use Credentials Per Request
Pass key_id and key_secret in every tool call. The server uses HTTP Basic Auth (key_id as username, key_secret as password) on each request.
Step 4: Required Permissions
Ensure your Razorpay account has:
payments:read— Read payment detailspayments:write— Capture and update paymentsorders:read— Read order detailsorders:write— Create and update ordersrefunds:read— Read refund detailsrefunds:write— Create and update refundssettlements:read— Read settlement details
Refer to the Razorpay Authentication Guide for details.
</details>
<details> <summary><strong>Troubleshooting</strong></summary>
Missing or Invalid API Key
- Cause:
key_idorkey_secretis missing, incorrect, or belongs to a different mode (test vs live) - Solution:
- Re-copy credentials from the Razorpay Dashboard
- Ensure you are using test keys for sandbox and live keys for production
- Regenerate keys if they have been rotated
Insufficient Credits / Rate Limiting
- Cause: API calls have exceeded your account's rate limits
- Solution:
- Reduce request frequency
- Check Razorpay API Best Practices for rate limit guidance
Malformed Request Payload
- Cause: Required fields missing or wrong types
- Solution:
- Ensure
amountis an integer in smallest currency unit (paise, not rupees) - Ensure all required tool parameters are provided
- Verify
currencyis a valid ISO 4217 code
- Ensure
Payment Cannot Be Captured
- Cause: Payment is not in
authorizedstate, or amount mismatch - Solution:
- Check payment status with
fetch_paymentbefore capturing - Ensure
amountincapture_paymentexactly matches the authorized amount
- Check payment status with
Refund Cannot Be Created
- Cause: Payment is not in
capturedstate, or has already been fully refunded - Solution:
- Verify payment status with
fetch_payment - Check existing refunds with
fetch_refunds_for_payment
- Verify payment status with
</details>
<details> <summary><strong>Resources</strong></summary>
- Razorpay API Documentation — Official API reference
- Razorpay Authentication Guide — Auth setup guide
- Razorpay Orders API — Orders endpoint reference
- Razorpay Payments API — Payments endpoint reference
- Razorpay Refunds API — Refunds endpoint reference
- Razorpay Settlements API — Settlements endpoint reference
- FastMCP Docs — FastMCP specification
</details>
Setup
pip install -r requirements.txt
Running the Server
# stdio (default — for local Claude Desktop / MCP clients)
python server.py
# SSE transport
python server.py --transport sse --host 127.0.0.1 --port 8001
# Streamable HTTP transport
python server.py --transport streamable-http --host 127.0.0.1 --port 8001
Example Tool Call
{
"tool": "create_order",
"arguments": {
"key_id": "rzp_test_XXXXXXXX",
"key_secret": "XXXXXXXXXXXXXXXX",
"amount": 50000,
"currency": "INR",
"receipt": "receipt_001"
}
}
Project Structure
cl-mcp-razorpay/
|-- server.py
|-- requirements.txt
|-- README.md
|-- .gitignore
`-- razorpay_mcp/
|-- __init__.py
|-- cli.py
|-- config.py
|-- schemas.py
|-- service.py
`-- tools.py
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.