Expense Tracker MCP Server

Expense Tracker MCP Server

An AI-powered financial management engine that enables budgeting, smart expense tracking, and affordability analytics via the Model Context Protocol. It allows AI assistants to interact with financial data through natural language for tasks like category detection, bulk expense ingestion, and budget impact predictions.

Category
Visit Server

README

πŸ“˜ Expense Tracker MCP Server

AI-powered budgeting, smart expense tracking, and affordability insights using the Model Context Protocol (MCP).

The Expense Tracker MCP Server provides a complete financial tracking engine that integrates budgeting, expense ingestion, smart category detection, and affordability analyticsβ€”all via the Model Context Protocol so AI assistants can interact with your financial data safely and intelligently.


πŸš€ Features

βœ… Budget Management

  • Create total-only or category-based monthly budgets
  • Validate category allocations and auto-suggest corrections
  • Convert budgets from total-only β†’ category-mode
  • Graceful error handling and flexible month parsing

βœ… Expense Management

  • Add expenses with smart category & subcategory detection
  • Auto date parsing ("yesterday", "next Monday", "Jan 5")
  • Duplicate detection and budget impact analysis
  • Bulk add expenses (NLP friendly, validated, error-tolerant)
  • Update & delete expenses with validation & safety prompts

βœ… Affordability Engine

  • Predict affordability before adding expenses
  • Total-budget and category-budget aware
  • Impact percentage + status levels
  • Consistent logic across all modules

βœ… Insights & Analytics

  • Summaries by month, category, or date ranges
  • Remaining budget calculations and trend extraction
  • Days remaining in month tracking
  • Human-readable status indicators

βœ… Smart Category Detection

  • AI-powered heuristics for auto-category assignment
  • Keyword extraction and confidence-based assignment
  • Fallback suggestions when uncertain
  • Works for both bulk and single expenses

βœ… Human-Friendly Design

  • Suggestions instead of hard errors
  • Clarification prompts and auto-fixes for common mistakes
  • Safe delete operations with confirmation
  • Full MCP-compatible error handling

πŸ—οΈ Project Structure

expense-tracker-mcp/
β”‚
β”œβ”€β”€ server.py                  # MCP server entrypoint
β”œβ”€β”€ config.py                  # Category config & paths
β”‚
β”œβ”€β”€ modules/                   # MCP tool implementations
β”‚   β”œβ”€β”€ budget.py              # Budget tools (set, list, remaining)
β”‚   β”œβ”€β”€ expenses.py            # Add, update, delete, bulk-add
β”‚   β”œβ”€β”€ affordability.py       # Affordability analysis
β”‚   β”œβ”€β”€ search.py              # Query expenses/budgets
β”‚   └── insights.py            # Higher-level analytics
β”‚
β”œβ”€β”€ utils/                     # Core business logic
β”‚   β”œβ”€β”€ database.py            # SQLite connection + init
β”‚   β”œβ”€β”€ budget_core.py         # Core budget logic
β”‚   β”œβ”€β”€ expenses_core.py       # Core DB I/O for expenses
β”‚   β”œβ”€β”€ affordability_core.py  # Core affordability logic
β”‚   β”œβ”€β”€ category_detection.py # Keyword & heuristic-based detection
β”‚   β”œβ”€β”€ date_utils.py          # Flexible date parsing
β”‚   β”œβ”€β”€ status.py              # Budget status levels
β”‚   └── __init__.py            # Aggregated exports
β”‚
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ budgets.json           # Stored budget data
β”‚   └── expenses.db            # SQLite expense database
β”‚
└── resources/
    └── categories.json        # Category β†’ subcategories mapping

βš™οΈ Installation & Setup

1. Clone the Repository

git clone https://github.com/Khushi-c-sharma/expense-tracker-mcp-server-improvised.git
cd expense-tracker-mcp

2. Create and Activate a Virtual Environment

