Skip to main content
Glama
Smart Expense Management MCP

Smart Expense Management MCP

by neev-25

๐Ÿ’ฐ 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 (.xlsx)


๐Ÿš€ Live Deployment

Hosting: Render

MCP Server URL:

https://expense-manager-mcp.onrender.com/mcp

Database: 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.

  1. Open Claude.

  2. Navigate to Settings โ†’ Connectors.

  3. Select Add custom connector.

  4. Enter the following details:

    Name:

    Smart Expense

    MCP Server URL:

    https://expense-manager-mcp.onrender.com/mcp
  5. Save the connector.

  6. Enable Smart Expense for your conversation.

  7. 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

  1. Open ChatGPT.

  2. Navigate to Settings โ†’ Apps & Connectors โ†’ Advanced Settings.

  3. Enable Developer Mode, if available.

Step 2: Create a Custom App

  1. Open the Apps section.

  2. Select Create.

  3. Choose the option to create a custom app or connector.

Step 3: Enter MCP Details

Use the following configuration:

App Name:

Smart Expense

MCP Server URL:

https://expense-manager-mcp.onrender.com/mcp
  1. Save and create the app.

  2. ChatGPT will discover the tools exposed by the MCP server.

Step 4: Start Using Smart Expense

  1. Open a new conversation.

  2. Select the + button.

  3. Open More and select Smart Expense.

  4. 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+

  • uv

  • Neon PostgreSQL database

  • Git

Installation

Clone the repository:

git clone https://github.com/<your-username>/expense-agent.git

cd expense-agent

Install dependencies:

uv sync

Configure the database connection and other required environment variables according to the project's configuration.

Run the MCP server:

uv run python src/server.py

The 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 Database

Technology 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

create_expense

Add an expense with full metadata

get_expense

Get an expense by ID

update_expense

Update expense information

delete_expense

Soft-delete an expense

restore_expense

Restore a deleted expense

list_expenses

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 : โ‚น100

But the optimized settlement is:

A โ†’ C : โ‚น100

Instead 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-dateutil

Additional 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 .env files 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 tools
add_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

    B3.4/5.0

    Scored across 38 tools

    Disambiguation5/5

    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.

    Naming Consistency4/5

    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.

    Tool Count3/5

    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.

    Completeness4/5

    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

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      An 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.
      8
      721 npm
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      A 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.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      A 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.
      2
      MIT