ExpenseTracker MCP Server

ExpenseTracker MCP Server

Enables AI assistants to manage personal expenses by adding, querying, and summarizing expense data through a SQLite database and configurable categories.

Category
Visit Server

README

ExpenseTracker MCP Server

A Model Context Protocol (MCP) server for managing personal expenses. Built with FastMCP, this server provides tools for tracking, querying, and summarizing expenses through an AI-ready interface.

Overview

ExpenseTracker is a lightweight MCP server that enables Claude and other AI applications to:

  • Add expenses to a SQLite database with categories and notes
  • Query expenses by date range for review and analysis
  • Summarize expenses by category to understand spending patterns
  • Manage categories through a configurable JSON file

This project demonstrates how to build a practical MCP server that integrates with AI assistants for real-world expense management.

What is MCP?

The Model Context Protocol (MCP) is an open standard that allows AI applications to interact with local tools and data sources safely. MCP servers expose resources and tools that AI models can access through a standardized interface, enabling features like:

  • Tool use and automation
  • Resource access and management
  • Server-side processing with client-side oversight

Learn more at modelcontextprotocol.io

Features

  • šŸ“Š Add Expenses - Log expenses with date, amount, category, subcategory, and notes
  • šŸ” Query Expenses - Retrieve expenses within a date range with full filtering
  • šŸ’° Summarize Spending - Get expense totals by category for budget analysis
  • šŸ“ Category Management - Maintain a flexible list of expense categories via JSON
  • šŸ—„ļø SQLite Backend - Persistent storage with no external dependencies
  • šŸ¤– MCP Integration - Works seamlessly with Claude and other MCP-compatible clients

Installation

Prerequisites

  • Python 3.14+
  • pip or uv package manager

Setup

  1. Clone the repository

    git clone https://github.com/yourusername/local-mcp-server.git
    cd local-mcp-server
    
  2. Create a virtual environment

    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    
  3. Install dependencies

    pip install -e .
    # Or with uv:
    uv sync
    
  4. Create categories file (optional)

    cat > categories.json << 'EOF'
    {
      "categories": [
        "Food & Dining",
        "Transportation",
        "Entertainment",
        "Shopping",
        "Bills & Utilities",
        "Health & Fitness",
        "Travel",
        "Other"
      ]
    }
    EOF
    

Usage

Running the Server

Start the MCP server:

python main.py

The server will initialize the SQLite database and listen for MCP connections.

Available Tools

add_expense

Add a new expense entry to the database.

Parameters:

  • date (string, required): Date in YYYY-MM-DD format
  • amount (number, required): Expense amount
  • category (string, required): Expense category
  • subcategory (string, optional): Subcategory for detailed tracking
  • note (string, optional): Additional notes or description

Example:

{
  "date": "2024-06-14",
  "amount": 45.50,
  "category": "Food & Dining",
  "subcategory": "Restaurant",
  "note": "Lunch at Italian place"
}

list_expenses

Retrieve expenses within a date range.

Parameters:

  • start_date (string, required): Start date in YYYY-MM-DD format (inclusive)
  • end_date (string, required): End date in YYYY-MM-DD format (inclusive)

Example:

{
  "start_date": "2024-06-01",
  "end_date": "2024-06-30"
}

Returns: Array of expense objects with id, date, amount, category, subcategory, and note fields.

summarize

Get a summary of expenses by category within a date range.

Parameters:

  • start_date (string, required): Start date in YYYY-MM-DD format (inclusive)
  • end_date (string, required): End date in YYYY-MM-DD format (inclusive)
  • category (string, optional): Filter by specific category

Example:

{
  "start_date": "2024-06-01",
  "end_date": "2024-06-30",
  "category": "Food & Dining"
}

Returns: Array of category summary objects with category and total_amount fields.

Resources

expense://categories

Access the current list of expense categories. The categories file is read fresh on each access, allowing modifications without server restart.

MIME Type: application/json

Configuration

Database

The SQLite database file is stored as expenses.db in the project root. The database is automatically initialized on first run with the expenses table.

Schema:

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

Categories

Edit categories.json to customize the list of expense categories available for your use case. Changes are reflected immediately without restarting the server.

Project Structure

local-mcp-server/
ā”œā”€ā”€ main.py              # MCP server implementation
ā”œā”€ā”€ expenses.db          # SQLite database (auto-created)
ā”œā”€ā”€ categories.json      # Category definitions
ā”œā”€ā”€ pyproject.toml       # Project configuration
ā”œā”€ā”€ uv.lock             # Dependency lock file
ā”œā”€ā”€ LICENSE             # GPL 3.0 license
└── README.md           # This file

Technical Details

  • Framework: FastMCP
  • Database: SQLite3 (built-in Python library)
  • Protocol: Model Context Protocol (MCP)
  • Language: Python 3.14+

Integration with Claude

To use this server with Claude or other MCP clients, configure your client to connect to this server. Consult your client's documentation for MCP server setup instructions.

Development

Running Tests

Currently, no automated tests are included. Manual testing via an MCP client is recommended.

Code Style

The project follows standard Python conventions. Use of type hints and docstrings is encouraged for future contributions.

License

This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/your-feature)
  3. Commit your changes (git commit -am 'Add new feature')
  4. Push to the branch (git push origin feature/your-feature)
  5. Open a Pull Request

Roadmap

Future enhancements may include:

  • [ ] Budget tracking and alerts
  • [ ] Recurring expenses
  • [ ] Multi-user support
  • [ ] Export functionality (CSV, PDF)
  • [ ] Advanced analytics and reports
  • [ ] Tagging system for expenses
  • [ ] Receipt attachment storage

Support

For issues, questions, or suggestions, please open an issue on GitHub or contact the maintainers.

Acknowledgments

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured