Skip to main content

💰 expense-mcp

Personal Expense Tracker as an MCP Server — works with Claude Desktop, Cursor, nanobot, Windsurf, and any MCP-compatible client.

Python MCP SDK License


Features

  • 📝 Track expenses & income with categories and descriptions
  • 📊 Spending summaries — today, week, month, year
  • 💳 Budget management — set limits per category, get alerts at 80%/100%
  • 🎯 Savings goals — create goals, track progress with visual bars
  • 📈 Spending insights — top categories, daily averages, biggest days
  • 🗑️ Safe deletion — Pydantic-based elicitation for confirmation
  • 🔄 Dual transport — stdio (local) + streamable HTTP (remote)

Install

# with uv (recommended)
uv pip install git+https://github.com/justfsl50/expense-mcp.git

# with pip
pip install git+https://github.com/justfsl50/expense-mcp.git

# from source
git clone https://github.com/justfsl50/expense-mcp.git
cd expense-mcp
pip install -e .

Quick Start

Claude Desktop

Add to %APPDATA%\Claude\claude_desktop_config.json (Windows) or ~/Library/Application Support/Claude/claude_desktop_config.json (Mac):

{
  "mcpServers": {
    "expense-mcp": {
      "command": "uv",
      "args": ["run", "expense-mcp"],
      "env": {
        "DATABASE_URL": "sqlite:///expenses.db",
        "CURRENCY": "₹",
        "DEFAULT_USER": "me"
      }
    }
  }
}

Cursor / Windsurf

Same config — paste into MCP settings under the respective app.

nanobot

{
  "mcp": {
    "servers": [{
      "name": "expense-mcp",
      "command": "uv run expense-mcp"
    }]
  }
}

HTTP mode (remote / multi-client)

python server.py http
# Server runs at http://127.0.0.1:8000/mcp

Environment Variables

Variable Default Description
DATABASE_URL sqlite:///expenses.db SQLite or PostgreSQL URL
CURRENCY ₹ Currency symbol
DEFAULT_USER default User ID for multi-user setups

PostgreSQL example:

DATABASE_URL=postgresql://user:pass@localhost:5432/expenses

Tools

Tool Description Read-only
expense_add Save expense or income ❌
expense_search Filter by text, date, category, amount ✅
expense_summary today / week / month / year totals ✅
expense_delete Delete with Pydantic confirmation prompt ❌
expense_insights Spending patterns and top categories ✅
budget_set Set monthly category budget ❌
budget_list View budgets with usage % ✅
goal_create Create savings goal ❌
goal_update Add money toward goal ❌
goal_list View goals with progress bars ✅

Resources

URI Description
expense://summary/month Current month summary
expense://budgets/current This month's budgets
expense://goals/all All savings goals

Prompts

Prompt Title Description
monthly_review Monthly Review Start a full month spending review
budget_setup Budget Setup Auto-suggest budgets from history
savings_plan Savings Plan Create a plan for a savings goal

Usage Examples

Just talk naturally in any MCP client:

"spent 500 on groceries"
"show food expenses this week"
"how much did I spend last month?"
"set food budget to 5000"
"am I within budget?"
"save 1000 toward my iPhone goal"
"give me spending insights"
"delete expense #12"

Architecture

  • MCP SDK v1.26.0 with FastMCP + json_response=True
  • Typed lifespan — DB engine managed via AppContext dataclass
  • SQLAlchemy 2.0 — DeclarativeBase, sessionmaker
  • Pydantic v2 — input validation, elicitation schemas
  • Tool annotations — readOnlyHint, destructiveHint, idempotentHint
  • Context logging — ctx.info(), ctx.warning() in tools

Database Schema

expenses  — id, user_id, amount, category, description, type, date, source, created_at
budgets   — id, user_id, category, amount, month
goals     — id, user_id, name, target, saved, deadline

License

MIT — free to use, modify, and distribute.

Metadata

Release files for expense-mcp 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for expense-mcp 1.0.1
File Size Uploaded Provenance Actions
expense_mcp-1.0.1.tar.gz 7.1 MB Without provenance Details for expense_mcp-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for expense-mcp 1.0.1
File Interpreter ABI Platform Actions
expense_mcp-1.0.1-py3-none-any.whl Python 3 none any Details for expense_mcp-1.0.1-py3-none-any.whl

Total release size: 14.2 MB

Release files / expense_mcp-1.0.1.tar.gz

Download URL expense_mcp-1.0.1.tar.gz
Size 7.1 MB
Tags Source
SHA-256 checksum
How to use checksums
5071f41ee34f00d84aa06400e6013f776c509dab7a4eae9d025eac3b0b6d920f
BLAKE2b-256 checksum
How to use checksums
b13651a3813e1f41f1ff3ac17d2e840f572b783fb7e9f452fe6eebd8ade39d6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / expense_mcp-1.0.1-py3-none-any.whl

Download URL expense_mcp-1.0.1-py3-none-any.whl
Size 7.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
aab813e4cce4b94f72bc91192b698c81a5a578d0f01d5eb863a20b48015b038d
BLAKE2b-256 checksum
How to use checksums
0f7ddda6a7aaa64473a369df07a397b74052cfbe8f0a3ba1f8ee87e3a4a2cf7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Security for expense-mcp 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page