mcp-ledger-server-ts
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| MCP_HOST | No | Host to bind when using the HTTP transport. | 127.0.0.1 |
| MCP_PORT | No | Port to bind when using the HTTP transport. | 3333 |
| LEDGER_ACTOR | No | Recorded as `decidedBy` on decisions. | mcp-agent |
| LEDGER_AS_OF | No | Pin the evaluation date (YYYY-MM-DD) for reproducible demos. | today |
| MCP_TRANSPORT | No | Transport selection: `stdio` or `http`. | stdio |
| LEDGER_API_URL | No | REST base URL for the backend. Required when LEDGER_BACKEND=http. | |
| LEDGER_BACKEND | No | Backend selection: `memory` (seeded, standalone) or `http` (REST backend). | memory |
| LEDGER_API_TOKEN | No | Optional bearer token for the REST backend. | |
| LEDGER_DEFAULT_CURRENCY | No | Used when the backend omits a currency. | EUR |
| LEDGER_QTY_TOLERANCE_PCT | No | Quantity tolerance as a fraction. | 0.02 |
| LEDGER_PRICE_TOLERANCE_PCT | No | Price tolerance as a fraction. | 0.02 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
Accounts-payable invoice ledger. Typical flow: list_invoices -> match_invoice_to_po -> route_exception. Always run match_invoice_to_po before routing. Never use override unless a human explicitly instructs it. Amounts are integers in minor units (cents) alongside a formatted string.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| list_invoicesA | List invoices in the accounts-payable ledger, optionally filtered by status or vendor. Returns compact summaries (id, vendor, PO, total, dates, status), sorted by id. Use this first to discover invoice ids. Read-only. |
| get_invoiceA | Fetch one invoice with its line items (sku, quantity, unit price in minor units) and any routing decision already recorded. Read-only. Errors with NOT_FOUND if the id is unknown. |
| match_invoice_to_poA | Run a three-way match of an invoice against its purchase order and goods receipts. Checks vendor, currency, duplicates, dates, per-line quantity (vs ordered and received, net of already-approved invoices) and unit price, using tolerance rules. Returns an outcome (matched / matched_within_tolerance / exception), the list of findings with severity, and a recommended routing action and reason code. Read-only: it never changes the ledger. Call this before route_exception. |
| route_exceptionA | Record a routing decision for an invoice: approve, hold or reject, with a reason code. The server re-runs the match itself and enforces policy: approving an invoice with blocking findings is refused unless reasonCode=MANUAL_OVERRIDE, override=true and a note of 10+ chars (and duplicates can never be approved); reject needs a blocking finding with the same reason code; approved/rejected invoices are final. Idempotent: repeating the identical decision returns changed=false. Prefer "hold" when unsure, it is reversible. Changes the ledger. |
| ledger_summaryA | Portfolio overview of the ledger: invoice counts and totals per status and currency, how many open (received or on_hold) invoices are past their due date, the oldest open invoice, and a tally of recorded decision reasons. Read-only. Use for "how are we doing" questions. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 5 tools
Each tool maps to a distinct resource+action pair: enumerate (list_invoices), inspect one (get_invoice), evaluate (match_invoice_to_po), mutate (route_exception), and aggregate (ledger_summary). Descriptions explicitly state read-only vs ledger-changing and even give sequencing guidance (match before route), leaving little room for misselection.
Four of five names follow a clean verb_noun snake_case pattern (list_invoices, get_invoice, match_invoice_to_po, route_exception). ledger_summary is a noun-only outlier, but it is readable and clearly the odd one out by design.
Five tools cover a tight AP-exception workflow with no redundancy: discover, inspect, evaluate, decide, report. Each tool earns its place and there are no thin filler operations.
The read-and-decide lifecycle is closed: invoices can be listed, fetched, matched, routed, and summarized, with routing outcomes reflected back in get_invoice. Gaps exist on the ingestion side (no create/import invoice, no PO or goods-receipt listing), which an agent must assume is handled elsewhere.