# Create virtual environment
python -m venv .venv

# Activate (Windows)
.\.venv\Scripts\activate

# Activate (macOS/Linux)
source .venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Initialize the Database

The server automatically initializes the SQLite database on startupβ€”no manual setup required.

5. Run the Server

For Claude Desktop integration:

fastmcp dev server.py

For testing/development:

fastmcp run server.py

πŸ”Œ Claude Desktop Integration

To use this server with Claude Desktop, add the following to your claude_desktop_config.json:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "expense-tracker": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "fastmcp",
        "fastmcp",
        "dev",
        "/absolute/path/to/expense-tracker-mcp/server.py"
      ]
    }
  }
}

Replace /absolute/path/to/ with your actual path, then restart Claude Desktop.


🧰 Available Tools

πŸ”Ή Budget Tools

Tool Description
set_monthly_budget Set total or category-based budgets
get_remaining_budget Check remaining money by month/category
list_budgets View all budget configurations
convert_to_category_budget Transform simple budgets into category budgets

πŸ”Ή Expense Tools

Tool Description
add_expense Add expenses with smart category detection
bulk_add_expenses Add multiple expenses at once (validated & robust)
update_expense Safely update amount/category/date/description
delete_expense Safe delete with confirmation
get_category_info Get rules for categories/subcategories

πŸ”Ή Affordability Tools

Tool Description
check_affordability Predict impact before adding an expense

πŸ”Ή Insights Tools

Tool Description
monthly_summary Summaries of spending by month
category_breakdown Category-level insights
remaining_days_info Insights with days remaining

πŸ”Ή Search Tools

Tool Description
search_expenses Query expenses by text/category/date
search_budget Find budgets easily
smart_lookup Intelligent search ("What did I spend on food last week?")

πŸ§ͺ Testing

To ensure module compatibility and catch issues early:

pip install pytest
python -m pytest -q

Our tests verify that all modules load without import errors, validate API shapes, and catch schema issues before deployment.


🎯 Design Philosophy

βœ” Human-First UX

Errors guide users with suggestions rather than blocking them completely.

βœ” Strict Tool API Discipline

MCP-safe signatures (no **kwargs), predictable schemas, and consistent behavior.

βœ” Separation of Concerns

  • modules/ β†’ Conversational logic and MCP tool implementations
  • utils/ β†’ Pure core business logic
  • server.py β†’ MCP integration layer

βœ” Extensible Architecture

Adding new tools or insights is straightforward thanks to the modular design.


πŸ“ˆ Future Enhancements

  • [ ] Machine learning–based category predictions
  • [ ] OCR receipt scanning β†’ auto expense import
  • [ ] Real-time spending limit notifications
  • [ ] Expense tagging system
  • [ ] Multi-user support
  • [ ] CSV/Excel bulk import tools
  • [ ] Auto-recurring expenses (rent, subscriptions)
  • [ ] Budget forecasting and projections
  • [ ] Integration with banking APIs
  • [ ] Mobile app companion

πŸ’¬ Contributing

We welcome contributions! Feel free to open issues or pull requests to:

  • Add new features
  • Improve category detection heuristics
  • Suggest new insights and analytics
  • Expand test coverage
  • Improve documentation

πŸ“ License

[Add your license here - MIT, Apache 2.0, etc.]


🧠 About

This project was built to serve as the backend brain for AI budgeting assistants using the Model Context Protocol. It emphasizes:

  • Reliability β†’ Robust error handling and validation
  • Explainability β†’ Clear feedback and suggestions
  • Graceful Handling β†’ User-friendly error messages
  • Human-Friendly Responses β†’ Natural language interactions

Your server is now one of the most feature-rich MCP financial engines available, ready to power intelligent personal finance assistants.


πŸ™ Acknowledgments

Built with FastMCP and powered by the Model Context Protocol.

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
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
Qdrant Server

Qdrant Server

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

Official
Featured