Skip to main content
Glama
Personal Expense Tracker

Personal Expense Tracker

by bhuvpal

Personal Expense Tracker

A simple expense tracking API built with FastAPI, SQLite, and FastMCP.

The project lets you add expenses, view them by date range, and get a quick summary of spending by category.

Features

  • Add a new expense

  • Store expenses in SQLite

  • Filter expenses by date range

  • Get spending totals by category

  • Optional category filtering for summaries

  • Expose the FastAPI app through an MCP server

Related MCP server: Personal Expense Tracker MCP

Tech Stack

  • Python 3.12+

  • FastAPI

  • SQLite

  • Pydantic

  • FastMCP

  • uv

Project Structure

PersonalExpenseTracker/
│
├── main.py           # FastAPI application and API routes
├── server.py         # FastMCP server
├── categories.json   # Expense categories
├── pyproject.toml    # Project configuration
├── uv.lock           # Locked dependencies
├── .gitignore
└── README.md

Getting Started

Clone the repository:

git clone https://github.com/bhuvpal/PersonalExpenseTracker.git
cd PersonalExpenseTracker

Install dependencies:

uv sync

Run the FastAPI server:

uv run uvicorn main:app --reload

The API will be available at:

http://127.0.0.1:8000

FastAPI also provides interactive API documentation at:

http://127.0.0.1:8000/docs

API Endpoints

Method

Endpoint

Purpose

GET

/

Check if the API is running

POST

/expenses

Add an expense

GET

/expenses

Get expenses for a date range

GET

/expenses/summarize

Get spending summary by category

Example Expense

{
  "amount": 250,
  "date": "2026-09-04",
  "category": "Food",
  "sub_category": "Lunch",
  "note": "Lunch with friends"
}

MCP Server

The project also includes a FastMCP server that exposes the FastAPI application for MCP-based usage.

Run it with:

uv run python server.py

Database

Expenses are stored locally in a SQLite database.

Each expense contains:

  • Amount

  • Date

  • Category

  • Sub-category

  • Note

Why I Built This

I built this project to practice building APIs with FastAPI and explore how existing APIs can be exposed through Model Context Protocol (MCP).

Author

Bhuv Pal

GitHub: @bhuvpal

Available Tools

4 tools
add_expense_expenses_postAdd Expense Expenses PostC

Add an expense to the database.

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

homeHomeD

Home

Inputs: no named parameters.

list_expenses_expenses_getList Expenses Expenses GetC

List all expenses in the database.

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

summarize_expenses_expenses_summarize_getSummarize Expenses Expenses Summarize GetC

Summarize expenses by category.

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

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    C2.2/5.0

    Scored across 4 tools

    Disambiguation4/5

    The three core tools (list, add, summarize expenses) target clearly distinct operations. However, the fourth tool 'home' has a vague description that gives no indication of what it does, creating one point of ambiguity.

    Naming Consistency2/5

    The three expense tools use verbose auto-generated route-style names with redundant doubled segments and HTTP-method suffixes (e.g. list_expenses_expenses_get), while 'home' follows no pattern at all. The conventions are mixed and unpredictable.

    Tool Count3/5

    Four tools is on the thin side for an expense tracker, and one of them ('home') appears to be a non-functional placeholder rather than a real capability. The count is borderline but not egregious.

    Completeness2/5

    The surface only supports create, list, and summarize; there is no update or delete for expenses, and no filtering or retrieval of a single expense. These are significant lifecycle gaps for an expense tracker.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables users to track personal expenses through natural language interactions with comprehensive category support and financial summaries. Provides both local and remote MCP server options with SQLite storage for fast expense management operations.
      -
    • A
      license
      B
      quality
      B
      maintenance
      Enables local tracking of personal expenses by adding, listing, summarizing, updating, and deleting expense records stored in a CSV file through an MCP client.
      5
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables managing and analyzing personal expenses through MCP tools, including adding expense records, listing expenses within date ranges, and summarizing spending by category, with expense categories exposed as an MCP resource.
      -
    • F
      license
      B
      quality
      C
      maintenance
      Enables users to manage personal expenses by adding entries, listing them by date range, and summarizing spending by category through MCP tools, while exposing category data as a resource.
      3
      -