Skip to main content
Glama

payments-ops-mcp

An MCP server that lets an AI agent do a payments ops analyst's morning: reconcile the ledger against the PSP and the bank, triage chargebacks, and check refunds against policy.

Setup takes minutes, not an IT project. Share your PSP contract and the exports you already download; the agent reads them, the code checks them, you confirm, and the review is ready.

No tool moves money or submits anything. The agent finds problems, explains them and drafts responses; a person approves every action.

Why I built this

Most "AI for payments" demos stop at a chatbot that answers FAQs. The expensive work in payments operations is elsewhere: the payout that arrived $12.50 short, the order captured twice, the fee charged above contract, the chargeback due in two days that nobody has looked at.

That work is a good fit for agents because it is rules plus judgment, spread across three systems that don't agree. It is also a bad place to let an agent act on its own. So this server is designed the way I'd ship it in production: the agent gets broad read access, writes only to its own setup files after a person confirms, and every recommendation says who has to approve it.

Related MCP server: fincon

How it works

  Your PSP contract ─┐                        ┌─ reconcile_payments
  Shop orders CSV  ──┤                        ├─ explain_reconciliation_break
  PSP export CSV   ──┼─► onboarding tools ──► workspace ──► analysis tools ─┼─ list_open_disputes / triage_dispute
  Bank CAMT.053    ──┤   (you confirm)         (local)       (read-only)      ├─ draft_evidence_pack
  Disputes CSV     ──┘                                                      └─ check_refund_policy

Claude reads, code checks, a person confirms, the server stores. The model is good at reading a contract or guessing which column is which. Code is good at checking that 2.9% is plausible and that a quoted clause really exists. People are good at saying yes. Each does only its part.

Tools

Analysis (read-only)

Tool

What the agent gets

reconcile_payments

Three-way reconciliation: ledger to PSP captures, then PSP payouts to bank deposits. Fees checked against the contract version in force on each date. Match rate, value in breaks, every break with an id.

explain_reconciliation_break

Likely causes and next steps for one break, plus any open dispute on the same order.

list_open_disputes

Chargebacks needing a response, most urgent first.

triage_dispute

Reason code, evidence on file, win likelihood, cost if lost (including the contract's chargeback fee), and a fight / review / accept recommendation.

draft_evidence_pack

A plain-text evidence pack and draft response for a person to review.

check_refund_policy

Whether a refund is allowed and who must approve it. Never issues the refund.

Onboarding (writes only to the local workspace)

Tool

What it does

list_data_sources

What is loaded: sample or workspace mode, row counts, date ranges, contract versions, what is still missing.

propose_contract_terms

Validates terms the agent extracted from a contract and checks each quoted clause really appears in the document and contains the number. Stages a proposal; saves nothing.

save_contract_terms

Saves a confirmed proposal as a new contract version with an effective date. Refuses unless confirmed=true.

list_contract_versions

Contract versions on file.

preview_import

Detects CSV or CAMT.053, suggests a column mapping, shows normalised sample rows and errors.

save_mapping_profile

Remembers how an export's columns map, so the next file imports with no mapping step.

import_transactions

Imports a file into the workspace. Re-importing the same file is safe.

Prompts: onboard_my_payments_data (guided setup) and daily_payments_ops_review (morning review). Resource: payments://reason-codes.

Break types it detects

missing_at_psp · missing_in_ledger · amount_mismatch · duplicate_capture · fee_mismatch · settlement_mismatch · missing_settlement

Payouts that are not due yet under the contract's payout delay show as in_transit, not as breaks.

Onboarding your own data

  1. Contract. Share your PSP pricing schedule and say "set this up as my fee terms". The agent extracts the percentage and fixed fee, international surcharge, chargeback fee, payout delay and reserve, each with the clause it came from. You see every value with a check: verified, quote_not_found or number_not_in_quote. Implausible values (a 29% fee, a fee written as 0.029) are rejected outright. Amendments become new versions, so February's transactions are checked against February's prices.

  2. Exports. Give it your orders export, PSP transaction report, bank statement and disputes export. For a new CSV layout the agent shows the mapping it suggests and a few normalised rows; once you agree, the mapping is saved and every later file of that layout imports in one step. Common status words (paid, charge, succeeded) are translated automatically, and PSP payout or refund rows are skipped. CAMT.053 bank statements need no mapping at all.

  3. Run. "Run my daily payments ops review."

See docs/onboarding.md for a real run on the files in examples/onboarding/: a fictional pricing schedule with an amendment, a Stripe-style balance report, a shop orders export with day-first dates, a disputes export and a CAMT.053 statement.

Where data lives

The workspace is ~/.payments-ops-mcp, or PAYMENTS_OPS_DATA_DIR if set. Until it holds transaction data the tools run on the bundled sample data. Once it does, only the workspace is used, and files not yet imported count as empty, so real and sample data are never mixed.

Design choices

  • No money moves. Analysis tools carry readOnlyHint. Setup tools write only to the local workspace. Refund checks return executes_refund: false; dispute triage returns requires_human_decision: true.

  • Extraction is checked, not trusted. Every contract value needs a verbatim quote, and the server confirms the quote exists in the document and contains the number before the person is asked to confirm.

  • Terms are versioned. Contracts change. Each version has an effective date, and every fee check names the version it used.

  • Money in minor units. Amounts are integers internally and formatted once on the way out, so the model never does float arithmetic on money.

  • Connected findings. A duplicate capture found in reconciliation links to the duplicate-processing chargeback on the same order. That is the kind of connection a tired analyst misses.

  • Deterministic logic, model for language. Matching, fee checks and policy rules are plain code with tests. The model reads documents, explains, prioritises and drafts.

Quick start

git clone <this repo> && cd payments-ops-mcp
pip install -e ".[dev]"
pytest

Use it in Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "payments-ops": {
      "command": "payments-ops-mcp"
    }
  }
}

