ledger-mcp
ledger-mcp
一个小型 MCP 服务器,将复式记账账本作为工具暴露给 AI 代理。 作为一次为期两天的练习而构建,涉及 MCP 服务器设计、代理工具人机工程学以及评估驱动的迭代。
状态: 第 1 天已完成。第 2 天(评估框架 + 发现)进行中。
包含内容
ledger.py— 复式记账核心,由 SQLite 支持。金额以整数分存储。强制交易平衡和命名账户完整性。server.py— MCP 服务器,暴露四个工具:create_account、record_transaction、get_balance、reconcile。test_ledger.py— 针对账本核心的 pytest 测试套件。NOTES.md— 设计决策和观察的运行日志,源自针对 Claude Desktop 运行服务器。
Related MCP server: ledgerkit-mcp
本地运行
uv sync
uv run pytest -v # run the ledger tests
uv run mcp dev server.py # launch with the MCP Inspector要与 Claude Desktop 一起使用,请添加到 claude_desktop_config.json:
{
"mcpServers": {
"ledger": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/ledger-mcp", "run", "mcp", "run", "server.py"]
}
}
}第 2 天计划
评估框架,衡量代理在这些工具上成功和失败的地方
发现报告:命名与文档、静默账户创建、工具作为护栏与工具作为执行者
Available Tools
4 toolscreate_accountB
Create a new account in the ledger.
account_type must be one of: asset, liability, equity, revenue, expense.
Inputs: name (required), account_type (required).
get_balanceB
Get the balance of an account, in cents.
Inputs: account_name (required).
reconcileA
Check that total debits equal total credits across the ledger.
Inputs: no named parameters.
record_transactionC
Record a transaction in the ledger.
entries is a list of dicts with keys: account, amount_cents, side.
Debits must equal credits.
Inputs: entries (required), transaction_id (required), memo.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool targets a distinct action—account creation, transaction recording, balance retrieval, and reconciliation—with no overlapping responsibilities. The purposes are clearly separated, leaving no ambiguity for an agent to misselect.
Most tool names follow the verb_noun pattern (create_account, record_transaction, get_balance), but 'reconcile' is a single verb without a noun object. This minor deviation is not confusing but breaks the otherwise consistent pattern.
Four tools is well-scoped for a focused ledger server, covering the essential operations of account creation, transaction recording, balance queries, and reconciliation. Each tool earns its place without redundancy.
The core workflow (create account, record transaction, get balance, reconcile) is present, but notable gaps exist: there is no way to list accounts or view transaction history, and no update/delete operations for accounts or transactions. These missing read/audit functions could hinder some workflows.
Maintenance
Related MCP Connectors
Personal finance for AI agents — onboard, import statements, categorize & budget over MCP.
Personal finance ledger for AI agents — query spending, track bills, forecast cash flow.
AI agents for bookkeeping, reconciliation, and financial close for SMBs.
Agent-native double-entry accounting ledger with x402 micropayments
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceDouble-entry accounting ledger MCP server for autonomous agents that enables creating accounts, posting journal entries, and generating financial reports.MIT
- AlicenseAqualityDmaintenanceEnables AI agents to interact with a double-entry ledger, offering tools for account management, balanced journal entries, balance queries, trial balance, and penny-perfect allocation. Built with safety by construction: no update/delete tools, idempotent posting, and an append-only journal.7MIT
- AlicenseNot gradedqualityDmaintenanceProvides financial audit reporting and ledger query tools for AI agents, enabling generation of compliance, risk, and transaction reports and querying of transaction data, balances, and summaries from an in-memory SQLite database via MCP.MIT
- FlicenseAqualityDmaintenanceMCP server for hledger that exposes double-entry accounting tools to AI agents, enabling balance queries, transaction history, budget reports, and adding transactions to a journal.4-