Expense Tracker MCP Server
A lightweight local MCP server for tracking personal or small-team expenses. It lets you add expense entries, list transactions within a date range, and generate simple summaries by category — all backed by a local SQLite database.
README
Expense Tracker MCP Server
A lightweight local MCP (Model Context Protocol) server for tracking personal or small-team expenses. It lets you add expense entries, list transactions within a date range, and generate simple summaries by category — all backed by a local SQLite database.
This project is designed for simple, local-first expense management and easy integration with MCP-compatible clients. It also exposes a structured expense category resource so clients can present consistent category options without hardcoding them.
Features
- Add expenses with a date, amount, category, optional subcategory, and note
- List expenses within an inclusive date range
- Summarize spending by category across a date range
- Local SQLite storage for fast, simple persistence
- Category resource served from
categories.json - Easy customization by editing the category file without restarting the server
How it works
The server is built with Python and FastMCP.
When the app starts, it initializes a local SQLite database file called expenses.db and ensures the expenses table exists. The main entry point in main.py registers MCP tools for inserting expenses, fetching expense rows in a date range, and summarizing totals grouped by category. It also registers an MCP resource at expense://categories, which reads directly from categories.json each time it is requested.
Because the data is stored locally and the category resource is file-based, the project stays simple, portable, and easy to modify.
Tech Stack
- Language: Python 3.11+
- Runtime / Framework: FastMCP
- Database: SQLite
- Core library:
fastmcp
Project Structure
main.py MCP server entry point and expense tools
categories.json Category and subcategory taxonomy
expenses.db Local SQLite database file
pyproject.toml Project metadata and dependency definition
Installation
Make sure you have Python 3.11 or later installed.
Clone the repository and install dependencies:
pip install fastmcp
If you are using a virtual environment, activate it first.
Running the server
Start the MCP server with:
python main.py
This will launch the FastMCP server and initialize the local database if it does not already exist.
Available MCP Tools
add_expense(date, amount, category, subcategory="", note="")
Adds a new expense record to the database.
Example:
{
"date": "2026-07-14",
"amount": 24.5,
"category": "food",
"subcategory": "dining_out",
"note": "Lunch"
}
list_expenses(start_date, end_date)
Returns all expense entries within the inclusive date range, ordered by record ID.
Example:
{
"start_date": "2026-07-01",
"end_date": "2026-07-31"
}
summarize(start_date, end_date, category=None)
Returns total spending grouped by category for the given date range. If category is provided, the summary is filtered to that category.
Example:
{
"start_date": "2026-07-01",
"end_date": "2026-07-31",
"category": "food"
}
Available Resource
expense://categories
Returns the category taxonomy defined in categories.json as JSON.
This file includes high-level categories such as:
- food
- transport
- housing
- utilities
- health
- education
- family_kids
- entertainment
- shopping
- subscriptions
- personal_care
- gifts_donations
- finance_fees
- business
- travel
- home
- pet
- taxes
- investments
- misc
Each category includes a set of subcategories for more specific expense classification.
Category File
You can customize the available categories by editing categories.json.
Because the resource reads the file fresh every time it is accessed, you do not need to restart the server after changing categories.
Example Usage
A typical flow looks like this:
- Start the MCP server
- Add expense entries with
add_expense - Query records with
list_expenses - Generate spending insights with
summarize - Use
expense://categoriesto drive category selection in a client
Notes
- Expenses are stored in a local SQLite database file named
expenses.db - Dates are expected to be passed in a consistent text format, such as
YYYY-MM-DD - The project is intentionally minimal and may be extended with validation, editing, deletion, authentication, or richer reporting in the future
Getting Started
If you are building an MCP-compatible expense assistant, this server is a compact starting point that you can run locally and extend as needed.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。