Use it in Claude Code

claude mcp add payments-ops -- payments-ops-mcp

Then ask: "Run my daily payments ops review as of 2026-11-05", or "Set up payments-ops with my own data" to start onboarding.

Add the skill

skills/payments-ops/SKILL.md teaches an agent when and how to use these tools: the morning review, chargebacks, refund checks and onboarding, plus the rules it must keep (never claim money moved, use amounts exactly as returned, confirm before saving). For Claude Code, copy the folder into ~/.claude/skills/ (or .claude/skills/ in a project). tests/test_skill.py fails if the skill ever names a tool or field the server doesn't have.

Install the server straight from GitHub if you only want to use it:

pip install git+https://github.com/jana-han/payments-ops-mcp

The sample data

Fictional: one merchant, one PSP, 36 card orders in USD over three days, six open chargebacks. Seven problems are planted on purpose (see scripts/generate_sample_data.py). A run finds all seven:

orders_checked: 36 · fully matched: 32 · match rate: 88.9%
BRK-missing_at_psp-ORD-1007            captured in ledger, no PSP capture
BRK-amount_mismatch-ORD-1012           ledger USD 159.00 vs PSP USD 49.99
BRK-duplicate_capture-ORD-1020         captured twice, USD 159.00 extra
BRK-fee_mismatch-TX-5025               USD 0.54 above contract acmepay-2026-01-01
BRK-missing_in_ledger-TX-5037          PSP money with no order
BRK-settlement_mismatch-PO-20261002    bank deposit USD 12.50 short
BRK-missing_settlement-PO-20261003     payout overdue

To see the review without an MCP client, run python scripts/demo.py review, or python scripts/demo.py contract to watch a misread contract value get caught.

Importing the example exports into an empty workspace reproduces exactly these results; tests/test_onboarding.py checks it. See docs/demo.md for a tool-by-tool morning review.

Limits

  • Single currency and a single PSP. Multi-currency FX and multi-acquirer routing are the obvious next steps.

  • The international card surcharge and rolling reserve are stored but not yet applied, because exports rarely carry card country. Fee checks use the standard rate.

  • Dispute evidence (3-D Secure, delivery proof) is not imported from CSV yet; imported orders triage on the evidence available.

  • Bank statements: CAMT.053 and CSV. MT940 is not supported yet.

  • Reason codes are simplified for triage. Always check current card network rules before responding to a dispute.

  • Win likelihood is a transparent heuristic, not a trained model.

Roadmap

  • Approval-gated actions: an issue_refund tool that asks the person to confirm in the client before anything executes

  • Read-only live connectors (PSP API, bank feed, order database) so no exports are needed

  • An eval set of tricky breaks (partial captures, FX rounding, refunds netted from payouts) so matching changes are measured, not guessed

  • Multi-currency settlement with FX tolerance; MT940 statements; evidence import

