Skip to main content
Glama
grzegorzkowalskigk-jpg

mcp-ledger-server

Księga jako narzędzia — serwer MCP dla agentów AI

Serwer Model Context Protocol, który wystawia system księgowy (kolejkę faktur, kontrolę duplikatów, rejestr VAT, historię kontrahentów i dziennik decyzji) jako narzędzia dla dowolnego agenta AI — Claude Code, inspektora MCP czy skryptu testowego.

Czym jest MCP, po ludzku

MCP to „USB dla agentów": jeden standard wtyczki między modelem a systemami firmy. Zamiast pisać integrację szytą na miarę pod każdą parę „agent ↔ system", system wystawia narzędzia raz — a korzysta z nich każdy klient mówiący protokołem. Ten projekt pokazuje to w praktyce: te same narzędzia księgi obsługują sesję Claude Code i automatyczny harness testowy.

Related MCP server: Cronhaus Inbox MCP Server

Narzędzia (7)

Narzędzie

Rola

queue_pending

kolejka niezaksięgowanych faktur

invoice_get

pełne dane dokumentu (nagłówek, strony, pozycje, sumy)

verify_totals

deterministyczna kontrola rachunkowa (grosze, per pozycja)

ledger_check

czy numer został już zaksięgowany (duplikaty)

contractor_history

dominujący format numeracji i granica kwot odstających

vat_registry

status podatnika (mock białej listy) + suma kontrolna NIP

book_invoice

decyzja auto/eskalacja z uzasadnieniem w dzienniku audytowym

Najciekawszy wynik: 9/10 → 10/10 → 40/40

Agent (Claude) przetwarzał 60 faktur z wstrzykniętymi wadami (7 typów — korpus i klucz odpowiedzi wspólne z projektem zespołu agentów n8n):

Partia

Wynik

Co się wydarzyło

inv_001–010

9/10

agent policzył arytmetykę „w głowie" i pomylił się o 90 zł — przepuścił wadę na inv_008

agent sam zaproponował narzędzie verify_totals; arytmetyka przeszła z modelu do deterministycznego kodu

inv_011–020

10/10

w tym wada stawki VAT wykryta poglądem na dane (8% i 23% na identycznym towarze)

inv_021–060

40/40

komplet: duplikaty, zły NIP, niezarejestrowany podatnik, obcy format numeru, kwoty odstające

Bilans: 59/60 trafnych decyzji, a jedyny błąd pochodzi sprzed narzędzia i dokładnie z tej klasy, którą narzędzie wyeliminowało. Lekcja projektu: model ma wnioskować i decydować — liczyć ma narzędzie. Dziennik decyzji z całego przebiegu: data/ledger-demo-60.db (tabela decisions).

Uruchomienie

npm install
npm run build-ledger   # księga SQLite z korpusu (60 faktur + rejestr VAT)
npm test               # harness MCP: 16 asercji wg klucza odpowiedzi

Podłączenie do Claude Code: repo zawiera .mcp.json — wystarczy otworzyć katalog i zatwierdzić serwer ledger. Serwer przy starcie sam zasila pustą księgę (stdio, node:sqlite — zero natywnych zależności).

Struktura

src/server.ts          # serwer MCP: 7 narzędzi na stdio
src/verify.ts          # kontrola rachunkowa (grosze, per pozycja) — wspólna dla MCP i CLI
scripts/build-ledger.ts# budowa księgi z korpusu
scripts/verify-totals.ts# to samo co narzędzie MCP, z linii poleceń
test/harness.ts        # skryptowy klient MCP: 16 asercji wg klucza
data/answer_key.json   # korpus 60 faktur z kluczem odpowiedzi
data/ledger-demo-60.db # dziennik 60 decyzji agenta z sesji demo (59/60)

Available Tools

1 tool
vat_registryRejestr VATB

Status kontrahenta w rejestrze podatników VAT (mock białej listy) + kontrola sumy kontrolnej NIP.

ParametersJSON Schema
NameRequiredDescriptionDefault
nipYes

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must fully convey behavioral traits. It only states basic actions (check status, validate checksum) but omits details such as whether the operation is read-only, if it makes any external calls, or any side effects. The term 'mock' suggests it's a simulation, but this is not explicitly explained.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise, consisting of a single sentence that efficiently communicates the tool's core functionality. No unnecessary words or verbose phrasing detract from its clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has one parameter and no output schema. While the description covers the operation, it fails to specify the output format or return values, which are essential for a complete understanding. The agent is left guessing what the response contains, making the description incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema provides no descriptions for the 'nip' parameter (0% coverage). The description adds minimal semantic value by mentioning NIP checksum control, implying the parameter is validated. However, it lacks format details, examples, or constraints that would fully compensate for the schema gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: checking the VAT status of a contractor ('Status kontrahenta w rejestrze podatników VAT') and validating the NIP checksum ('kontrola sumy kontrolnej NIP'). This provides a specific verb and resource, and despite the lack of sibling tools, the purpose is unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No usage guidelines are provided. The description does not indicate when to use this tool versus alternatives, nor does it mention prerequisites or exclusions. This leaves the agent without context on appropriate usage scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 1 tool updatev1.0.0
    • First observedvat_registry

TDQS

A3.6/5.0

Scored across 1 tool

Disambiguation5/5

Only one tool exists, so there is no possibility of confusion between tools. The single tool has a clear, distinct purpose.

Naming Consistency5/5

With a single tool, naming consistency is not an issue. The name 'vat_registry' follows a clear noun form, which is acceptable.

Tool Count3/5

One tool is on the low end for a server, but it serves a narrow, specific purpose (VAT registry check). It is borderline but not extreme given the focused functionality.

Completeness5/5

The single tool adequately covers the intended domain: checking contractor status in the VAT taxpayer registry and validating NIP checksum. No obvious gaps exist for the stated purpose.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

  • AI-native ERP MCP: ES/EU fiscal compliance (VeriFactu/TicketBAI/Facturae), invoicing, tax, banking

  • Invoicing you drive by talking to your AI: log time, raise invoices and track what's owed via MCP.

  • Documents 1.4.2: five focused MCP tools. analyze_receipt extracts caller-supplied receipt text or checks supported fields (0.25 USDC). match_invoice allocates invoice quantities against a purchase order, including split lines and remaining quantities (0.50 USDC). reconcile_purchase_documents is the free choice for discrepancies across supplied receipt, invoice and PO fields; missing documents remain needs_review and split links are flagged rather than allocated. Neither comparison requires the other. Consolidated example and status tools are free. Paid calls require buyer-authorized x402 on Base. Human review required; no image OCR, stored-analysis retrieval, delivery certification, payment approval or accounting writes. Service-specific cache and payment-metadata terms are disclosed through status. Runtime utilities: https://agents.getardaro.com/mcp/utilities . Legacy /mcp remains compatible. Guide: https://agents.getardaro.com/document-review

  • Agentic rails for complex workflows with receipts, fees, and MCP tool access.

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Audit infrastructure for AI agents to log consequential decisions (invoice, GL, anomaly) and verify attestations via MCP tools.
    6
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI-powered invoice analysis and reasoning: given invoice fields, it detects missing data, inconsistencies, duplicates, and proposes actions (register, request data, mark duplicate, review) using deterministic rules.
    -
  • F
    license
    A
    quality
    B
    maintenance
    Enables AI agents to create accounts, record balanced double-entry transactions, query balances, and reconcile accounts against a SQLite-backed ledger through four MCP tools.
    4
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables AI agents to parse and analyze PDF invoices, including text, field, and table extraction, OCR for scanned documents, ZUGFeRD support, compliance validation, and batch processing via MCP.
    -