Expense Tracker MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Expense Tracker MCP ServerAdd a $45 dinner expense under Food today"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Expense Tracker MCP Server
A lightweight Model Context Protocol (MCP) server built with Python, FastMCP, and SQLite that enables AI assistants to manage, retrieve, update, and analyze personal expenses using natural language.
The server exposes expense management operations as MCP tools and provides predefined expense categories through an MCP resource. It supports remote integration with MCP-compatible AI clients when deployed on a publicly accessible server.
Features
Add Expenses: Record expenses with dates, amounts, categories, subcategories, and optional notes.
View Expenses: Retrieve expense records within a specified date range.
Update Expenses: Modify existing expense records using their unique IDs.
Delete Expenses: Remove expense records by ID.
Expense Summaries: Calculate total spending grouped by category, with optional category filtering.
Expense Categories: Access predefined categories and subcategories through an MCP resource.
SQLite Database: Lightweight persistent storage without requiring an external database service.
Remote MCP Access: HTTP transport support for integration with compatible AI applications.
Related MCP server: Expense Tracker MCP Server
Tech Stack
Technology | Purpose |
Python | Backend development |
FastMCP | MCP server framework |
SQLite | Expense data storage |
JSON | Category and subcategory configuration |
MCP | AI tool and resource integration |
HTTP | Remote client-server communication |
Project Structure
Expense-Tracker-MCP-Server/
│
├── main.py # FastMCP server and expense tools
├── categories.json # Expense categories and subcategories
├── expenses.db # SQLite database (auto-generated)
├── pyproject.toml # Project configuration and dependencies
├── uv.lock # Locked dependencies (if using uv)
├── .gitignore
└── README.mdMCP Tools
The server provides five MCP tools for expense management.
Tool | Description |
| Add a new expense record |
| Retrieve expenses within a date range |
| Update selected fields of an existing expense |
| Delete an expense using its ID |
| Calculate total expenses grouped by category |
Note: Tool names match the current implementation.
1. Add Expense
Tool: add_expanse
Adds a new expense record to the SQLite database.
Parameters:
date: Expense dateamount: Expense amountcategory: Main expense categorysubcategory: Optional subcategorynote: Optional description
Example request:
Add an expense of ₹250 for lunch under Food, subcategory Restaurant, on 2026-10-24.
Example response:
{
"status": "Successfully added!",
"id": 1
}2. List Expenses
Tool: list_expanses
Retrieves all expenses within an inclusive date range, ordered by expense ID.
Example request:
Show all my expenses between October 1 and October 24, 2026.
3. Update Expense
Tool: update_expense
Updates an existing expense using its unique ID. Only the fields provided are modified.
Example request:
Update expense ID 1 and change its amount to ₹300.
4. Delete Expense
Tool: delete_expense
Deletes an expense record using its unique ID.
Example request:
Delete expense ID 1.
5. Summarize Expenses
Tool: summarize
Calculates total spending grouped by category within a specified date range.
Example request:
Summarize my expenses by category for October 2026.
Example response:
[
{
"category": "Food",
"total_amount": 3500.0
},
{
"category": "Transport",
"total_amount": 1200.0
},
{
"category": "Utilities",
"total_amount": 2000.0
}
]MCP Resources
Expense Categories
Resource URI: expense://categories
MIME Type: application/json
Provides predefined expense categories and subcategories from categories.json.
The resource reads the JSON file dynamically, allowing category updates without restarting the server.
Installation and Local Setup
Prerequisites
Python 3.10 or later
uv package manager (recommended)
An MCP-compatible client
1. Clone the Repository
git clone https://github.com/<your-username>/Expense-Tracker-MCP-Server.git
cd Expense-Tracker-MCP-ServerReplace <your-username> with your GitHub username.
2. Install Dependencies
Using uv:
uv syncAlternatively, install FastMCP using pip:
pip install fastmcp3. Start the MCP Server
uv run python main.pyThe server runs locally at:
http://127.0.0.0:8000/mcpThe SQLite database is automatically initialized when the application starts.
Deployment on MCP Cloud
The application is designed to support remote MCP communication using HTTP transport.
Deployment Steps
Push the project to a GitHub repository.
Sign in to your preferred MCP Cloud hosting platform.
Create a new MCP server deployment.
Connect the GitHub repository or upload the required project files.
Configure the Python environment and dependencies.
Set the server start command according to the hosting platform's requirements.
Configure the server to listen on the host and port required by the platform.
Deploy the application and obtain its public MCP endpoint.
Example remote endpoint:
https://your-server.example.com/mcpThe actual URL depends on the deployment provider.
Remote MCP Client Configuration
For MCP clients that support remote HTTP servers, an example configuration is:
{
"mcpServers": {
"expense-tracker": {
"type": "http",
"url": "https://your-server.example.com/mcp"
}
}
}Configuration formats vary across MCP clients.
Database Schema
The application uses SQLite to store expense records.
Table: expenses
Column | Data Type | Description |
id | INTEGER | Primary key, auto-incremented |
date | TEXT | Expense date |
amount | REAL | Expense amount |
category | TEXT | Main expense category |
subcategory | TEXT | Optional subcategory |
note | TEXT | Optional description |
Example Natural Language Queries
Once connected to an MCP-compatible AI assistant, users can perform operations such as:
"Add ₹500 spent on groceries today."
"Show my expenses for the last seven days."
"How much did I spend on food this month?"
"Update expense ID 5 to ₹750."
"Delete expense ID 3."
"Summarize my spending by category this month."
The AI assistant can invoke the appropriate MCP tools based on the user's request.
Security and Deployment Considerations
Use HTTPS for remote MCP connections.
Configure authentication before exposing expense modification tools publicly.
Avoid committing personal expense records or database files to GitHub.
Use persistent storage for SQLite when deploying to cloud infrastructure.
Validate expense inputs and use consistent date formatting (
YYYY-MM-DD).Use separate databases or access controls when supporting multiple users.
Important: The current implementation does not include authentication or per-user data isolation. It should not be exposed as a publicly writable service without additional access controls.
Future Improvements
User authentication and authorization
Multi-user expense management
Monthly and yearly spending analytics
Budget planning and spending limits
Expense visualization and reporting
Export expenses to CSV
Cloud-hosted database integration
Automated expense categorization
This server cannot be deployed
Maintenance
Related MCP Connectors
- ManiloOAuthapp.manilo
Log, query, and edit expenses, budgets, and accounts in Manilo from any MCP-compatible AI assistant.
- ManiloOAuthapp.ledgy.api
Log, query, and edit expenses, budgets, and accounts in Manilo (formerly Ledgy) from any MCP-compatible AI assistant.
Log, query, and edit expenses, budgets, and accounts in Ledgy from any MCP-compatible AI assistant.
Personal finance for AI agents — onboard, import statements, categorize & budget over MCP.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables 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-
- FlicenseCqualityDmaintenanceEnables personal expense management with SQLite storage, allowing users to add, update, delete, list, and summarize expenses by category through natural language interactions.5-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage personal expenses by adding, querying, and summarizing expense data through a SQLite database and configurable categories.1GPL 3.0
- FlicenseNot gradedqualityAmaintenanceEnables 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.-