Skip to main content
Glama
mcp-server-razorpay

mcp-server-razorpay

by bugmagnet28

mcp-server-razorpay

A Model Context Protocol (MCP) server that exposes Razorpay APIs to AI agents.

Enable AI assistants to create orders, process payments, handle refunds, manage subscriptions, and generate payment links โ€” autonomously.

TypeScript MCP SDK License: MIT Razorpay


๐Ÿค– What Can an AI Agent Do With This?

Once connected, your AI assistant can handle real payment operations via natural language:

  • "Create an order for โ‚น999 and send a payment link to john@example.com"

  • "Refund payment pay_abc123 with optimum speed"

  • "List all payments from the last 7 days"

  • "Cancel subscription sub_xyz at the end of the current billing cycle"

  • "Create a customer for Riya Sharma with contact +919876543210"


Related MCP server: Razorpay MCP Server

๐Ÿ› ๏ธ Tools

๐Ÿ“ฆ Orders

Tool

Description

create_order

Create a new order (amount in paise, e.g. 50000 = โ‚น500)

fetch_order

Fetch order details by order ID

list_orders

List orders with filters (count, date range, status)

๐Ÿ’ณ Payments

Tool

Description

fetch_payment

Fetch payment details by payment ID

capture_payment

Capture an authorized payment

list_payments

List payments with date and count filters

๐Ÿ”„ Refunds

Tool

Description

create_refund

Full or partial refund with normal/optimum speed

fetch_refund

Fetch a specific refund by refund ID

list_refunds_for_payment

List all refunds on a payment

๐Ÿ‘ค Customers

Tool

Description

create_customer

Create a new Razorpay customer

fetch_customer

Fetch customer details by customer ID

๐Ÿ” Subscriptions

Tool

Description

create_subscription

Create a recurring subscription for a plan

fetch_subscription

Fetch subscription status and details

cancel_subscription

Cancel immediately or at end of billing cycle

Tool

Description

create_payment_link

Generate a shareable payment link with optional SMS/email delivery

fetch_payment_link

Fetch payment link details and status

deactivate_payment_link

Expire a payment link immediately


โšก Quickstart

1. Get Razorpay API Keys

Sign up at dashboard.razorpay.com โ†’ Settings โ†’ API Keys. Use Test Mode keys during development.

2. Clone & Install

git clone https://github.com/YOUR_USERNAME/mcp-server-razorpay.git
cd mcp-server-razorpay
npm install

3. Configure Environment

cp .env.example .env

Edit .env:

RAZORPAY_KEY_ID=rzp_test_xxxxxxxxxxxxxx
RAZORPAY_KEY_SECRET=xxxxxxxxxxxxxxxxxxxxxxxx

4. Build

npm run build

๐Ÿ”Œ Connect to Claude Desktop