License

MIT

Available Tools

13 tools
check_refund_policyA
Read-onlyIdempotent

Check whether a refund is allowed and who must approve it. Does NOT issue the refund.

Args: order_id: e.g. ORD-1004. amount: Refund amount in major units, e.g. 24.99. reason: Why the customer wants a refund. as_of: Date to measure the refund window from, YYYY-MM-DD. Defaults to today.

Returns decision = auto_approve | needs_human_review | reject, with reasons.

Inputs: amount (required), reason (required), order_id (required), as_of. Returns: object

draft_evidence_packA
Read-onlyIdempotent

Draft a plain-text evidence pack for a chargeback, for a person to review and submit.

Args: dispute_id: e.g. DSP-201. as_of: Date to count days left from, YYYY-MM-DD. Defaults to today.

Inputs: dispute_id (required), as_of. Returns: result

explain_reconciliation_breakA
Read-onlyIdempotent

Explain one reconciliation break: what happened, likely causes, next steps and any related open disputes.

Args: break_id: An id from reconcile_payments, e.g. BRK-duplicate_capture-ORD-1020. as_of: Same as_of used for reconcile_payments, if any.

Inputs: break_id (required), as_of. Returns: object

import_transactionsA
Idempotent

Import an export into the workspace. CSV needs a saved mapping profile; CAMT.053 bank statements need none. Rows already imported (same id) are skipped, so re-importing a file is safe.

Args: target: One of orders, psp_transactions, bank_settlements, disputes. profile_name: Saved mapping profile (CSV only). file_path: Path to the file on this computer. Use this or content. content: The file's text, if it was shared in the conversation instead. mode: "append" (default) adds new rows; "replace" swaps out everything for this target. batch_ref_pattern: For CAMT.053, regex to find the payout id in references.

Inputs: target (required), mode, content, file_path, +2 more. Returns: object

list_contract_versionsA
Read-onlyIdempotent

List the contract term versions on file with their effective dates.

Inputs: no named parameters. Returns: result

list_data_sourcesA
Read-onlyIdempotent

Show what data is loaded: sample or workspace mode, row counts, date ranges, contract versions, mapping profiles and which files are not imported yet. Call this first when setting up.

Inputs: no named parameters. Returns: object

list_open_disputesA
Read-onlyIdempotent

List chargebacks that need a response, most urgent first.

Args: as_of: Date to count days left from, YYYY-MM-DD. Defaults to today.

Inputs: as_of. Returns: result

preview_importA
Read-onlyIdempotent

Look at an export before importing it: detects CSV or CAMT.053, suggests a column mapping (or uses a matching saved profile), and shows normalised sample rows and errors.

Args: target: One of orders, psp_transactions, bank_settlements, disputes. file_path: Path to the file on this computer. Use this or content. content: The file's text, if it was shared in the conversation instead. profile_name: A saved mapping profile to test against the file.

Inputs: target (required), content, file_path, profile_name. Returns: object

propose_contract_termsA
Idempotent

Validate contract terms extracted from a PSP contract or pricing schedule and stage them for confirmation.

Nothing is saved yet. Call save_contract_terms after the person confirms.

Args: psp_name: Payment provider name, e.g. "AcmePay". effective_from: Date the terms start, YYYY-MM-DD. card_fee_percent: Percentage fee as a percent, e.g. 2.9 for 2.9% (not 0.029). card_fee_fixed: Fixed fee per transaction in major units, e.g. 0.30. payout_delay_days: Days from capture to payout (e.g. 2 for T+2). currency: ISO currency code of the fees. international_surcharge_percent: Extra percent for international cards, if any. chargeback_fee: Fee per chargeback in major units, if any. reserve_percent: Rolling reserve percent, if any. sources: For each field above, the exact clause text it came from, copied verbatim. document_text: Full text of the contract, so each quote can be checked.

Returns each term with a source check (verified / quote_not_found / number_not_in_quote / no_source), errors that block saving, warnings, changes versus the terms currently on file, and a proposal_id.

Inputs: psp_name (required), card_fee_fixed (required), effective_from (required), card_fee_percent (required), +7 more. Returns: object

reconcile_paymentsA
Read-onlyIdempotent

