expense-tracker-mcp-server

expense-tracker-mcp-server

Enables natural language expense tracking and management via Claude Desktop, supporting adding, listing, summarizing, updating, and deleting expenses with flexible date parsing and category filtering.

Category
访问服务器

README

Expense Tracker MCP Server

A powerful Model Context Protocol (MCP) server for tracking and managing personal expenses. This server integrates with Claude Desktop to provide seamless expense management through natural language interactions.

Features

🛠️ Tools

  • add_expense: Add new expenses with flexible date parsing (supports "today", "yesterday", "Nov 27, 2025", etc.)
  • list_expenses: List expenses with filtering by category, date range, and natural language date queries
  • summarize_expenses: Get expense summaries by category with totals and percentages
  • update_expense: Modify existing expense records
  • delete_expense: Remove expense records by ID

📋 Resources

  • expense://categories: Access predefined expense categories and subcategories from categories.json

✨ Key Capabilities

  • Natural Language Date Support: Use phrases like "last week", "last month", "this year", "last 30 days"
  • SQLite Database: Lightweight and efficient local storage
  • Category Management: Pre-defined categories with subcategories for better organization
  • Flexible Filtering: Filter expenses by date range, category, or specific criteria
  • Rich Summaries: View spending patterns with category-wise breakdowns and percentages

Installation

Prerequisites

  • Python 3.8 or higher
  • uv package manager (recommended)
  • Claude Desktop

Steps

  1. Clone the repository

    git clone <your-repo-url>
    cd Expense-Tracker-MCP-Server
    
  2. Install dependencies

    Using uv (recommended):

    uv pip install -r requirements.txt
    

    Or using pip:

    pip install -r requirements.txt
    
  3. Install to Claude Desktop

    uv run fastmcp install claude-desktop main.py
    

    Or manually add to your Claude Desktop config (~/.config/Claude/claude_desktop_config.json on Mac/Linux or %APPDATA%\Claude\claude_desktop_config.json on Windows):

    {
      "mcpServers": {
        "Expense Tracker Server": {
          "command": "uv",
          "args": [
            "run",
            "--with",
            "fastmcp",
            "fastmcp",
            "run",
            "/absolute/path/to/Expense-Tracker-MCP-Server/main.py"
          ]
        }
      }
    }
    
  4. Restart Claude Desktop

    Completely quit and restart Claude Desktop to load the MCP server.

Usage

Once installed, you can interact with the Expense Tracker directly in Claude Desktop using natural language:

Adding Expenses

"Add an expense of $45.50 for groceries yesterday"
"I spent $20 on lunch today in the Food category"
"Add expense: $100, Transport, Fuel, Nov 25, 2025, note: Monthly fuel"

Listing Expenses

"Show me all expenses from last week"
"List my Food expenses from this month"
"Show expenses from last 30 days"

Summarizing Expenses

"Summarize my expenses for last month"
"Show category-wise breakdown for this year"
"Summarize Food expenses from last week"

Updating Expenses

"Update expense ID 5, change amount to $55.50"
"Change expense 3's category to Transport"

Deleting Expenses

"Delete expense with ID 7"

Database Schema

The server uses SQLite with the following schema:

CREATE TABLE expenses (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    date TEXT NOT NULL,
    amount REAL NOT NULL,
    category TEXT NOT NULL,
    subcategory TEXT,
    note TEXT
);

Categories

The server includes predefined categories in categories.json:

  • Food (groceries, dining out, coffee, snacks, etc.)
  • Transport (fuel, public transport, cab, parking, etc.)
  • Housing (rent, maintenance, repairs, etc.)
  • Utilities (electricity, water, internet, mobile, etc.)
  • Health (medicines, doctor, insurance, fitness, etc.)
  • Education (books, courses, online subscriptions, etc.)
  • Entertainment (movies, streaming, games, etc.)
  • Shopping (clothing, electronics, accessories, etc.)
  • And many more...

You can customize categories by editing categories.json.

Development

Running Locally

uv run fastmcp dev main.py

Project Structure

Expense-Tracker-MCP-Server/
├── main.py                 # Main MCP server code
├── categories.json         # Expense categories and subcategories
├── requirements.txt        # Python dependencies
├── pyproject.toml         # Project metadata
├── expenses.db            # SQLite database (auto-created)
└── README.md              # This file

Requirements

  • fastmcp>=2.0.0 - FastMCP framework for building MCP servers
  • python-dateutil>=2.8.0 - Flexible date parsing

Troubleshooting

Server not showing in Claude Desktop

  1. Ensure Claude Desktop is completely quit (not just closed)
  2. Check the config file has correct absolute paths
  3. Verify the command path to uv is correct
  4. Restart Claude Desktop

Database issues

The expenses.db file is created automatically in the project directory. If you encounter issues:

  • Delete expenses.db and restart the server
  • Check file permissions

Date parsing errors

The server supports various date formats. If you encounter parsing errors:

  • Use ISO format: "YYYY-MM-DD" (e.g., "2025-11-27")
  • Use common formats: "Nov 27, 2025", "27th November 2025"
  • Use relative dates: "today", "yesterday", "last week"

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - feel free to use this project for personal or commercial purposes.

Author

Created with FastMCP and Claude

Acknowledgments

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选