CA
OfficialFinance

Cashfree MCP Server: Payments, Payouts, SecureID

Integrate AI tools with Cashfree MCP server to access Payment Gateway, Payouts, and SecureID via the Model Context Protocol (MCP).

Quick Install
npx -y @cashfree/cashfree-mcp

Overview

Cashfree MCP Server exposes Cashfree services (Payment Gateway, Payouts, and SecureID) to AI tools and agents using the Model Context Protocol (MCP). It runs as a local MCP server process and translates MCP tool calls into authenticated Cashfree API requests, enabling AI assistants to initiate payments, manage payouts, and perform identity checks from within an agent workflow.

For developers building conversational agents or tool-enabled assistants, this server removes the friction of wrapping multiple Cashfree APIs manually. It centralizes credential handling, environment switching (sandbox vs production), and optional interactive parameter elicitation so tools can either validate inputs programmatically or ask the user for missing values at runtime.

Features

  • Exposes Payment Gateway (PG), Payouts, and SecureID APIs over MCP
  • Supports sandbox and production environments via ENV variable
  • Configurable tool set: enable only the modules you need (pg, payouts, secureid)
  • Optional interactive elicitation for missing required parameters
  • Two-factor support for payouts (TWO_FA public key path)
  • Small Node.js-based MCP server suitable for local or containerized deployment
  • Ready-made configuration examples for MCP clients (Claude, VS Code)

Installation / Configuration

Prerequisites:

  • Node.js v14.x or higher (Node >= 20.18.1 recommended to avoid peer dependency issues)

Clone and build:

git clone https://github.com/cashfree/cashfree-mcp.git
cd cashfree-mcp
npm install
npm run build

Run the MCP server (example):

# from repository root after build
node dist/index.js

Environment variables (examples):

export ENV="sandbox"                     # "sandbox" or "production"
export TOOLS="pg,payouts,secureid"       # comma-separated modules to enable

# Payment Gateway
export PAYMENTS_APP_ID="your_pg_client_id"
export PAYMENTS_APP_SECRET="your_pg_client_secret"

# Payouts
export PAYOUTS_APP_ID="your_payouts_client_id"
export PAYOUTS_APP_SECRET="your_payouts_client_secret"
export TWO_FA_PUBLIC_KEY_PEM_PATH="/path/to/public_key.pem"   # only if 2FA enabled

# SecureID
export SECUREID_APP_ID="your_secureid_client_id"
export SECUREID_APP_SECRET="your_secureid_client_secret"

# Optional: enable interactive elicitation of missing params
export ELICITATION_ENABLED="true"

MCP client examples (Claude / VS Code) — point the client to run the server process:

Claude (fragment to add to claude_desktop_config.json):

{
  "mcpServers": {
    "cashfree": {
      "command": "node",
      "args": ["/path/to/cashfree-mcp/dist/index.js"],
      "env": {
        "PAYMENTS_APP_ID": "YOUR_PG_CLIENT_ID",
        "PAYMENTS_APP_SECRET": "YOUR_PG_CLIENT_SECRET",
        "PAYOUTS_APP_ID": "YOUR_PAYOUTS_CLIENT_ID",
        "PAYOUTS_APP_SECRET": "YOUR_PAYOUTS_CLIENT_SECRET",
        "TWO_FA_PUBLIC_KEY_PEM_PATH": "/path/to/public_key.pem",
        "SECUREID_APP_ID": "YOUR_SECUREID_CLIENT_ID",
        "SECUREID_APP_SECRET": "YOUR_SECUREID_CLIENT_SECRET",
        "TOOLS": "pg,payouts,secureid",
        "ENV": "sandbox",
        "ELICITATION_ENABLED": "true"
      }
    }
  }
}

VS Code (settings.json fragment):

{
  "mcp": {
    "servers": {
      "cashfree": {
        "command": "node",
        "args": ["/path/to/cashfree-mcp/dist/index.js"],
        "env": { /* same env variables as above */ }
      }
    }
  }
}

Available Tools

Payment Gateway (pg), Payouts (payouts), SecureID (secureid) — enable via TOOLS env var.

Payment Gateway tools (examples):

Tool nameDescription
searchSearch Cashfree Payments developer docs
get-input-source-helpHelp for input source variable errors
create-payment-linkCreate a new payment link
fetch-payment-link-detailsGet payment link details and status
cancel-payment-linkCancel an active payment link
get-orders-for-a-payment-linkList orders for a payment link
create-orderCreate an order to obtain a payment_sessions_id

Payouts and SecureID expose their common API actions (create/verify payouts, identity verification flows). When 2FA is required for payouts, set TWO_FA_PUBLIC_KEY_PEM_PATH.

Use Cases

  • Create a payment link from a chat assistant:

    1. Agent calls create-payment-link with amount, purpose, and customer info.
    2. Server returns a payment URL and link id; assistant shares the URL with user.
  • Collect payment session for a checkout flow:

    1. Agent calls create-order to generate a payment_sessions_id.
    2. Use the returned id to open a hosted checkout or continue a payments integration.
  • Automate vendor payouts:

    1. Agent triggers a payout action (payouts.create).
    2. MCP server signs and routes the payout API call; assistant reports success/failure.
  • Onboard and verify user identity:

    1. Use SecureID flows to request verification documents or checks.
    2. Agent can poll or receive the result via MCP tool responses.

Security & Best Practices

  • Keep credentials out of version control; use environment variables or secrets management.
  • Use sandbox ENV during development and switch to production only after thorough testing.
  • Secure TWO_FA public key files and restrict filesystem permissions.
  • If enabling elicitation, ensure the agent only prompts for sensitive values in a secure UI.

Repository and issues: https://github.com/cashfree/cashfree-mcp

Tags: finance

Tags:finance