Skip to main content
Glama
Expense Tracker MCP Server

Expense Tracker MCP Server

by akshay0101

Expense Tracker MCP Server

An asynchronous Model Context Protocol (MCP) server built with Python and FastMCP to log and track personal expenses inside a local SQLite database with strict category/subcategory checks.

Features

  • SQLite Database Backend: Logs expenses locally in expenses.db using aiosqlite.

  • Asynchronous Execution: Fully utilizes asyncio and async database connections.

  • Categorization: Validates categories and subcategories against a custom JSON hierarchy (categories.json).

  • Exposed Tools:

    • add_expense: Add a new transaction (validates amount, category, and dates).

    • get_expenses: View matching logs with optional category, subcategory, start date, and end date filters.

    • get_expense_summary: View spent totals, item count, and percentages grouped by category.

    • delete_expense: Remove transaction logs by database ID.

  • Exposed Resources:

    • expense://categories: Returns the JSON representation of categories and their subcategories.

    • expense://categories/{category}/subcategories: Returns subcategories for a given category in JSON format.

Related MCP server: Expense Tracker MCP Server

Files Structure

  • main.py: Server entrypoint containing initialization, SQLite queries, MCP tools, and MCP resource declarations.

  • categories.json: Configuration file specifying categories and subcategories.

  • pyproject.toml: Package configuration with metadata and dependency requirements (fastmcp and aiosqlite).

  • .gitignore: Configured to ignore virtual environments, cache directories, and local database files.

Installation

Ensure you have uv installed.

To sync dependencies:

uv sync

Running the Server

To start the MCP server locally:

uv run python main.py

Development and Testing

A test suite is available under the artifacts directory. To run the async test suite:

uv run python C:\Users\User\.gemini\antigravity-ide\brain\7f833c64-f9e4-404b-a691-0d0df923616c\scratch\test_server.py

Available Tools

4 tools
add_expenseA

Add a new expense with amount, category, subcategory, optional description, and date (YYYY-MM-DD)

Inputs: amount (required), category (required), subcategory (required), date, +1 more. Returns: result

delete_expenseA

Delete an expense record by its numeric ID

Inputs: expense_id (required). Returns: result

get_expensesA

Retrieve list of expenses, optionally filtered by category, subcategory, start_date, or end_date (YYYY-MM-DD)

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

get_expense_summaryA

Get total summary and category breakdown of all expenses

Inputs: no named parameters. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool targets a distinct operation: adding, listing, summarizing, and deleting expenses. There is no overlap in purpose, so an agent can easily select the correct tool.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern (add_expense, get_expenses, get_expense_summary, delete_expense). The snake_case style is uniform across the set.

    Tool Count5/5

    The server has 4 tools, which is well-scoped for an expense tracker. Each tool covers a fundamental operation without unnecessary redundancy or excessive granularity.

    Completeness4/5

    The set covers the main expense lifecycle: create, read (list), summary, and delete. Missing an update operation is a minor gap, but most core workflows are supported.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      C
      quality
      D
      maintenance
      Enables personal expense management with SQLite storage, allowing users to add, update, delete, list, and summarize expenses by category through natural language interactions.
      5
      -
    • F
      license
      A
      quality
      D
      maintenance
      Enables tracking and managing personal expenses through a local SQLite database. Supports adding, editing, deleting, listing, and summarizing expenses by category, as well as managing credit accounts.
      6
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables natural language management of personal expenses, including adding, listing, and summarizing expenses with local SQLite storage.
      -
    • F
      license
      B
      quality
      D
      maintenance
      Tracks and manages personal expenses with tools to add, view, filter by category, and summarize spending over date ranges using SQLite storage.
      4
      -