mcp-ledger-server
Exposes a ledger system (invoice queue, duplicate control, VAT register, contractor history, decision journal) as MCP tools for AI agents, enabling accurate invoice processing with deterministic validation.
README
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.
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)
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.