expense-tracker-mcp-server
MCP server for tracking personal expenses using FastMCP and SQLite, enabling adding, listing, updating, deleting expenses and summarizing by category via natural language tools.
README
ExpenseTracker FastMCP server
Lightweight MCP server for tracking personal expenses using FastMCP and SQLite. This repo provides a small, local MCP server you can run on your machine for quick experiments, demos, or as the basis for a remote deployment.
<img width="2544" height="1389" alt="Screenshot 2025-11-06 002756" src="https://github.com/user-attachments/assets/94ff4d44-2f7b-4953-a6d0-d6360f32f125" />
What this is -
- A minimal MCP server exposing a few tools to record and query expenses.
- Stores data in a local SQLite database:
expenses.db(created automatically). - Ships a JSON resource
expense://categoriesbacked bycategories.json.
Main features
- add_expense(date, amount, category, subcategory, note)
- list_expenses(start_date, end_date)
- update_expense(expense_id, ...)
- delete_expense(expense_id)
- summarize(start_date, end_date, category=None)
- categories resource (JSON)
Quick start (Windows - cmd.exe)
- Create a virtual environment and activate it (Windows
cmd.exe):
First of all install uv if you don't have it already globally using:
pip install uv
Then create and activate a virtual environment:
python -m venv .venv
.venv\Scripts\activate
- Install dependencies. If you use
pipdirectly, at minimum install FastMCP. If your project uses a lockfile orpyproject.toml, prefer that.
pip install fastmcp
# or, if you maintain requirements.txt:
pip install -r requirements.txt
Optional: if you're using the uv helper CLI (used in some FastMCP guides), you can add FastMCP via the uv CLI instead of pip. Only run the following if you already have the uv tool installed:
uv add fastmcp
- Run the server in development mode (opens FastMCP studio if available):
uv run fastmcp dev main.py
- Run the server for normal usage:
uv run fastmcp run main.py
Notes
- Database:
expenses.dbwill be created next tomain.pyon first run. - Edit
categories.jsonto customize categories; the MCPcategoriesresource reads it fresh on each call.
Testing with FastMCP Studio / Claude Desktop
You can test and inspect the MCP server locally either using the FastMCP studio (dev mode) or by adding the server to Claude Desktop.
- Run FastMCP studio (dev mode)
uv run fastmcp dev main.py
This runs the server in development mode and opens FastMCP's studio/inspector (if available) so you can call tools interactively.
- Add the server to Claude Desktop (optional)
If you want Claude Desktop to manage and talk to your MCP server, install the Claude Desktop helper using the FastMCP/uv helper (only if you have the uv helper installed):
uv run fastmcp install claude-desktop main.py
Important notes when using Claude Desktop:
- After changing the server code, fully restart Claude Desktop so it reloads the MCP server. That means quitting the app completely (exit from the system tray / taskbar) and then reopening it.
- If Claude Desktop fails to load your MCP server, edit the Claude Desktop MCP config: open Claude Desktop, go to Settings → Developer → Edit config. You'll see a JSON like this:
{
"mcpServers": {
"ExpenseTracker": {
"command": "C:\\Users\\Sayoun Parui\\AppData\\Roaming\\Python\\Python313\\Scripts\\uv.exe", # here if u see only uv
"args": [
"run",
"--with",
"fastmcp",
"fastmcp",
"run",
"C:\\Users\\Sayoun Parui\\Desktop\\ExpenceTracker MCP Server\\main.py"
],
"env": {},
"transport": "stdio",
"type": null,
"cwd": null,
"timeout": null,
"description": null,
"icon": null,
"authentication": null
}
},
"preferences": {
"menuBarEnabled": false,
"legacyQuickEntryEnabled": false
}
}
- If the
commandvalue just showsuv(or a short name) you should replace it with the full path to theuvexecutable. To find the full path, open a Windowscmd.exeand run:
where uv
Copy the full path returned (for example C:\Users\You\AppData\Roaming\Python\Python313\Scripts\uv.exe) and paste it into the command field in the Claude config, replacing the short uv value. Save the config and restart Claude Desktop.
If where uv returns multiple results, pick the one that points to your desired Python environment (global or the one where you installed uv).
Tools / API (what you can call)
- add_expense(date: str, amount: float, category: str, subcategory: str = "", note: str = "") -> {status, id}
- list_expenses(start_date: str, end_date: str) -> list of expense objects
- update_expense(expense_id: int, date, amount, category, subcategory, note) -> {status}
- delete_expense(expense_id: int) -> {status}
- summarize(start_date: str, end_date: str, category: Optional[str]) -> [{category, total_amount}]
- Resource:
expense://categories— returnscategories.jsoncontent (mime_type: application/json)
Example call (pseudo):
# with FastMCP client or via the studio, call the `add_expense` tool:
result = mcp.call('add_expense', date='2025-10-01', amount=12.50, category='food', subcategory='snacks', note='coffee')
Project layout
main.py— MCP server implementation and tool definitions.categories.json— default categories/subcategories used by the resource.expenses.db— SQLite DB (auto-created).
Deployment & next steps
This project is intentionally small so it's easy to convert to a remote service. Ideas for production-ready deployments:
- Move the DB to Postgres or another managed DB (RDS, Cloud SQL).
- Containerize the app and deploy to ECS, EKS, GKE, or App Services.
- Add authentication to MCP endpoints and secure the server behind a gateway.
Short-term suggestions:
- Add basic schema migration tooling (alembic/sqlalchemy or a simple migration script).
- Add input validation and richer date handling (ISO 8601 enforcement).
- Add unit tests for the tool functions.
Contributing
Small contributions welcome. Suggested workflow:
- Fork the repo
- Create a feature branch
- Open a PR with a short description of changes
Please keep changes small and focused. If you plan a large refactor (DB change, API redesign), open an issue first.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。