Skip to main content
Glama

SW RDC — Revenue Data Connector (@schema-weaver/rdc)

SW RDC (Revenue Data Connector) — Read-only, zero-storage revenue data connector and MCP engine for Razorpay, Stripe, Cashfree, and billing APIs.

v1 implements Razorpay as the first provider. The catalog, executor, auth, redaction, and telemetry layers are provider-agnostic so additional revenue sources can be added without changing the MCP/CLI surface.

Repository: https://github.com/Schema-Weaver/sw-rdc

Placement: This is an independent package/repository, like Schema Weaver's sw-agent, pg-ddl-parser, and migration-engine. It can be consumed in-process by the backend, run as a hosted MCP server, or published as an npm/CLI package. OAuth token storage, encryption, and Supabase persistence stay in the Schema Weaver SaaS backend; nothing in src/ imports a database, .env, or Express.


Exact repository metadata

Field

Value

Repository name

sw-rdc

Description

Revenue Data Connector (SW RDC) — Read-only, zero-storage revenue data connector and MCP engine for Razorpay, Stripe, Cashfree, and billing APIs.

Display name

SW RDC

Subtitle

Revenue Data Connector

npm package

@schema-weaver/rdc

CLI binary

sw-rdc


Related MCP server: xendit-mcp

Install & Requirements

npm install @schema-weaver/rdc
  • Node.js >= 18 (uses built-in fetch, AbortController, and URL)

  • ESM (import), CJS (require), and .d.ts type declarations included

  • Runtime dependencies: @modelcontextprotocol/sdk, zod

From a source checkout:

cd sw-rdc
npm install
npm run typecheck
npm test
npm run build

npm test currently runs 75 tests across 9 files; npm run build emits ESM, CJS, source maps, and declarations into dist/.


Quick Start

1. Programmatic execution

import { executeRazorpayTool } from '@schema-weaver/rdc';

const result = await executeRazorpayTool({
  toolName: 'fetch_all_payments',
  args: { from: 'last_7_days', count: 25, status: 'captured' },
  auth: {
    type: 'oauth',                         // Razorpay Partner OAuth token
    accessToken: decryptedAccessToken,
    accountId: connectionId,
    // Optional: called at most once on HTTP 401
    onTokenExpired: async () => refreshAndPersistToken(connectionId),
  },
  caller: 'resona_ai',
  onExecutionEvent: async (span) => auditSink.write(span),
});

console.log(result.items, result.meta);

Standalone API-key auth also works:

auth: {
  type: 'api_key',
  keyId: process.env.RAZORPAY_KEY_ID!,
  keySecret: process.env.RAZORPAY_KEY_SECRET!,
}

2. Reusable connector

import { createRazorpayConnector } from '@schema-weaver/rdc';

const payments = createRazorpayConnector({ auth, caller: 'dashboard_gen' });
const tools = payments.listTools();            // 33 Razorpay v1 tool metadata objects
const result = await payments.execute('fetch_payment', { payment_id: 'pay_ABC123' });

3. MCP server (stdio)

import { runMcpStdioServer } from '@schema-weaver/rdc/mcp';

await runMcpStdioServer({
  // Called once per tools/call: ideal for hosted multi-tenant deployments.
  auth: async () => loadTenantAuthFromRequestContext(),
});

4. CLI

# Print the read-only catalog
sw-rdc list-tools

# Run one tool
RAZORPAY_KEY_ID=rzp_test_xxx RAZORPAY_KEY_SECRET=yyy \
  sw-rdc call fetch_all_payments '{"count":5,"status":"captured"}'

# Start a stdio MCP server for an MCP client
sw-rdc serve --access-token "$RAZORPAY_ACCESS_TOKEN"

What Is Included

  • 33 read-only Razorpay tools — 32 fetch_* REST lookups plus summarize_razorpay_resource. No capture, refund creation, updates, or any other mutating tool exists.

  • Provider-ready architecture — v1 ships Razorpay; the registry and result envelope are designed for Stripe, Cashfree, and billing APIs.

  • Dynamic auth per execution — OAuth Bearer with a single 401 refresh retry, or API-key Basic auth for standalone/npm use. Credentials are never logged.

  • Zero-retention analytics — the summarizer streams pages through a Map accumulator, drops each page immediately, and returns only buckets/totals. maxPages defaults to 20 and is hard-capped at 50.

  • Pagination that respects Razorpay — count/skip, Unix-second windows, relative presets, deep-skip window bisection by timestamp cursor, settlement-recon day iteration, and 429 exponential backoff with jitter honoring Retry-After.

  • PII-safe by default — emails/contacts become *_masked companions; card tokens, fingerprints, full card numbers, bank accounts, OTPs, and secret-looking fields are stripped. includeUnmaskedPii: true is a trusted server-only opt-out for email/contact only.

  • Integer minor units — raw amounts stay in minor units (paise for INR); amount_major/sum:amount_major companions are added for display. Currency-specific exponents (JPY, KWD, BHD, …) are supported.

  • Audit spans in finally — every success, validation failure, auth failure, and rate limit emits a sanitized ConnectorExecutionSpan via onExecutionEvent. A broken logger never breaks a query.

  • Strict allow-listed inputs — Zod strict schemas reject unknown keys and raw URLs; paths are fixed in the catalog with an SSRF/traversal guard in the HTTP client.

