Skip to main content
Glama
Expense Tracker MCP

Expense Tracker MCP

by Arjit005

Expense Tracker MCP

A local expense and income tracker backed by SQLite. The project provides a Model Context Protocol (MCP) server for AI assistants (such as Claude Desktop, Cursor, and other MCP clients) and an optional FastAPI REST server for HTTP clients.

Features

  • Expenses: Add, list, edit, and delete expense records.

  • Income & Credits: Store income/credit entries and calculate your current balance in real time.

  • Categorization: Summarize spending grouped by category with optional date and category filters.

  • Category Catalog: Load and query category/subcategory definitions from categories.json.

  • Local Storage: All records are stored locally in SQLite (expenses.db), ensuring privacy.

Related MCP server: ExpenseTracker MCP Server

Technology Stack

  • Python: 3.13 or newer

  • FastMCP: High-performance MCP server implementation

  • SQLite: Local relational storage

  • FastAPI & Uvicorn: Optional REST API with OpenAPI documentation

  • uv: Fast Python package and dependency manager

Project Structure

.
|-- expense_tracker.py       # Main FastMCP expense tracker server
|-- server.py                # Optional FastAPI REST API server
|-- categories.json          # Expense categories and subcategories catalog
|-- pyproject.toml           # Project metadata and dependencies (uv)
|-- uv.lock                  # Locked Python dependencies
|-- expenses.db              # Local runtime SQLite database (git-ignored)
`-- src/expense_tracker_mcp/ # Package entry point
    `-- __init__.py

Setup

  1. Install uv if not already installed.

  2. Clone or navigate to this directory and sync dependencies:

# Sync core MCP dependencies
uv sync

# (Optional) Include FastAPI REST dependencies
uv sync --extra api

The database (expenses.db) and its tables are automatically created on first run:

  • expenses: id, date, amount, category, subcategory, note

  • credit: id, date, amount, source, note


Running the MCP Server

Start the MCP server using either of the following commands:

uv run python expense_tracker.py

Or via the installed package command:

uv run expense-tracker-mcp

Exposed MCP Tools

Tool

Parameters

Description

add_expense

date, amount, category, subcategory, note

Add an expense (date defaults to today).

list_expenses

start_date, end_date, limit

List expense records with optional date range and limit.

summarize

start_date, end_date, category

Group expenses by category and calculate totals.

edit_expense

expense_id, date, amount, category, subcategory, note

Update fields of an existing expense record.

delete_expense

expense_id

Delete an expense by ID.

add_credit

date, amount, source, note

Add an income or credit record.

list_credits

limit

List recent credit entries.

get_balance

(none)

Return total credits, total expenses, and current balance.

Exposed MCP Resources

Resource URI

MIME Type

Description

expense://categories

application/json

Provides the category catalog from categories.json.


Configuring with MCP Clients (e.g. Claude Desktop)

To connect this server to Claude Desktop, add the configuration below to your claude_desktop_config.json:

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

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

{
  "mcpServers": {
    "expense-tracker": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "C:\\Users\\Dell\\OneDrive\\Desktop\\Expense_tracker_mcp",
        "python",
        "expense_tracker.py"
      ]
    }
  }
}

(Replace the path with the absolute path to your project directory).


Running the REST API

server.py provides equivalent HTTP endpoints and interactive OpenAPI documentation.

Start the API:

uv run python server.py
  • API Base URL: http://localhost:8000

  • Interactive Swagger UI: http://localhost:8000/docs

Main REST Endpoints

Method

Endpoint

Description

POST

/expenses

Add a new expense

GET

/expenses

List expenses (supports start_date, end_date, limit)

PATCH

/expenses/{expense_id}

Update an existing expense

DELETE

/expenses/{expense_id}

Delete an expense

GET

/expenses/summary

Get expense summary by category

POST

/credits

Add a credit / income entry

GET

/credits

List credit entries

GET

/balance

Get current balance

GET

/categories

Retrieve categories catalog

Example Request

curl -X POST http://localhost:8000/expenses \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 25.50,
    "category": "food",
    "subcategory": "dining_out",
    "note": "Lunch"
  }'

Data and Privacy

All financial records are stored locally in expenses.db within the project root. This file is excluded by .gitignore to prevent sensitive financial data from being committed to version control.

Available Tools

8 tools
add_creditAdd CreditB

Add credit/income entry.

Inputs: date, note, amount, source.

add_expenseAdd ExpenseC

Add a new expense entry to the database.

Inputs: date, note, amount, category, +1 more.

delete_expenseDelete ExpenseA

Delete an expense entry.

Inputs: expense_id (required).

edit_expenseEdit ExpenseC

Edit an existing expense.

Inputs: expense_id (required), date, note, amount, +2 more.

get_balanceGet BalanceA

Get current balance (total credits - total expenses).

Inputs: no named parameters.

list_creditsList CreditsC

List credit entries.

Inputs: limit.

list_expensesList ExpensesA

List expense entries. Optionally filter by date range.

Inputs: limit, end_date, start_date.

summarizeSummarizeB

Summarize expenses by category. Optionally filter by date range or category.

Inputs: category, end_date, start_date.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool targets a clearly distinct operation: add/list/edit/delete expenses, add/list credits, summarize, and get balance. There are no overlapping or confusable tools; an agent can easily select the correct action.

    Naming Consistency4/5

    Most tools follow a consistent verb_noun pattern like add_expense, list_expenses, edit_expense, delete_expense, add_credit. Minor deviations include the bare verb 'summarize' and 'get_balance' instead of something like 'summarize_expenses' or 'get_balance', but the overall pattern remains readable and predictable.

    Tool Count5/5

    With 8 tools, the set is well-scoped for an expense tracker. There are enough tools to cover core operations without unnecessary redundancy or overwhelming the agent.

    Completeness3/5

    Expenses have full CRUD coverage (add, list, edit, delete) and there is summarizing plus balance calculation. However, credits only support add and list, with no edit_credit or delete_credit, which creates a notable gap in managing income entries and could leave incorrect credits uncorrectable.

    Maintenance

    ActivityStale
    ResponsivenessOutdated data

    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
      B
      maintenance
      Enables natural language expense management by converting user requests into validated database operations, including adding, searching, updating, deleting, and summarizing expenses through MCP tools over SQLite.
      -
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to add, retrieve, and categorize expense records through structured MCP tools, with data stored in SQLite and deployable remotely for natural-language expense management.
      -