npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

phonepe-mcp

v0.1.1

Published

Unofficial Model Context Protocol server for PhonePe Payments API

Readme

phonepe-mcp

Unofficial Model Context Protocol server for the PhonePe Payment Gateway (Standard Checkout v2).

Lets an MCP-capable AI client (Claude Desktop, Claude Code, etc.) create payments, check order status, issue refunds, check refund status, and verify webhook signatures against PhonePe's sandbox or production environments.

Not affiliated with PhonePe. Use at your own risk. Always test against the sandbox first.

Tools

| Tool | What it does | | --- | --- | | create_payment | Creates a Standard Checkout v2 payment and returns a redirectUrl for the customer. Amount is in paisa (₹1 = 100). | | get_order_status | Fetches status (PENDING / COMPLETED / FAILED) for a merchantOrderId. | | initiate_refund | Starts an asynchronous refund against a completed order. | | get_refund_status | Polls refund status by merchantRefundId. | | verify_webhook_signature | Verifies an incoming PhonePe webhook by comparing SHA256(username:password) to the Authorization header (timing-safe). |

OAuth tokens are fetched, cached, and refreshed automatically — there is no exposed auth tool.

Install

npm install
npm run build

Requires Node.js ≥ 18 (uses native fetch).

Configure

Copy .env.example and fill it in:

cp .env.example .env

| Variable | Required | Notes | | --- | --- | --- | | PHONEPE_CLIENT_ID | yes | From the PhonePe Business merchant dashboard. | | PHONEPE_CLIENT_SECRET | yes | From the merchant dashboard. | | PHONEPE_CLIENT_VERSION | yes | Usually 1. From the merchant dashboard. | | PHONEPE_ENV | no | sandbox (default) or production. | | PHONEPE_WEBHOOK_USERNAME | only for webhook verification | Username configured for webhook delivery. | | PHONEPE_WEBHOOK_PASSWORD | only for webhook verification | Password configured for webhook delivery. |

The environment is fixed at server start — there is no per-tool environment toggle. To switch between sandbox and production, restart the server with a different PHONEPE_ENV.

Run

npm run dev    # tsx watch mode (development)
npm start      # node dist/server.js (after npm run build)

The server speaks MCP over stdio.

Connect to Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "phonepe": {
      "command": "node",
      "args": ["/absolute/path/to/phonepe-mcp/dist/server.js"],
      "env": {
        "PHONEPE_CLIENT_ID": "your-client-id",
        "PHONEPE_CLIENT_SECRET": "your-client-secret",
        "PHONEPE_CLIENT_VERSION": "1",
        "PHONEPE_ENV": "sandbox"
      }
    }
  }
}

Then restart Claude Desktop. The tools above will be available in any conversation.

Debug with MCP Inspector

PHONEPE_CLIENT_ID=... PHONEPE_CLIENT_SECRET=... PHONEPE_CLIENT_VERSION=1 \
  npx @modelcontextprotocol/inspector tsx src/server.ts

Test

npm test

Unit tests cover webhook signature verification and token-cache behavior with a mocked fetch — no live PhonePe calls are made.

API references

License

MIT