Result envelope

{
  ok: true,
  provider: 'razorpay',
  tool: 'fetch_all_payments',
  count: 5,
  hasMore: true,
  nextSkip: 5,
  currencyDefault: 'INR',
  amountUnit: 'minor (paise: divide by 100 for INR)',
  items: [ /* sanitized records */ ],
  meta: {
    apiCalls: 1,
    scannedCount: 5,
    appliedWindow: { from: 1760774400, to: 1760860799 },
    appliedPeriod: null,
    warnings: [],
  },
}

Errors are ConnectorError instances with stable codes such as INVALID_ARGS, AUTH_EXPIRED, PERMISSION, NOT_FOUND, RATE_LIMITED, UPSTREAM_ERROR, NETWORK_ERROR, ABORTED, and UNSUPPORTED; toJSON() is safe to return to a caller.


Streaming Analytics Example

await executeRazorpayTool({
  toolName: 'summarize_razorpay_resource',
  args: {
    resource: 'payments',
    from: 'last_30_days',
    group_by: ['method', 'status'],
    time_bucket: 'day',
    metrics: ['count', 'sum:amount', 'avg:amount', 'max:amount', 'sum:fee'],
    where: { currency: 'INR' },
    maxPages: 20,
  },
  auth,
});

Returns grouped buckets plus meta.totals, meta.scannedCount, meta.matchedCount, meta.truncated, and the applied window. Use resource: 'settlement_recon' with year/month (and optional day) for reconciliation reports.


Documentation


Attribution

Tool naming and query semantics follow Razorpay's MIT-licensed razorpay-mcp-server. This package is an independent TypeScript implementation for Schema Weaver and is not affiliated with or endorsed by Razorpay. See LICENSE.

Available Tools

33 tools
fetch_all_customersFetch all customersA
Read-onlyIdempotent

List Razorpay customers. Email and contact are masked by default as email_masked/contact_masked. Read-only Razorpay API call.

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

fetch_all_disputesFetch all disputesA
Read-onlyIdempotent

List Razorpay disputes with time and pagination filters. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

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

fetch_all_instant_settlementsFetch all instant settlementsA
Read-onlyIdempotent

List Razorpay instant settlements, optionally expanding payout details. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

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

fetch_all_invoicesFetch all invoicesA
Read-onlyIdempotent

List Razorpay invoices with payment, customer, subscription, and type filters. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

Inputs: to, from, skip, type, +5 more.

fetch_all_ordersFetch all ordersA
Read-onlyIdempotent

List Razorpay orders with time, pagination, authorization, receipt, and expand filters. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

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

fetch_all_paymentsFetch all paymentsA
Read-onlyIdempotent

List Razorpay payments with time, pagination, status, method, and expand filters. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

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

fetch_all_payoutsFetch all payoutsA
Read-onlyIdempotent

List RazorpayX payouts for a bank account number. If RazorpayX is not enabled on the merchant account, Razorpay returns an upstream error that is surfaced cleanly. Read-only Razorpay API call.

Inputs: account_number (required), to, from, skip, +1 more.

fetch_all_plansFetch all plansA
Read-onlyIdempotent

List Razorpay subscription plans. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

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

fetch_all_qr_codesFetch all QR codesA
Read-onlyIdempotent

List Razorpay QR codes with time and pagination filters. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

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

fetch_all_refundsFetch all refundsA
Read-onlyIdempotent

List Razorpay refunds with time and pagination filters. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

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

fetch_all_settlementsFetch all settlementsA
Read-onlyIdempotent

List Razorpay settlements with time and pagination filters. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

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

fetch_all_subscriptionsFetch all subscriptionsB
Read-onlyIdempotent

List Razorpay subscriptions with optional plan filter. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

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

fetch_customerFetch customerA
Read-onlyIdempotent

Retrieve one Razorpay customer. Email and contact are masked by default. Read-only Razorpay API call.

Inputs: customer_id (required).

fetch_disputeFetch disputeA
Read-onlyIdempotent

Retrieve one Razorpay dispute by id. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

Inputs: dispute_id (required), expand.

fetch_instant_settlement_with_idFetch instant settlementA
Read-onlyIdempotent

Retrieve one Razorpay instant settlement by id. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

Inputs: settlement_id (required).

fetch_invoiceFetch invoiceA
Read-onlyIdempotent

Retrieve one Razorpay invoice by id. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

Inputs: invoice_id (required).

