Skip to main content
Glama
AdvancedExpenseTracker

AdvancedExpenseTracker

AdvancedExpenseTracker (FastMCP)

An AI-powered Expense & Budget Management MCP Server built using FastMCP, SQLite, and Python.
This project exposes structured financial tools (expenses, income, budgets, recurring bills, analytics) that can be used by an LLM (like Claude Desktop or Cursor) as a personal financial advisor.


πŸš€ Features Overview

  • βœ… Expense Tracking: Categories, subcategories, tags, notes, and payment methods.

  • βœ… Income & Cashflow: Log earnings and analyze net savings in real-time.

  • βœ… Recurring Engine: Auto-generate daily, weekly, monthly, or yearly bills.

  • βœ… Smart Budgeting: Set limits per category and get "Over Budget" warnings.

  • βœ… Search & Filtering: Find transactions by note, tag, or amount.

  • βœ… Metadata Management: Dynamic control over valid categories & payment methods.

  • βœ… Zero-Setup Database: SQLite database initializes automatically.


Related MCP server: financial-agent

πŸ—οΈ Architecture

AdvancedExpenseTracker
β”‚
β”œβ”€β”€ expenses.db        # SQLite database (auto-created on first run)
β”œβ”€β”€ metadata.json      # Categories & payment methods (auto-created)
β”œβ”€β”€ main.py            # MCP server implementation
└── README.md

πŸ“¦ Tech Stack

  • Python 3.10+

  • FastMCP (The only external dependency)

  • SQLite (Built-in, serverless storage)

  • uv (For ultra-fast dependency management)


βš™οΈ Installation (using uv)

This project is designed to run instantly with uv. You do not need to manually create virtual environments.

1️⃣ Install uv (if not installed)

# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows (PowerShell)
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

2️⃣ Clone the Repository

git clone <your-repo-url>
cd AdvancedExpenseTracker

3️⃣ Test Run

You can verify the script works without installing anything globally:

uv run --with fastmcp main.py

On the first run, this will create expenses.db and metadata.json automatically.


πŸ”Œ Configuration (Connect to AI)

To use this with Claude Desktop or Cursor, you need to tell them where the script is.

Option A: Claude Desktop App

  1. Open your config file:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

    • Windows: %APPDATA%\Claude\claude_desktop_config.json

  2. Add the following (Replace /ABSOLUTE/PATH/TO/ with your real file path):

{
  "mcpServers": {
    "finance": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "fastmcp",
        "/ABSOLUTE/PATH/TO/main.py"
      ]
    }
  }
}

Option B: Cursor (IDE)

  1. Go to Cursor Settings > Features > MCP.

  2. Click + Add New MCP Server.

  3. Name: Expense Tracker

  4. Type: command

  5. Command: uv run --with fastmcp /ABSOLUTE/PATH/TO/main.py


🧠 MCP Capabilities (Detailed)

πŸ“Œ Expense Management

βž• Add Expense

add_expense(
  date="2026-01-05",
  amount=250,
  category="Food",
  subcategory="Dining",
  payment_method="Credit Card",
  note="Dinner with friends",
  tags="restaurant,weekend"
)

✏️ Update Expense

Update only the fields you want to change:

update_expense(expense_id=1, amount=300, note="Updated bill amount")

❌ Delete Expense

delete_expense(expense_id=1)

πŸ“„ List Expenses

list_expenses(
  start_date="2026-01-01",
  end_date="2026-01-31",
  category="Food",
  limit=50
)

πŸ” Search Expenses

Search across category, subcategory, notes, and tags:

search_expenses(query="restaurant")

πŸ’° Income & Cashflow

βž• Add Income

add_income(
  date="2026-01-01",
  amount=5000,
  source="Salary",
  note="January Paycheck"
)

πŸ“Š Cashflow Analysis

get_cashflow(start_date="2026-01-01", end_date="2026-01-31")

Returns:

{
  "total_income": 5000,
  "total_expenses": 1800,
  "net_savings": 3200,
  "savings_rate": "64.0%"
}

πŸ” Recurring Expenses Engine

βž• Add Recurring Expense

add_recurring_expense(
  name="Netflix",
  amount=15.99,
  category="Entertainment",
  frequency="monthly",
  start_date="2026-01-01"
)

Supported frequencies: daily, weekly, monthly, yearly.

πŸ”„ Process/Refresh Bills

Run this to generate actual expense entries from your templates:

process_recurring_expenses(target_date="2026-03-31")

πŸ“‰ Budgeting & Alerts

