Expense Tracker MCP
A simple MCP server for tracking expenses in a local SQLite database, enabling add, read, update, delete, and summarization of expenses with predefined categories.
README
Expense Tracker MCP
A simple Model Context Protocol (MCP) server for tracking expenses in a local SQLite database. It exposes tools for adding, reading, updating, deleting, and summarizing expenses, plus a JSON resource containing supported categories and subcategories.
Features
- Add expenses with amount, date, category, subcategory, and note fields
- List all saved expenses
- Query expenses by start and end date
- Update existing expenses by ID
- Delete expenses by ID
- Summarize spending by category over a date range
- Read predefined expense categories from
categories.json - Store data locally in
expenses.db
Requirements
- Python 3.13 or newer
uvfor dependency management, or another Python package manager
Installation
Clone the project and install dependencies:
uv sync
The main dependency is fastmcp, defined in pyproject.toml.
Running The Server
Start the MCP server:
uv run python main.py
By default, the server runs over HTTP on:
http://0.0.0.0:8000
The SQLite database is initialized automatically when the server starts. If expenses.db does not already contain the required table, it will be created.
MCP Tools
add_expense
Adds a new expense.
Parameters:
amount(float): Expense amountdate(str): Expense date, preferably inYYYY-MM-DDformatcategory(str): Main expense categorysubcategory(str, optional): More specific categorynote(str, optional): Additional details
Example:
{
"amount": 250.75,
"date": "2026-07-08",
"category": "food",
"subcategory": "groceries",
"note": "Weekly grocery run"
}
get_expenses
Returns all expenses stored in the database.
get_expense_by_start_end_date
Returns expenses between two dates.
Parameters:
start_date(str): Start dateend_date(str): End date
Example:
{
"start_date": "2026-07-01",
"end_date": "2026-07-31"
}
update_expense
Updates an existing expense by ID. Only fields provided in the request are updated.
Parameters:
expense_id(int): Expense IDamount(float, optional): Updated amountdate(str, optional): Updated datecategory(str, optional): Updated categorysubcategory(str, optional): Updated subcategorynote(str, optional): Updated note
Example:
{
"expense_id": 1,
"amount": 300,
"note": "Updated grocery total"
}
delete_expense
Deletes an expense by ID.
Parameters:
expense_id(int): Expense ID to delete
summarize
Summarizes expenses by category for a date range.
Parameters:
start_date(str): Start dateend_date(str): End datecategory(str, optional): Filter summary to one category
Example:
{
"start_date": "2026-07-01",
"end_date": "2026-07-31",
"category": "food"
}
MCP Resources
expenses://categories
Returns the contents of categories.json, which maps supported categories to their subcategories.
Example categories include:
foodtransporthousingutilitieshealtheducationbusinesstravelinvestmentsmisc
Data Model
Expenses are stored in the expenses SQLite table:
| Column | Type | Description |
|---|---|---|
id |
INTEGER |
Auto-incrementing primary key |
amount |
REAL |
Expense amount |
date |
TEXT |
Expense date |
category |
TEXT |
Main category |
subcategory |
TEXT |
Optional subcategory |
note |
TEXT |
Optional note |
Project Structure
.
├── main.py # FastMCP server and tool definitions
├── categories.json # Category and subcategory definitions
├── expenses.db # Local SQLite database
├── pyproject.toml # Project metadata and dependencies
├── uv.lock # Locked dependency versions
└── README.md
Notes
- Date values are stored as text. Use a consistent format such as
YYYY-MM-DDso date-range queries work correctly. - The database file is local to this project directory.
- The current implementation does not validate category names against
categories.json; clients should use the categories resource to choose valid values.
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.