Three-way reconciliation of the order ledger, PSP captures and bank deposits.

Fees are checked against the contract version in force on each transaction date. Payouts not yet due under the contract's payout delay show as in_transit, not missing.

Args: date_from: First order date to include, YYYY-MM-DD (inclusive). Omit for all. date_to: Last order date to include, YYYY-MM-DD (inclusive). Omit for all. as_of: Date to judge payout lateness from, YYYY-MM-DD. Defaults to today.

Returns a summary (match rate, value in breaks), warnings about missing data, per-payout settlement status, and every break with an id for explain_reconciliation_break.

Inputs: as_of, date_to, date_from. Returns: object

save_contract_termsA
Idempotent

Save proposed contract terms as a new version. Only call after the person has explicitly confirmed them.

Args: proposal_id: The id returned by propose_contract_terms. confirmed: Must be true, meaning the person reviewed and approved the terms.

Inputs: confirmed (required), proposal_id (required). Returns: object

save_mapping_profileA
Idempotent

Save how a CSV layout maps to our fields, so the same export imports with no mapping step next time. Only call after the person agrees with the mapping shown by preview_import.

Args: name: Profile name, e.g. "stripe-balance-report". target: One of orders, psp_transactions, bank_settlements, disputes. columns: Our field -> their column header, e.g. {"psp_ref": "balance_transaction_id"}. amount_unit: "major" if amounts look like 24.99, "minor" if they look like 2499. defaults: Values for fields the file lacks, e.g. {"currency": "USD"}. value_maps: Value translations per field, e.g. {"type": {"charge": "capture"}}. date_format: strptime format if dates are not ISO, e.g. "%d/%m/%Y". batch_ref_pattern: Regex to find the payout id in bank references, e.g. "PO-[0-9]+".

Inputs: name (required), target (required), columns (required), defaults, +4 more. Returns: object

triage_disputeB
Read-onlyIdempotent

Assess one chargeback: reason code, evidence on file, win likelihood and a fight/review/accept recommendation.

Args: dispute_id: e.g. DSP-201. as_of: Date to count days left from, YYYY-MM-DD. Defaults to today.

Inputs: dispute_id (required), as_of. Returns: object

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 13 tools

    Disambiguation5/5

    Each tool targets a distinct resource and action: refund policy, reconciliation, break explanation, disputes, contracts, and import each have clearly separate tools with no functional overlap. Even the potentially confusable pairs (propose_contract_terms vs save_contract_terms, preview_import vs import_transactions) are explicitly staged with descriptions clarifying sequencing. Descriptions proactively prevent misselection (e.g. check_refund_policy 'Does NOT issue the refund').

    Naming Consistency5/5

    Every tool follows a consistent verb_noun snake_case pattern: check_refund_policy, list_contract_versions, explain_reconciliation_break, draft_evidence_pack, save_mapping_profile, import_transactions. There are no camelCase or other convention deviations, and verbs are used consistently for the same class of action (list_*, save_*, propose_*).

    Tool Count5/5

    13 tools fall squarely in the well-scoped range, and each maps to a real operational step (setup, ingest, reconcile, explain, dispute, contract). No redundant or filler tools are present; each earns its place in the payments-ops workflow.

    Completeness4/5

    Coverage is strong across ingestion (preview/save_mapping/import), reconciliation (reconcile + explain), disputes (list/triage/draft), and contract lifecycle (list/propose/save). Minor gaps: there is no refund issuance tool (check_refund_policy explicitly stops short), no dispute submission, and no contract update/delete, but these appear to be intentional human-in-the-loop handoffs that agents can route around.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      An accounting-ops agent that reconciles payments against open orders, auto-books provably safe payments through a deterministic policy gate, and escalates exceptions to a human queue with audit trails.
      MIT
    • F
      license
      B
      quality
      D
      maintenance
      Enables AI assistants to perform financial reconciliation with a deterministic proof engine: intake files, match transactions, verify proofs, resolve exceptions, and sign off on balanced journals under the user's authority.
      21
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to propose structured payment intents, apply deterministic policy, require human approval, and record tamper-evident audit trails without connecting to live payment rails.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables autonomous financial agents to submit payment webhooks, ledger entries, or transaction streams and receive balanced journal records, risk verification dossiers, and detection of card-testing clusters, volume spikes, and account takeovers.
      7
      MIT