Smart Expense Management MCP
Smart Expense MCP lets an AI assistant manage expenses, budgets, recurring items, friends/balances, group events/splits, analytics, and reports through MCP tools.
Create, view, update, soft-delete, restore, list, and filter expenses with metadata such as tags, merchant, location, receipt URL, payment method, category, subcategory, and event.
Manage categories and subcategories: create, rename, change icons, delete, add subcategories, and move them between categories.
Generate analytics: category-wise summaries, monthly/yearly breakdowns, payment-method summaries, budget summaries, and quick dashboard stats.
Set and track monthly category budgets with ๐ข/๐ก/๐ด alert levels.
Add, list, and process recurring expenses with daily, weekly, monthly, or yearly frequency.
Manage friends and balances: add/list friends, record who paid whom, view friend/overall balances, and settle up.
Create and manage group events: add members, add equal/percentage/custom split expenses, view event summaries, list events, and close events.
Compute minimized settlement transactions with a greedy two-pointer algorithm and explain the algorithm.
Search expenses conversationally and return matching records plus totals, counts, and averages.
Export monthly expenses to CSV or Excel.
Allows automatic creation of expense entries for Netflix subscriptions through the recurring expenses feature.
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., "@Smart Expense Management MCP How much did I spend on food this month?"
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.
๐ฐ Smart Expense โ AI-Powered Expense Management MCP
Track expenses, split bills with friends, manage group trips, and get spending analytics โ all through natural conversation with Claude or ChatGPT.
No app to open, no forms to fill. Just talk.
Built with FastMCP + Python + Neon PostgreSQL, and hosted on Render.
โจ What You Can Do
Just talk to Claude or ChatGPT naturally:
"Add โน450 expense at Domino's, Food category, paid via UPI, tags: dinner, friends."
"How much did I spend on food this month?"
"I paid โน600 for Rahul for petrol."
"Who owes me money?"
"Create a Girnar Trip event with Rahul, Prince, and Jay."
"Add โน4000 hotel expense to Girnar Trip, split equally."
"Who owes what in the Girnar trip?"
"Set a โน5000 budget for Food in July 2026."
"Export July 2026 expenses to Excel."
The AI assistant understands your request, selects the appropriate MCP tool, and performs the operation.
Related MCP server: expense-tracker-mcp-server
๐งฉ Features
Module | What it does |
Expenses | Full CRUD, soft-delete/restore, tags, merchant, location, receipt URL |
Categories | Dynamic categories and subcategories with emoji icons |
Filtering Engine | 15+ dimensions โ date, category, amount range, merchant, tags, payment method, event |
Analytics | Monthly/yearly summaries, category breakdown with percentages, budget utilization and alerts |
Splitwise (General) | Record "I paid for X" / "X paid for me" with net balance tracking per friend |
Splitwise (Events) | Group trips with equal, percentage, and custom splits |
Settlement Engine | Greedy two-pointer algorithm to minimize settle-up transactions |
Budgets | Per-category monthly budgets with ๐ข ๐ก ๐ด alert levels |
Recurring Expenses | Manage recurring entries for Netflix, rent, gym, etc. |
Reports | Export expenses to CSV and Excel ( |
๐ Live Deployment
Hosting: Render
MCP Server URL:
https://expense-manager-mcp.onrender.com/mcpDatabase: Neon PostgreSQL
Protocol: MCP over Streamable HTTP
The MCP server is hosted on Render, so you don't need to clone the repository or install Python dependencies to connect your AI assistant.
Simply use the MCP URL above when configuring your connector.
๐ Connect to Your AI Assistant
1. Connect with Claude
You can connect Smart Expense to Claude using a custom connector.
Open Claude.
Navigate to Settings โ Connectors.
Select Add custom connector.
Enter the following details:
Name:
Smart ExpenseMCP Server URL:
https://expense-manager-mcp.onrender.com/mcpSave the connector.
Enable Smart Expense for your conversation.
Start chatting!
Try this prompt:
Add a โน200 coffee expense today, paid by cash.Claude will connect to your deployed MCP server and use its available tools.
Claude Desktop โ Alternative Configuration
You can also configure the MCP server through Claude Desktop's configuration file.
Open claude_desktop_config.json and add:
{
"mcpServers": {
"smart-expense-mcp": {
"url": "https://expense-manager-mcp.onrender.com/mcp"
}
}
}Save the configuration and restart Claude Desktop.
2. Connect with ChatGPT
ChatGPT supports custom remote MCP apps through Developer Mode on supported plans and workspaces.
Follow these steps:
Step 1: Enable Developer Mode
Open ChatGPT.
Navigate to Settings โ Apps & Connectors โ Advanced Settings.
Enable Developer Mode, if available.
Step 2: Create a Custom App
Open the Apps section.
Select Create.
Choose the option to create a custom app or connector.
Step 3: Enter MCP Details
Use the following configuration:
App Name:
Smart ExpenseMCP Server URL:
https://expense-manager-mcp.onrender.com/mcpSave and create the app.
ChatGPT will discover the tools exposed by the MCP server.
Step 4: Start Using Smart Expense
Open a new conversation.
Select the
+button.Open More and select Smart Expense.
Start interacting with your expense management server.
Try this prompt:
Show my quick stats for this month.ChatGPT will use the connected MCP tools to retrieve the relevant information.
Note: Developer Mode and custom MCP app availability depend on your ChatGPT plan and workspace settings. The exact interface may vary.
โ ๏ธ Important: Current Multi-User Limitation
Please read this before using the application with real financial data.
Currently, Smart Expense uses a shared database.
This means:
All connected users access the same Neon PostgreSQL database.
User-level data isolation has not yet been implemented.
Expenses and financial records are not independently separated for each user.
Different users may be able to access or modify records belonging to others.
Planned improvement:
Implement proper multi-user authentication and database-level user isolation so that every user can access only their own expenses, friends, budgets, events, and financial records.
Until this improvement is implemented and verified, this deployment should be treated as a development/demo application.
Do not use it for confidential or sensitive financial information.
๐ ๏ธ Local Development
If you want to run or modify the server yourself:
Prerequisites
Python 3.10+
Neon PostgreSQL database
Git
Installation
Clone the repository:
git clone https://github.com/<your-username>/expense-agent.git
cd expense-agentInstall dependencies:
uv syncConfigure the database connection and other required environment variables according to the project's configuration.
Run the MCP server:
uv run python src/server.pyThe server will start locally.
Use the local MCP endpoint configured by your FastMCP server when connecting your development assistant.
โ๏ธ Deployment Architecture
Smart Expense uses the following architecture:
Claude / ChatGPT
|
|
MCP Protocol
|
|
Render Web Service
|
|
FastMCP Server
|
|
Application Services
|
|
Neon PostgreSQL
|
|
Persistent DatabaseTechnology Stack
Technology | Purpose |
Python | Backend development |
FastMCP 3.4.4+ | MCP server and tool integration |
Pydantic 2 | Data validation and schemas |
Neon PostgreSQL | Hosted relational database |
Render | Application hosting |
openpyxl | Excel report generation |
python-dateutil | Date handling |
๐ Project Structure
expense-agent/
โ
โโโ src/
โ โโโ server.py # FastMCP entry point
โ โโโ config.py # Constants and configuration
โ โ
โ โโโ database/
โ โ โโโ db.py # Database connection manager
โ โ โโโ models.py # Database table definitions
โ โ โโโ migrations.py # Database migrations and seeds
โ โ
โ โโโ schemas/
โ โ โโโ expense.py # Expense schemas
โ โ โโโ category.py # Category schemas
โ โ โโโ splitwise.py # Friends and event schemas
โ โ โโโ analytics.py # Analytics response schemas
โ โ
โ โโโ services/
โ โ โโโ expense_service.py # Expense CRUD and filtering
โ โ โโโ analytics_service.py # Summaries and budgets
โ โ โโโ split_service.py # Friend balances and splits
โ โ โโโ settlement_service.py # Settlement algorithm
โ โ
โ โโโ tools/
โ โโโ expense_tools.py # Expense MCP tools
โ โโโ category_tools.py # Category MCP tools
โ โโโ analytics_tools.py # Analytics and budgets
โ โโโ splitwise_tools.py # Friend and balance tools
โ โโโ event_tools.py # Event and group tools
โ โโโ search_tools.py # Search, stats and reports
โ
โโโ reports/ # Generated reports (local)๐ MCP Tools Reference
Expense Tools
Tool | Description |
| Add an expense with full metadata |
| Get an expense by ID |
| Update expense information |
| Soft-delete an expense |
| Restore a deleted expense |
| Filter expenses using 15+ dimensions |
Category Tools
create_category ยท update_category ยท delete_category ยท list_categories ยท create_subcategory ยท move_subcategory
Analytics Tools
expense_summary ยท monthly_summary ยท yearly_summary ยท payment_summary ยท budget_summary ยท set_budget
Recurring Tools
add_recurring ยท list_recurring ยท process_recurring
Splitwise Tools
add_friend ยท list_friends ยท record_balance ยท settle ยท friend_summary ยท overall_balance
Event Tools
create_event ยท add_event_member ยท add_event_expense ยท event_summary ยท close_event
Search & Report Tools
search_expenses ยท quick_stats ยท generate_csv ยท generate_excel
๐งฎ Settlement Algorithm
Smart Expense uses a Greedy Two-Pointer Algorithm to minimize the number of transactions required to settle group debts.
Example:
Suppose:
A owes B โน100.
B owes C โน100.
A naive settlement would be:
A โ B : โน100
B โ C : โน100But the optimized settlement is:
A โ C : โน100Instead of two transactions, only one transaction is required.
The algorithm works by separating people with positive and negative balances, sorting them, and repeatedly settling the smaller outstanding amount.
Ask your assistant:
Explain the settlement algorithm with an example.๐ฆ Dependencies
Main dependencies:
fastmcp>=3.4.4
pydantic>=2.0
openpyxl
python-dateutilAdditional PostgreSQL driver and database dependencies are managed through the project's dependency configuration.
๐ Data & Privacy
Smart Expense uses Neon PostgreSQL as its hosted database.
Important considerations:
Database credentials should be stored in environment variables.
Never commit
.envfiles or database credentials to GitHub.Keep database connection strings private.
Use appropriate database backups and access controls.
Do not expose sensitive financial information through public deployments.
Multi-user data isolation is not implemented yet.
The current deployment is intended for development and demonstration until proper user authentication and data isolation are implemented.
๐ Future Improvements
User authentication and authorization.
Individual user-level database isolation.
Secure multi-user expense management.
Improved recurring expense automation.
Advanced spending insights and AI recommendations.
More detailed financial reports.
Improved dashboard and visualization support.
๐ License
MIT License โ see LICENSE for details.
Built with โค๏ธ using FastMCP, Python, and Neon PostgreSQL.
Available Tools
38 toolsadd_event_expenseA
Add an expense to a group event and compute per-member splits.
split_type options: "equal" โ split evenly among all members (or included_member_ids) "percentage" โ supply split_data={"friend_id": percent, ...} summing to 100 "custom" โ supply split_data={"friend_id": amount, ...} summing to total
Returns the computed split immediately so you can verify it.
Example: Hotel โน4000 paid by Neev, split equally among 4 friends: โ each owes โน1000
Inputs: title (required), amount (required), event_id (required), paid_by_friend_id (required), +3 more. Returns: object
add_event_memberC
Add a friend to an existing event.
Inputs: event_id (required), friend_id (required). Returns: object
add_friendC
Add a friend to track balances with.
Inputs: name (required), email, phone. Returns: object
add_recurringA
Add a recurring expense that auto-creates entries when due. frequency: 'daily' | 'weekly' | 'monthly' | 'yearly' next_due_date: YYYY-MM-DD
Examples: Netflix monthly โน199, Gym monthly โน1500, Rent monthly โน8000
Inputs: title (required), amount (required), frequency (required), next_due_date (required), +2 more. Returns: object
budget_summaryB
Budget vs actual for all categories with budgets set. Returns alert level: ๐ข ok / ๐ก warning (โฅ80%) / ๐ด danger (โฅ100%)
Inputs: year (required), month (required). Returns: result
close_eventA
Mark an event as closed (all expenses settled).
Inputs: event_id (required). Returns: object
create_categoryB
Create a new top-level expense category. Example: name='Fashion', icon='๐'
Inputs: name (required), icon. Returns: object
create_eventC
Create a group event for expense splitting. member_ids: list of friend IDs to add as participants.
Example: "Girnar Trip" with Rahul (id=1), Prince (id=2), Jay (id=3)
Inputs: title (required), end_date, member_ids, start_date, +1 more. Returns: object
create_expenseC
Add a new expense.
Examples:
"โน450 at Domino's for dinner, paid via UPI, category Food"
"Flight ticket โน3500 for Rahul, category Travel"
Inputs: title (required), amount (required), expense_date (required), tags, +9 more. Returns: object
create_subcategoryA
Add a subcategory to an existing category. Example: category_id=1, name='Biryani'
Inputs: name (required), category_id (required). Returns: object
delete_categoryA
Delete a category. Subcategories are removed automatically (CASCADE).
Inputs: category_id (required). Returns: object
delete_expenseA
Soft-delete an expense (can be restored later with restore_expense). The record stays in the database with is_deleted=1.
Inputs: expense_id (required). Returns: object
event_summaryA
Complete event summary including:
All expenses
Per-member net balances
Minimum settlement transactions (who pays whom, how much)
This uses the greedy two-pointer algorithm to minimize the number of transactions.
Inputs: event_id (required). Returns: object
expense_summaryA
Category-wise spending summary. Leave year/month empty for all-time totals.
Inputs: year, month. Returns: result
explain_settlement_algorithmA
Explains how the minimal debt settlement algorithm works. Great for learning and interview preparation!
Inputs: no named parameters. Returns: result
friend_summaryB
Net balance summary with a specific friend. Returns: who owes whom, and by how much.
Inputs: friend_id (required). Returns: object
generate_csvA
Export all expenses for a given month as a CSV string. The CSV is also saved to the /reports/ directory.
Inputs: year (required), month (required). Returns: result
generate_excelA
Export all expenses for a given month to an Excel file (.xlsx). Returns the file path.
Inputs: year (required), month (required). Returns: result
get_expenseA
Get full details of a single expense by ID.
Inputs: expense_id (required). Returns: object
list_categoriesA
List all categories with their subcategories.
Inputs: no named parameters. Returns: result
list_eventsB
List all events (active and closed).
Inputs: no named parameters. Returns: result
list_expensesA
List expenses with powerful multi-dimensional filtering.
Examples:
"All food expenses in July 2026" โ month=7, year=2026, category_id=<food_id>
"UPI expenses above โน500 this month" โ payment_method='UPI', min_amount=500
"Expenses at Domino's" โ merchant='Domino'
"Expenses for Girnar trip" โ event_id=<event_id>
Inputs: tags, year, month, notes, +12 more. Returns: result
list_friendsA
List all friends.
Inputs: no named parameters. Returns: result
list_recurringB
List all active recurring expenses.
Inputs: no named parameters. Returns: result
monthly_summaryA
Full monthly report: total, by category (with %), by payment method, top merchant. Example: year=2026, month=7
Inputs: year (required), month (required). Returns: object
move_subcategoryC
Move a subcategory to a different parent category.
Inputs: subcategory_id (required), new_category_id (required). Returns: object
overall_balanceA
Net balance summary across ALL friends. Shows total receivable (others owe you) and total payable (you owe others).
Inputs: no named parameters. Returns: object
payment_summaryB
Breakdown of spending by payment method (UPI, Cash, Card, etc.).
Inputs: year, month. Returns: result
process_recurringA
Process all overdue recurring expenses โ creates actual expense entries for each one and updates next_due_date. Call this daily or at server startup.
Inputs: no named parameters. Returns: object
quick_statsA
Dashboard-style overview: this month's total, category breakdown, and overall balance. Perfect for "Give me a financial overview" or "How am I doing this month?"
Inputs: no named parameters. Returns: object
record_balanceA
Record a money exchange with a friend.
direction options: "i_paid" โ I paid for them โ they owe me โนamount "they_paid" โ They paid for me โ I owe them โนamount
Examples:
"Rahul owes me โน500 for recharge" โ direction='i_paid', friend_id=Rahul's id
"I paid โน120 for Prince for chai" โ direction='i_paid', friend_id=Prince's id
"Jay paid โน200 for my food at Domino's" โ direction='they_paid', friend_id=Jay's id
Inputs: amount (required), direction (required), friend_id (required), reason, +1 more. Returns: object
restore_expenseB
Restore a previously deleted expense.
Inputs: expense_id (required). Returns: object
search_expensesA
Natural language expense search.
Claude should use this when the user asks conversational questions about their spending.
Examples: "How much did I spend on food this month?" "Show me Domino's expenses" "All UPI payments above โน500 in June" "What did I spend at Girnar trip?" "Show my expensive purchases in 2026"
Returns both the matching expenses AND a quick summary (total, count, avg).
Inputs: query (required), tags, year, month, +6 more. Returns: object
set_budgetC
Set or update a spending budget for a category in a specific month/year.
Inputs: year (required), month (required), amount (required), category_id (required). Returns: object
settleA
Mark balances with a friend as settled. If amount is given, settle exactly that much; otherwise settle everything.
Inputs: friend_id (required), amount. Returns: object
update_categoryC
Rename a category or change its icon.
Inputs: category_id (required), icon, name. Returns: object
update_expenseC
Update specific fields of an expense. Only supply what you want to change.
Inputs: expense_id (required), tags, notes, title, +6 more. Returns: object
yearly_summaryC
Month-by-month spending breakdown for an entire year.
Inputs: year (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 38 tools
Each tool serves a distinct purpose: CRUD operations for expenses, categories, friends, events, recurring expenses, plus various summaries and reports. Even overlapping tools like list_expenses and search_expenses have clear differentiators (structured filtering vs natural language). No ambiguity between tools.
Most tools follow a consistent verb_noun pattern (e.g., add_event_expense, list_expenses, create_category). Summary tools use a noun_summary pattern (e.g., budget_summary, monthly_summary), which is also consistent. Minor exceptions like quick_stats (should be get_quick_stats) and settle (verb only) slightly break the pattern, but overall naming is predictable.
With 38 tools, the set is quite large for an expense management server. While each tool has a specific role, the abundance of summary/report tools (8+) and separate list/search functions suggests some redundancy. A more streamlined set (25-30) could reduce cognitive load without losing functionality.
The tool surface covers core CRUD for expenses, categories, friends, events, and recurring expenses, along with settlement, budget tracking, and export features. Notable gaps: missing update/delete for friends, events, and recurring expenses, but these can be worked around. Overall, the essential workflows are supported.
Maintenance
Related MCP Connectors
Personal finance for AI agents โ onboard, import statements, categorize & budget over MCP.
Split bills and collect payments through PayNow (Singapore) from your AI. MCP server for SplitBill.
Hosted MCP server for AI-driven data ops. Create apps, manage schemas, and CRUD structured data.
Log, query, and edit expenses, budgets, and accounts in Manilo from any MCP-compatible AI assistant.
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server for Splitwise that enables users to manage shared expenses, friends, and groups directly through AI assistants. It allows for creating, deleting, and listing expenses while providing tools to track net balances and group debts.8721 npmMIT
- FlicenseNot gradedqualityCmaintenanceA cloud-deployed MCP server for managing personal expenses and providing financial analytics. It enables AI assistants like Claude Desktop to add, update, delete, and retrieve expenses, with features like budgeting assistance and category-wise summaries.-
- AlicenseNot gradedqualityDmaintenanceA production-grade MCP server for personal finance management, enabling AI agents to add, update, search expenses, manage budgets and credit cards, and generate financial reports.2MIT
- FlicenseNot gradedqualityDmaintenanceAI-powered expense tracking MCP server that connects LLM clients to PostgreSQL for natural language expense management.-