expense-tracker
Expense Tracker MCP Server
一个轻量级的本地 MCP(Model Context Protocol)服务器,让你可以直接通过 Claude 记录、列出、汇总和删除个人开支——无需应用,无需手动录入电子表格,只需自然对话即可。
基于 FastMCP 构建,并由本地 SQLite 数据库提供支持。
为什么
大多数开支追踪应用都很笨重:操作步骤太多、分类僵化,或者仅仅为了记录一杯咖啡就要付费订阅。这个服务器将 Claude 变成你的开支追踪器——你只需告诉它你花了什么,它就会保存下来。随时要求汇总,即可按分类获得即时明细。
Related MCP server: Expense Tracker MCP Server
功能特性
添加开支,包含日期、分类、金额、子分类和备注
列出开支,支持按日期范围筛选
按分类汇总支出(可选筛选到单个分类)
按 ID 删除开支
数据存储在本地单个 SQLite 文件中——完全私密,无云同步
环境要求
Python 3.10+
安装依赖:
pip install fastmcp设置
将服务器脚本(例如
expense_server.py)保存到机器上的某个固定位置。首次运行时,它会自动在同一目录下创建
expenses.db——无需手动设置数据库。将其添加到你的 Claude Desktop 配置文件中:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{ "mcpServers": { "expense-tracker": { "command": "python", "args": ["/full/absolute/path/to/expense_server.py"] } } }使用脚本的绝对路径。如果你使用的是虚拟环境,请将
command指向该环境的 Python 可执行文件,而不是系统自带的python。重启 Claude Desktop。下面列出的四个工具应该会显示为可用状态。
工具
工具 | 描述 | 参数 |
| 添加新开支 |
|
| 列出指定日期范围内的开支 |
|
| 按分类统计指定日期范围内的支出总额 |
|
| 按 ID 删除开支 |
|
日期应使用 YYYY-MM-DD 格式。
使用示例
服务器连接后,只需自然地与 Claude 对话即可:
"今天记录 450 元买菜,子分类为蔬菜"
"我昨天花了 1200 元房租,备注:八月房租"
"显示我这个月的所有支出"
"2026 年 8 月我的分类明细是什么?"
"8 月 1 日到 8 月 15 日我在食物上花了多少钱?"
"删除第 12 条开支,我重复录入了"
数据存储
所有数据都存储在 expenses.db 中,这是一个在脚本旁边创建的 SQLite 文件。数据不会发送到任何其他地方——完全本地化和私密。
表结构:
expenses
├── id INTEGER PRIMARY KEY AUTOINCREMENT
├── date TEXT NOT NULL
├── category TEXT NOT NULL
├── amount REAL NOT NULL
├── subcategory TEXT DEFAULT ''
└── note TEXT DEFAULT ''备份数据
由于所有数据都保存在一个文件中,请定期备份:
cp expenses.db "expenses_backup_$(date +%Y%m%d).db"可以考虑使用每周的 cron 定时任务(macOS/Linux)或任务计划程序(Windows)来自动化此操作。
备注与提示
分类名称不受限制,因此请尽量保持大小写和拼写一致(例如始终使用 "Groceries",不要混用 "groceries" / "Grocery"),以保持汇总结果整洁。
如果你想避免重复,可以在添加新分类之前让 Claude 列出你现有的分类。
此服务器没有身份验证或网络暴露——它仅通过 stdio 在本地运行,因此无需额外安全设置即可安全使用。
许可证
个人使用——可自由调整以适应你自己的工作流程。
This server cannot be deployed
Maintenance
Related MCP Connectors
Track expenses from your AI chat: log, categorize, monthly CSV reports. All data is local.
Expense ledger for AI assistants: record receipts line by line, ask what you spent, export anytime.
Log, query, and edit expenses, budgets, and accounts in Manilo from any MCP-compatible AI assistant.
Personal finance: log expenses in plain language, track accounts, budgets and spending
Related MCP Servers
- FlicenseCqualityDmaintenanceEnables personal expense management with SQLite storage, allowing users to add, update, delete, list, and summarize expenses by category through natural language interactions.5-
- FlicenseBqualityDmaintenanceEnables natural language expense management with SQLite storage, allowing users to add expenses, view totals, and list all expenses through conversational commands.3-
- FlicenseNot gradedqualityDmaintenanceEnables management of expenses via SQLite database, including adding, listing, updating, deleting, filtering, and summing expenses through natural language.-
- FlicenseNot gradedqualityDmaintenanceEnables natural language management of personal expenses, including adding, listing, and summarizing expenses with local SQLite storage.-