fetch_multiple_refunds_for_paymentFetch multiple refunds for a paymentA
Read-onlyIdempotent

List refunds created for one payment. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

Inputs: payment_id (required), to, from, skip, +1 more.

fetch_orderFetch orderA
Read-onlyIdempotent

Retrieve one Razorpay order by id. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

Inputs: order_id (required), expand.

fetch_order_paymentsFetch order paymentsA
Read-onlyIdempotent

List all payments made for one Razorpay order. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

Inputs: order_id (required).

fetch_paymentFetch paymentA
Read-onlyIdempotent

Retrieve one Razorpay payment by id. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

Inputs: payment_id (required), expand.

fetch_payment_card_detailsFetch payment card detailsA
Read-onlyIdempotent

Retrieve safe card metadata for a card payment. Card tokens, fingerprints, and full card numbers are always stripped. Read-only Razorpay API call.

Inputs: payment_id (required).

fetch_payments_for_qr_codeFetch payments for QR codeA
Read-onlyIdempotent

List payments made on one Razorpay QR code. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

Inputs: qr_code_id (required), to, from, skip, +1 more.

fetch_payout_by_idFetch payoutA
Read-onlyIdempotent

Retrieve one RazorpayX payout by id. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

Inputs: payout_id (required).

fetch_planFetch planA
Read-onlyIdempotent

Retrieve one Razorpay subscription plan by id. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

Inputs: plan_id (required).

fetch_qr_codeFetch QR codeA
Read-onlyIdempotent

Retrieve one Razorpay QR code by id. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

Inputs: qr_code_id (required).

fetch_refundFetch refundA
Read-onlyIdempotent

Retrieve one Razorpay refund by id. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

Inputs: refund_id (required).

fetch_settlement_recon_detailsFetch settlement reconciliation detailsB
Read-onlyIdempotent

Fetch Razorpay combined settlement reconciliation records for a year/month/day. This endpoint supports count up to 1000. Read-only Razorpay API call.

Inputs: year (required), month (required), day, skip, +1 more.

fetch_settlement_with_idFetch settlementA
Read-onlyIdempotent

Retrieve one Razorpay settlement by id. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

Inputs: settlement_id (required).

fetch_specific_refund_for_paymentFetch specific refund for paymentA
Read-onlyIdempotent

Retrieve one refund belonging to a specific payment. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

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

fetch_subscriptionFetch subscriptionA
Read-onlyIdempotent

Retrieve one Razorpay subscription by id. Read-only Razorpay API call. Amounts remain in minor units (paise for INR).

Inputs: subscription_id (required).

summarize_razorpay_resourceSummarize Razorpay resourceA
Read-onlyIdempotent

Stream Razorpay pages, aggregate them in memory, and return grouped counts/sums/min/max without storing or returning raw transaction rows. Supports payments, orders, refunds, settlements, settlement reconciliation, subscriptions, invoices, disputes, and customers.

Inputs: resource (required), to, day, from, +9 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 33 tools

    Disambiguation3/5

    Most tools target distinct Razorpay resources, but several refund/payment/settlement tools overlap in practice: fetch_refund, fetch_all_refunds, fetch_multiple_refunds_for_payment, and fetch_specific_refund_for_payment are easy to confuse. Descriptions generally clarify the differences, but an agent must carefully choose between general and scoped list/get variants.

    Naming Consistency3/5

    All names are snake_case and use a fetch_ prefix, but the patterns vary: fetch_all_X, fetch_X, fetch_Xs_for_Y, fetch_X_with_id, and fetch_X_by_id. The conventions are readable but not fully predictable, especially across list/get and scoped-list tools.

    Tool Count3/5

    The 33 tools cover many Razorpay resources, so the breadth is somewhat justified, but the surface is heavy and includes numerous paired list/get and scoped-list endpoints. It is broader than a typical well-scoped tool set and could likely be consolidated without losing coverage.

    Completeness4/5

    The surface provides broad read-only coverage across payments, orders, refunds, settlements, payouts, subscriptions, invoices, disputes, customers, QR codes, and payment links. Minor read gaps exist, but the main lifecycle for a read-only Razorpay connector is well covered.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      C
      maintenance
      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.
      -
    • A
      license
      A
      quality
      D
      maintenance
      A read-only MCP server for securely accessing Xendit payment platform data. It enables querying balances, invoices, transactions, disbursements, refunds, and virtual account payments while preventing any money-moving operations.
      13
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Read-only Stripe finance, ops, and risk reporting exposed via MCP, HTTP API, and CLI. Enables querying balances, payments, customers, payouts, reconciliation, and risk alerts without mutating Stripe state.
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      A read-only MCP server that collects contract and bank-statement evidence, splits incoming platform payments per merchant, and generates explainable claiming candidates written into a fixed 13-column local template for human review. All operations are strictly read-only (no logins, uploads, imports, or reconciliation writes), and it exposes blockers with provenance evidence instead of guessing.
      5
      MIT