Expense Tracker MCP

Expense Tracker MCP

Enables logging, querying, and summarizing personal expenses via natural language, with tools for adding, listing, and aggregating spending by category.

Category
访问服务器

README

Expense Tracker MCP

A personal expense tracking server built with FastMCP that exposes tools and resources via the Model Context Protocol (MCP). Connect it to any MCP-compatible AI client (Claude Desktop, Cursor, etc.) to log, query, and summarize your spending through natural language.

Features

  • Add expenses — record date, amount, category, optional subcategory, and a free-text note
  • List expenses — retrieve all entries within any date range
  • Summarize spending — aggregate totals by category, optionally filtered to a single category
  • Category reference — a live-reloadable resource (expense://categories) exposes all valid categories and subcategories so the AI always suggests valid values

Tech Stack

Component Technology
MCP framework FastMCP ≥ 3.1
Database SQLite (file-based, zero config)
Runtime Python ≥ 3.12

Project Structure

expense-tracker-mcp/
├── main.py            # MCP server — tools & resource definitions
├── categories.json    # Category / subcategory taxonomy (editable at runtime)
├── expenses.db        # SQLite database (auto-created on first run)
├── pyproject.toml     # Project metadata & dependencies
└── README.md

Getting Started

1. Clone and install dependencies

git clone <repo-url>
cd expense-tracker-mcp

uv sync

2. Run the server

uv run python main.py

The server starts and listens for MCP connections. The expenses.db SQLite file is created automatically next to main.py on the first run.

3. Connect to an MCP client

Claude Desktop

Add the following block to your claude_desktop_config.json:

{
  "mcpServers": {
    "expense-tracker": {
      "command": "uv",
      "args": ["run", "--directory", "/absolute/path/to/expense-tracker-mcp", "python", "main.py"]
    }
  }
}

Cursor / other clients

Follow your client's MCP configuration guide, pointing the command at the same Python executable and main.py.

MCP Tools

add_expense

Add a new expense entry.

Parameter Type Required Description
date string Yes ISO 8601 date, e.g. 2026-03-09
amount number Yes Expense amount (positive value)
category string Yes Top-level category (see categories below)
subcategory string No Subcategory within the category
note string No Free-text description

Returns: { "status": "ok", "id": <inserted row id> }


list_expenses

Retrieve all expenses within a date range (inclusive).

Parameter Type Required Description
start_date string Yes ISO 8601 start date
end_date string Yes ISO 8601 end date

Returns: Array of expense objects with fields id, date, amount, category, subcategory, note.


summarize

Aggregate total spending by category within a date range.

Parameter Type Required Description
start_date string Yes ISO 8601 start date
end_date string Yes ISO 8601 end date
category string No Filter to a single category

Returns: Array of { "category": "...", "total_amount": <number> } objects, ordered alphabetically.

MCP Resource

expense://categories

Returns the full categories.json file as application/json. The file is read from disk on every request, so you can add or rename categories without restarting the server. The AI uses this resource to suggest valid category and subcategory values when logging expenses.

Categories

The taxonomy ships with 18 top-level categories:

Category Example Subcategories
food groceries, dining_out, delivery_fees
transport fuel, public_transport, cab_ride_hailing
housing rent, repairs_service, furnishing
utilities electricity, internet_broadband, mobile_phone
health medicines, doctor_consultation, fitness_gym
education books, courses, online_subscriptions
family_kids school_fees, daycare, toys_games
entertainment movies_events, streaming_subscriptions, games_apps
shopping clothing, electronics_gadgets, home_decor
subscriptions saas_tools, cloud_ai, music_video
personal_care salon_spa, grooming, cosmetics
gifts_donations gifts_personal, charity_donation, festivals
finance_fees bank_charges, interest, brokerage
business hosting_domains, marketing_ads, contractor_payments
travel flights, hotels, visa_passport
home household_supplies, cleaning_supplies, small_repairs
pet food, vet, grooming
taxes income_tax, gst, filing_fees

Every category also accepts "other" as a catch-all subcategory. Edit categories.json freely to add your own.

Example Prompts

Once connected to an AI client:

Add an expense: ₹450 on groceries today
List all my expenses for February 2026
Summarize my spending between 2026-01-01 and 2026-03-09
How much did I spend on food and transport this month?

Development

Inspect with MCP Inspector

FastMCP 3.x ships with an interactive inspector. Launch it with:

uv run fastmcp dev inspector main.py

This opens the MCP Inspector UI in your browser so you can call tools and browse resources interactively without a full AI client.

Reset the database

The schema is initialised automatically via init_db() on first run. To wipe all data:

rm expenses.db

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选