Edit your claude_desktop_config.json:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "razorpay": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-server-razorpay/dist/index.js"],
      "env": {
        "RAZORPAY_KEY_ID": "rzp_test_xxxxxxxxxxxxxx",
        "RAZORPAY_KEY_SECRET": "xxxxxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}

Restart Claude Desktop โ€” you'll see the ๐Ÿ”จ tools icon appear.


๐Ÿ”Œ Connect to Cursor

Go to Settings โ†’ Tools & Integrations โ†’ New MCP Server and add:

{
  "razorpay": {
    "command": "node",
    "args": ["/absolute/path/to/mcp-server-razorpay/dist/index.js"],
    "env": {
      "RAZORPAY_KEY_ID": "rzp_test_xxxxxxxxxxxxxx",
      "RAZORPAY_KEY_SECRET": "xxxxxxxxxxxxxxxxxxxxxxxx"
    }
  }
}

๐Ÿงช Debug with MCP Inspector

npm run inspector

Opens a browser UI where you can test every tool interactively before connecting to a client.


๐Ÿ“ Project Structure

mcp-server-razorpay/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ index.ts              # Entry point & server init
โ”‚   โ”œโ”€โ”€ client.ts             # Razorpay axios instance + Basic Auth
โ”‚   โ””โ”€โ”€ tools/
โ”‚       โ”œโ”€โ”€ orders.ts         # Order management tools
โ”‚       โ”œโ”€โ”€ payments.ts       # Payment tools
โ”‚       โ”œโ”€โ”€ refunds.ts        # Refund tools
โ”‚       โ”œโ”€โ”€ customers.ts      # Customer tools
โ”‚       โ”œโ”€โ”€ subscriptions.ts  # Subscription tools
โ”‚       โ””โ”€โ”€ paymentLinks.ts   # Payment link tools
โ”œโ”€โ”€ .env.example
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ tsconfig.json

๐Ÿ”’ Security Notes

  • Never commit your .env file โ€” it's in .gitignore

  • Use Test Mode keys during development; switch to Live keys only in production

  • The server runs locally โ€” your API keys never leave your machine


๐Ÿค Contributing

PRs welcome! If you'd like to add tools (e.g. Payouts, Settlements, Webhooks), open an issue first to discuss.


๐Ÿ“„ License

MIT โ€” free for personal and commercial use.

Available Tools

17 tools
cancel_subscriptionCancel SubscriptionB

Cancel a Razorpay subscription immediately or at end of billing cycle.

Inputs: subscription_id (required), cancel_at_cycle_end.

capture_paymentCapture PaymentA

Capture an authorized Razorpay payment. Amount must match the original order amount in paise.

Inputs: amount (required), payment_id (required), currency.

create_customerCreate CustomerC

Create a new customer in Razorpay.

Inputs: name (required), email, notes, contact, +1 more.

create_orderCreate OrderB

Create a new Razorpay order. Amount must be in paise (e.g. 50000 = โ‚น500).

Inputs: amount (required), notes, receipt, currency.

create_refundCreate RefundB

Create a full or partial refund for a Razorpay payment. Omit amount for full refund.

Inputs: payment_id (required), notes, speed, amount, +1 more.

create_subscriptionCreate SubscriptionC

Create a recurring subscription for a customer in Razorpay.

Inputs: plan_id (required), total_count (required), notes, quantity, +2 more.

fetch_customerFetch CustomerB

Fetch a Razorpay customer by their customer ID.

Inputs: customer_id (required).

fetch_orderFetch OrderB

Fetch details of a specific Razorpay order by order ID.

Inputs: order_id (required).

fetch_paymentFetch PaymentB

Fetch details of a specific Razorpay payment by payment ID.

Inputs: payment_id (required).

fetch_refundFetch RefundC

Fetch a specific refund by refund ID and payment ID.

Inputs: refund_id (required), payment_id (required).

fetch_subscriptionFetch SubscriptionB

Fetch a Razorpay subscription by subscription ID.

Inputs: subscription_id (required).

list_ordersList OrdersC

List Razorpay orders with optional filters.

Inputs: to, from, skip, count, +2 more.

list_paymentsList PaymentsC

List Razorpay payments with optional filters.

Inputs: to, from, skip, count.

list_refunds_for_paymentList Refunds for PaymentB

List all refunds created for a specific Razorpay payment.

Inputs: payment_id (required), skip, count.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    TDQS

    B3.3/5.0

    Scored across 17 tools

    Disambiguation5/5

    Each tool pairs a distinct verb with a distinct Razorpay resource (order, payment, refund, customer, subscription, payment link), so no two tools overlap in purpose. Edge cases like fetch_refund versus list_refunds_for_payment are clearly separated by identifier requirements and singular/plural semantics in the descriptions.

    Naming Consistency5/5

    All 17 tools follow a strict snake_case verb_noun pattern (fetch_order, create_refund, cancel_subscription, deactivate_payment_link). The one outlier, list_refunds_for_payment, still conforms to the same verb_noun convention with a clarifying resource qualifier.

    Tool Count4/5

    17 tools spanning six resources is reasonable for a payments API, with roughly three operations per resource. It is slightly on the heavy side of the ideal band, but no tool appears redundant or filler.

    Completeness3/5

    Core flows (create/fetch/list orders, capture payments, refund, subscriptions, payment links) are covered, but read coverage is uneven: customers, subscriptions, and payment links have no list or update operations, and there is no fetch/list of all refunds or any customer deletion. Agents can work around these via IDs they already hold, but discovery-style workflows will hit dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to interact with Juspay's payment processing APIs and merchant dashboard for managing orders, transactions, refunds, customers, gateways, and reporting through natural language.
      22
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables interaction with Razorpay payment gateway through natural language, allowing users to fetch payments, manage orders, issue refunds, and list settlements.
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables conversational AI agents to manage Razorpay payments directly, including payment lookups, order creation, refunds, UPI QR generation, and real-time webhook triage via the Model Context Protocol.
      -