Expense MCP README

The full upstream README, mirrored for reference. Install config, tool schemas, adoption signals and our own overview live on the Expense MCP listing page.

πŸ’° 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

bash
# 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):

config.json
{
  "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

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

HTTP mode (remote / multi-client)

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

Environment Variables

VariableDefaultDescription
DATABASE_URLsqlite:///expenses.dbSQLite or PostgreSQL URL
CURRENCYβ‚ΉCurrency symbol
DEFAULT_USERdefaultUser ID for multi-user setups

PostgreSQL example:

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

Tools

ToolDescriptionRead-only
expense_addSave expense or income❌
expense_searchFilter by text, date, category, amountβœ…
expense_summarytoday / week / month / year totalsβœ…
expense_deleteDelete with Pydantic confirmation prompt❌
expense_insightsSpending patterns and top categoriesβœ…
budget_setSet monthly category budget❌
budget_listView budgets with usage %βœ…
goal_createCreate savings goal❌
goal_updateAdd money toward goal❌
goal_listView goals with progress barsβœ…

Resources

URIDescription
expense://summary/monthCurrent month summary
expense://budgets/currentThis month's budgets
expense://goals/allAll savings goals

Prompts

PromptTitleDescription
monthly_reviewMonthly ReviewStart a full month spending review
budget_setupBudget SetupAuto-suggest budgets from history
savings_planSavings PlanCreate a plan for a savings goal

Usage Examples

Just talk naturally in any MCP client:

Code
"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

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