Skip to main content
Glama
Expense Tracker MCP Server

Expense Tracker MCP Server

by simran-mehta

费用追踪 MCP 服务器

一个 MCP(模型上下文协议)服务器,允许 Claude 等 AI 助手使用本地 SQLite 数据库管理个人费用——包括添加、分类、汇总和预算。


概述

该服务器提供了一组 MCP 工具,Claude(或任何兼容 MCP 的客户端)可以调用这些工具来追踪您的支出。所有数据都存储在本地的 SQLite 文件中——无需云端,无需账户。


Related MCP server: ExpenseTracker MCP Server

功能

  • 添加并管理带有类别、金额、日期和描述的费用

  • 按日期范围或类别筛选并列出费用

  • 按类别或月份汇总支出

  • 设置各类别预算并查看剩余余额

  • 将费用导出为 CSV

  • 完全本地化——数据保留在您的机器上


MCP 工具

工具

描述

关键参数

add_expense

记录一笔新费用

amount, category, description, date, currency

list_expenses

列出费用(可选筛选器)

category?, start_date?, end_date?, limit?

get_expense_summary

按类别或月份分组的汇总总额

group_by (category 或 month), start_date?, end_date?

update_expense

按 ID 编辑现有费用

id, amount?, category?, description?, date?

delete_expense

按 ID 删除费用

id

set_budget

为类别设置月度预算限额

category, monthly_limit, currency?

get_budget_status

比较预算限额与实际支出

month? (默认为当前月份)

export_expenses

将费用导出为 CSV 字符串

start_date?, end_date?, category?


项目结构

expense-tracker-mcp-server/
├── main.py             # MCP server entry point (all tools)
├── expenses.db         # SQLite database (auto-created on first run)
├── pyproject.toml      # Project metadata and dependencies
├── .venv/              # Virtual environment (created by uv)
└── readme.md

先决条件

  • Python 3.11+

  • uv (推荐) 或 pip

  • Claude Desktop (用于连接 MCP 服务器)


安装

# Clone the repo
git clone https://github.com/your-username/expense-tracker-mcp-server.git
cd expense-tracker-mcp-server

# Initialize the project and install dependencies
uv init
uv add fastmcp

这会在项目目录内自动创建一个 .venv 文件夹。


运行服务器

fastmcp run main.py

服务器启动并通过 stdio 监听 MCP 连接。SQLite 数据库 (expenses.db) 会在首次运行时自动创建。


连接到 Claude Desktop

将以下内容添加到您的 Claude Desktop 配置文件中:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "expense-tracker": {
      "command": "uv",
      "args": [
        "--directory",
        "C:\\Learning\\Expense-Tracker-MCP-Server",
        "run",
        "fastmcp",
        "run",
        "main.py"
      ]
    }
  }
}

完全退出 Claude Desktop(系统托盘 → 退出)并重新打开。您应该会在工具面板中看到可用的费用追踪工具。


示例提示词

连接到 Claude 后,您可以说:

  • "今天在 Whole Foods 花了 45 美元买杂货"

  • "显示我本月所有的食品支出"

  • "我上个月在哪方面花费最多?"

  • "设置 300 美元的餐饮月度预算"

  • "我的娱乐预算还剩多少?"

  • "将我三月份的所有费用导出为 CSV"


开发

# Run with MCP inspector for debugging
fastmcp dev inspector main.py

许可证

MIT

Available Tools

8 tools
add_expenseB

Add a new expense. Date format: YYYY-MM-DD (defaults to today).

Inputs: amount (required), category (required), description, date, +1 more. Returns: object

delete_expenseB

Delete an expense by ID.

Inputs: id (required). Returns: object

export_expensesC

Export expenses as a CSV string.

Inputs: start_date, end_date, category. Returns: result

get_budget_statusB

Compare budget limits vs actual spend. Month format: YYYY-MM (defaults to current month).

Inputs: month. Returns: result

get_expense_summaryB

Summarize total spending grouped by 'category' or 'month'.

Inputs: group_by, start_date, end_date. Returns: result

list_expensesB

List expenses with optional filters. Date format: YYYY-MM-DD.

Inputs: category, start_date, end_date, limit. Returns: result

set_budgetC

Set or update the monthly budget limit for a category.

Inputs: category (required), monthly_limit (required), currency. Returns: object

update_expenseC

Update fields of an existing expense by ID.

Inputs: id (required), amount, category, description, +1 more. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no overlap: adding, deleting, updating, listing, summarizing, exporting expenses, and managing budgets. The descriptions specify unique actions (e.g., add vs. update) and resources (expenses vs. budget), eliminating ambiguity.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern (e.g., add_expense, delete_expense, get_budget_status). The naming is uniform across all eight tools, using snake_case and clear action verbs aligned with their functions.

    Tool Count5/5

    With 8 tools, the server is well-scoped for an expense tracker, covering core operations like CRUD for expenses, budget management, summarization, and export. Each tool earns its place without being excessive or sparse.

    Completeness5/5

    The tool set provides complete coverage for the expense tracking domain: full CRUD for expenses (add, delete, update, list), budget management (set and status), summarization, and export. There are no obvious gaps, enabling agents to handle typical workflows end-to-end.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to manage personal expenses through natural conversation, supporting expense tracking, categorization, filtering, and financial summaries. Uses SQLite database to store expense records with full CRUD operations for comprehensive personal finance management.
      2
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to manage personal expenses by adding, querying, and summarizing expense data through a SQLite database and configurable categories.
      1
      GPL 3.0
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables natural language management of personal expenses, including adding, listing, and summarizing expenses with local SQLite storage.
      -