closeloop-mcp
v0.2.1MCP server for month-end reconciliation of Razorpay-style gateway settlements against the bank statement and the ledger.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
run_reconciliation Run reconciliation
Reconcile payments, gateway settlements, the bank statement and the ledger for a period, as of its end date. Returns matched counts by kind (exact UTR, fuzzy UTR, batch), exceptions by type with totals, exposure per class (never summed), and the bank-vs-books tie-out. Dates are YYYY-MM-DD; both default to the dataset's full period. Creates a new run that later tools use.
| Parameter | Type | Description |
|---|---|---|
from | string | First day to report, YYYY-MM-DD |
to | Last day, also the as-of date, YYYY-MM-DD |
list_exceptions List exceptions
List exceptions from the latest reconciliation run, largest amount first, optionally filtered by type, exposure class, minimum amount (paise) or status. Paginated: default 20 per page; pass next_cursor to continue. Each item includes amount_inr and a one-line description; the response includes the count and total for the whole filtered set.
| Parameter | Type | Description |
|---|---|---|
cursor | string | |
exposure_class | string | |
limit | integer | |
min_amount_paise | integer | Integer paise, e.g. 1000000 = ₹10,000.00 |
status | string | |
type | string |
get_evidence Get evidence
All records involved in one exception (payments, settlements, bank lines, ledger entries), the deterministic rule that fired with its trace, batch candidate sets with their totals, linked matches, deferred settlements and the exception's audit history. Read-only.
| Parameter | Type | Description |
|---|---|---|
exception_id * | string |
explain_exception Explain exception
Root cause, explanation, confidence, cited evidence ids and a recommended action for one exception, generated from its read-only evidence. Uses the configured LLM when available and falls back to a deterministic template otherwise; `source` says which. Never changes any match or financial record.
| Parameter | Type | Description |
|---|---|---|
exception_id * | string |
decompose_bank_credit Decompose bank credit
Show how one bank credit breaks down into gateway settlements in the latest run: the matched settlement set with its total and difference, or, if ambiguous or conflicting, every ranked candidate set with totals. Contiguous decompositions state their payout-model assumption. Read-only.
| Parameter | Type | Description |
|---|---|---|
bank_line_id * | string |
import_razorpay_recon Import Razorpay settlement recon
Load Razorpay's settlement recon report (the documented /v1/settlements/recon/combined format; the same data Razorpay's own MCP server returns from fetch_settlement_recon_details) so batched bank credits are matched from the gateway's item-level rows (match kind BATCH_FROM_GATEWAY_REPORT) instead of amount-only subset search, and each settlement's payments and refunds are linked from the report. Pass file_path for a JSON or CSV export (CSV headers are the API field names; amounts in paise), or from/to (YYYY-MM-DD) to fetch it from the Razorpay API, which needs CLOSELOOP_RAZORPAY_KEY_ID and CLO…
| Parameter | Type | Description |
|---|---|---|
file_path | string | Path to a .json or .csv recon export; ~ is expanded |
from | string | Fetch from the Razorpay API: first settlement day, YYYY-MM-DD |
to | Fetch from the Razorpay API: last settlement day, YYYY-MM-DD |
draft_journal_entry Draft journal entry
Propose a correcting journal entry for one exception (e.g. booking missing gateway fee + GST, reversing a duplicate receipt). Always a DRAFT with status pending_approval; nothing is posted to the ledger. Debits and credits are pre-totalled and always balance to the engine's amount.
| Parameter | Type | Description |
|---|---|---|
exception_id * | string |
approve_suggestion Approve suggestion (human action)
Human approval of a SUGGESTED_MATCH (choose candidate_index, default 0) or of one candidate set of an AMBIGUOUS_BATCH / MATCH_CONFLICT (choose set_index). Two steps: call without confirm_token to get a preview and a confirm_token valid for 5 minutes; show the preview to the user; only after they agree, call again with the same id, confirm_token and reviewer (their name). Records a human-approved link and an audit event; never modifies payments, settlements, bank lines or ledger entries.
| Parameter | Type | Description |
|---|---|---|
id * | string | Exception id |
candidate_index | integer | |
confirm_token | string | |
reviewer | string | Name of the person approving; required with confirm_token |
set_index | integer |
escalate Escalate exception (human action)
Escalate an open exception to someone else with a note (e.g. 'raised with Razorpay support, ticket 123'). Two steps: call with id and note to get a preview and a confirm_token valid for 5 minutes; after the user agrees, call again with id, confirm_token and reviewer. Writes an audit event; never modifies financial records.
| Parameter | Type | Description |
|---|---|---|
id * | string | Exception id |
confirm_token | string | |
note | string | Required for the preview step |
reviewer | string | Name of the person escalating; required with confirm_token |
get_audit_trail Get audit trail
Append-only audit events (runs, investigations, journal drafts, approvals, escalations) with actor system/llm/human, oldest first. Optionally filter by entity id (an exception, run, bank line or draft id). Paginated: default 20 per page with next_cursor. Read-only.
| Parameter | Type | Description |
|---|---|---|
cursor | string | |
entity_id | string | |
limit | integer |