🎯 Set Monthly Budget

set_monthly_budget(category="Food", amount=500)

πŸ“‘ Budget Report

get_budget_report(month_str="2026-01")

Status logic:

  • βœ… OK

  • ⚠️ WARNING (>90% used)

  • ❌ OVER BUDGET


🧾 Metadata Management

πŸ“₯ Get Metadata (Resource)

The AI reads this to know which categories are allowed.

expense://metadata

βž• Manage Categories/Methods

manage_metadata(action="add", type="categories", value="Education")
manage_metadata(action="remove", type="payment_methods", value="Cash")

πŸ€– Built-in LLM Prompt

🧠 Financial Advisor Prompt

financial_advisor()

This prompt instructs the LLM to:

  • Act as a data-driven financial advisor.

  • Always validate metadata before logging.

  • Prioritize cashflow health and budget warnings.

  • Proactively manage recurring subscriptions.


πŸ” Data Safety

  • All data is stored locally in expenses.db.

  • No external API calls or cloud syncing.

  • To backup your data, simply copy the .db file.


πŸ“œ License

MIT License – free to use, modify, and distribute.


πŸ™Œ Author

Anubhab Das

Available Tools

12 tools
add_expenseC

Add a new expense. Date must be YYYY-MM-DD.

Inputs: date (required), amount (required), category (required), note, +3 more. Returns: result

add_incomeC

Log income (salary, freelance, etc).

Inputs: date (required), amount (required), source (required), note. Returns: result

add_recurring_expenseC

Set up a recurring bill. Frequency: 'daily', 'weekly', 'monthly', 'yearly'.

Inputs: name (required), amount (required), category (required), frequency (required), +1 more. Returns: result

delete_expenseC

Permanently delete an expense.

Inputs: expense_id (required). Returns: result

get_budget_reportA

Check spending vs budget for a specific month (YYYY-MM).

Inputs: month_str (required). Returns: result

get_cashflowC

Calculate Net Cashflow (Income - Expenses).

Inputs: end_date (required), start_date (required). Returns: object

list_expensesC

List expenses in a date range.

Inputs: end_date (required), start_date (required), limit, category. Returns: result

manage_metadataC

Add items to lists. action: 'add' or 'remove' type: 'categories' or 'payment_methods' value: The name to add/remove

Inputs: type (required), value (required), action (required). Returns: result

process_recurring_expensesA

Generate actual expense entries from recurring templates up to the target_date. Run this when the user asks to 'refresh' or 'check for new bills'.

Inputs: target_date (required). Returns: result

search_expensesB

Search expenses by matching text in notes, category, or tags.

Inputs: query (required). Returns: result

set_monthly_budgetC

Set a monthly limit for a specific category.

Inputs: amount (required), category (required). Returns: result

update_expenseB

Update an existing expense. Only provide fields to change.

Inputs: expense_id (required), date, note, tags, +4 more. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 12 tools

    Disambiguation4/5

    Each tool targets a fairly distinct resource+action (expense CRUD, income, budget, recurring, metadata), and descriptions clarify the tricky pairs like add_recurring_expense vs process_recurring_expenses. The main soft spots are list_expenses vs search_expenses (both return filtered expense sets) and get_cashflow being derivable from expense/income data, but these are reasonably separable.

    Naming Consistency5/5

    All twelve names are snake_case verb_noun (add_expense, update_expense, set_monthly_budget, get_budget_report), with no style mixing. The pattern reads predictably and maps cleanly to actions.

    Tool Count5/5

    Twelve tools is squarely in the ideal 3-15 range and each maps to a real workflow (expenses, income, recurring bills, budgets, metadata). No tool appears redundant or filler.

    Completeness3/5

    Expense lifecycle is fully covered (add/update/delete/list/search), but income only has add_income with no update/delete/list, and recurring bills have no way to list or cancel templates once created. Budget also lacks a remove/clear operation, leaving several dead ends an agent will hit.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      C
      maintenance
      Enables AI agents to manage personal finances with deterministic, grounded tools for cash-flow projection, drift detection, reconciliation, and Todoist integration. All figures trace back to a local SQLite database.
      55
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables personal finance management through natural language, including tracking income/expenses, categories, loans, subscriptions, budgets, and AI-powered insights, all backed by a local SQLite database.
      1
      MIT
    • F
      license
      A
      quality
      C
      maintenance
      Enables LLMs to record, list, update, and delete expenses and credits in a local SQLite database, with enforced categories and running balance summaries.
      8
      -