ExpenseTracker

ExpenseTracker

Enables users to manage personal financesโ€”tracking expenses, income, budgets, and generating summariesโ€”through natural language commands via AI assistants like Claude.

Category
Visit Server

README

๐Ÿ’ฐ Expense Tracker MCP v3

A multi-user AI-powered expense tracking server built with FastMCP + FastAPI + PostgreSQL. Users can manage finances using plain English with AI.

Works with:

  • ๐Ÿ–ฅ Claude Desktop
  • ๐Ÿ“ฑ Claude.ai Free (via N8N)
  • ๐ŸŒ Any HTTP client

โœจ Features

  • ๐Ÿ” JWT Authentication โ€“ secure multi-user system
  • ๐Ÿ‘ฅ Multi-user support โ€“ each user has isolated data
  • ๐Ÿงฐ 29 MCP tools for expenses, income, budgets and analytics
  • ๐ŸŒ Mobile friendly registration page
  • โ˜ Cloud deployable (Railway + Neon)
  • ๐Ÿค– AI integration with Claude
  • ๐Ÿ”„ Claude.ai free support using N8N bridge

๐Ÿ“ Project Structure

expense_tracker_v3/

โ”œโ”€โ”€ CORE
โ”‚   โ”œโ”€โ”€ main.py
โ”‚   โ”œโ”€โ”€ run.py
โ”‚   โ”œโ”€โ”€ app.py
โ”‚   โ”œโ”€โ”€ config.py
โ”‚   โ”œโ”€โ”€ context.py
โ”‚   โ”œโ”€โ”€ db.py
โ”‚   โ”œโ”€โ”€ init_db.py
โ”‚   โ”œโ”€โ”€ logger.py
โ”‚   โ”œโ”€โ”€ utils.py
โ”‚   โ””โ”€โ”€ create_user.py
โ”‚
โ”œโ”€โ”€ DATABASE
โ”‚   โ”œโ”€โ”€ schema.sql
โ”‚   โ””โ”€โ”€ categories.json
โ”‚
โ”œโ”€โ”€ API
โ”‚   โ””โ”€โ”€ api/
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ”œโ”€โ”€ auth.py
โ”‚       โ”œโ”€โ”€ middleware.py
โ”‚       โ””โ”€โ”€ server.py
โ”‚
โ”œโ”€โ”€ MCP TOOLS
โ”‚   โ””โ”€โ”€ tools/
โ”‚       โ”œโ”€โ”€ expense_tools.py
โ”‚       โ”œโ”€โ”€ income_tools.py
โ”‚       โ”œโ”€โ”€ budget_tools.py
โ”‚       โ”œโ”€โ”€ category_tools.py
โ”‚       โ”œโ”€โ”€ summary_tools.py
โ”‚       โ””โ”€โ”€ utility_tools.py
โ”‚
โ”œโ”€โ”€ FRONTEND
โ”‚   โ””โ”€โ”€ static/
โ”‚       โ””โ”€โ”€ register.html
โ”‚
โ”œโ”€โ”€ DEPLOYMENT
โ”‚   โ”œโ”€โ”€ Procfile
โ”‚   โ”œโ”€โ”€ pyproject.toml
โ”‚   โ””โ”€โ”€ requirements.txt
โ”‚
โ””โ”€โ”€ README.md

โš  Never commit .env to GitHub.


๐Ÿงฐ MCP Tools (29)

Expense Tools

  • add_expense
  • update_expense
  • delete_expense
  • list_expenses
  • get_expense_by_id

Income Tools

  • add_income
  • list_income
  • delete_income
  • monthly_income

Budget Tools

  • set_budget
  • get_budget
  • check_budget_status
  • delete_budget

Category Tools

  • get_categories
  • add_category
  • update_category
  • delete_category

Summary Tools

  • summarize_expenses
  • daily_summary
  • weekly_summary
  • monthly_summary
  • yearly_summary
  • category_breakdown
  • top_spending
  • compare_months
  • get_balance

Utility Tools

  • get_last_expenses
  • search_expenses
  • export_expenses_csv

๐Ÿ—„ Database Schema

users
 id
 username
 password
 created_at

categories
 id
 name

expenses
 id
 user_id
 date
 amount
 category_id
 note

income
 id
 user_id
 date
 amount
 source

budgets
 id
 user_id
 category_id
 monthly_limit

All queries automatically filter:

WHERE user_id = current_user

Each user has completely isolated data.


๐Ÿš€ Local Setup

1๏ธโƒฃ Clone Repository

git clone https://github.com/parnajaswanth227/Expense_Tracker_With_Claude.git
cd Expense_Tracker_With_Claude

2๏ธโƒฃ Create Python Environment

uv init
uv venv --python 3.12
.venv\Scripts\activate

Windows users:

$env:UV_LINK_MODE="copy"

3๏ธโƒฃ Install Dependencies

uv add fastmcp fastapi uvicorn psycopg[binary] python-dotenv python-jose bcrypt
uv pip install -r requirements.txt

4๏ธโƒฃ Create .env

Create a .env file in the root folder.

DATABASE_URL=postgresql://user:pass@host/dbname?sslmode=require
SECRET_KEY=your_secret_key_here
ALLOW_REGISTRATION=true
ACCESS_TOKEN_EXPIRE_MINUTES=525600

Generate a secret key:

python -c "import secrets; print(secrets.token_hex(32))"

5๏ธโƒฃ Start Server

uv run python run.py

Server runs at:

http://localhost:8000

๐Ÿ”‘ API Endpoints

Method Endpoint Description
GET /health Server status
GET /register Signup page
POST /auth/register Create user
POST /auth/token Login
POST /mcp MCP endpoint

โ˜ Cloud Deployment

Step 1: Create PostgreSQL Database

Go to:

https://neon.tech

Create database and copy connection string.


Step 2: Deploy on Railway

Go to:

https://railway.app

Create project โ†’ Deploy from GitHub.

Railway will automatically use:

web: uvicorn api.server:app --host 0.0.0.0 --port $PORT

Add environment variables:

Variable Value
DATABASE_URL Neon database URL
SECRET_KEY generated secret
ALLOW_REGISTRATION true
ACCESS_TOKEN_EXPIRE_MINUTES 525600

Step 3: Verify Deployment

https://your-app.railway.app/health

Expected response:

{"status":"ok"}

๐Ÿ–ฅ Using with Claude Desktop

Install MCP server:

uv run fastmcp install claude-desktop main.py

Manual configuration:

%APPDATA%\Claude\claude_desktop_config.json
{
 "mcpServers": {
   "ExpenseTracker": {
     "command": "npx",
     "args": [
       "-y",
       "mcp-remote@latest",
       "https://your-app.railway.app/mcp",
       "--header",
       "Authorization: Bearer YOUR_TOKEN"
     ]
   }
 }
}

๐Ÿ“ฑ Using Claude.ai Free (Mobile + Web)

Claude free plan does not support MCP connectors directly. We use an N8N workflow bridge.

N8N Architecture

Claude AI
   โ†“
N8N Webhook
   โ†“
Expense Tracker MCP
   โ†“
PostgreSQL Database

Setup N8N

Step 1: Create Account

https://n8n.io

Create account.


Step 2: Create Workflow

Click:

New Workflow

Step 3: Import Workflow JSON

Click:

โ‹ฎ โ†’ Import from JSON

Paste provided workflow.


Step 4: Add Token

Replace:

YOUR_JWT_TOKEN_HERE

with your token.


Step 5: Activate Workflow

Click Activate.

You will receive webhook URL:

https://yourname.app.n8n.cloud/webhook/expense-tracker

Connect N8N to Claude.ai

  1. Open Claude.ai
  2. Go to:
Settings โ†’ Connectors
  1. Select N8N
  2. Paste your webhook URL.

Claude can now control your expense tracker.


Example Commands

Users can ask Claude:

Add expense โ‚น500 for lunch today
Show my expenses this month
Add โ‚น50,000 salary income
Show my balance
Check my budget

Claude will automatically call MCP tools.


๐Ÿ‘ฅ Multi-User Flow

User opens /register
      โ†“
Creates username & password
      โ†“
Receives JWT token
      โ†“
Token used in
 - Claude Desktop
 - N8N workflow
 - API calls

Each user has separate database data.


๐Ÿ”ง Admin Create Users

python create_user.py --username alice --password pass123

Disable public signup:

ALLOW_REGISTRATION=false

๐Ÿ› Troubleshooting

Error Solution
401 Unauthorized Token expired
Database error Check DATABASE_URL
MCP session error Restart server
N8N webhook error Check workflow JSON

๐Ÿ” Security

Never commit:

.env
JWT tokens
database credentials

Rotate tokens if exposed.


๐Ÿ“ฆ Tech Stack

Layer Technology
MCP Framework FastMCP
API FastAPI
Database PostgreSQL
Cloud DB Neon
Deployment Railway
Automation N8N
AI Client Claude

โญ Project Goal

Create a fully AI-powered personal finance assistant where users manage expenses using natural language with Claude AI.


If you'd like, I can also help add:

  • ๐Ÿงญ Architecture diagrams
  • ๐Ÿ“ธ Screenshots
  • ๐Ÿ”„ Workflow diagrams
  • ๐Ÿท GitHub badges
  • ๐ŸŽฌ Animated demo

to make your GitHub repository look like a professional open-source project.

๐Ÿ“ธ Screenshots

screenshorts\Screenshot 2026-03-14 113116.png

๐Ÿ’ป Web Dashboard โ€“ Expense Summary

The AI assistant analyzes your expenses and presents a clear financial overview including income, spending distribution, and balance.

<p align="center"> <img src="screenshots/claude_desktop.png" width="800"> </p> Features shown:

  • Total income, expenses, and balance
  • Category-wise spending breakdown
  • Interactive spending chart
  • AI-generated financial insights

Example insight:

You've spent โ‚น2,000 across 3 transactions. Food is the dominant category at 85% (โ‚น1,700). With โ‚น60,000 income, you're saving 96.7% โ€” a healthy balance of โ‚น58,000.


๐Ÿ“ฑ Claude AI Mobile โ€“ Natural Language Expense Entry

C:\Users\parna\Videos\expense_tracker_v3\screenshorts\WhatsApp Image 2026-03-14 at 11.33.34 AM.jpeg Users can add expenses using natural language with AI. <p align="center"> <img src="screenshots/webapp.jpeg" width="800"> </p> Example command:

Add an expense 210 rs for petrol for my bike

Claude automatically:

  1. Detects the transport category
  2. Calls the add_expense MCP tool
  3. Stores the expense in the database
  4. Returns confirmation with details

Claude AI Expense Entry

Returned response includes:

  • Expense ID
  • Amount
  • Category
  • Note
  • Date

This demonstrates how users can manage finances conversationally with AI.

๐ŸŒ Live Demo

The project is deployed on Railway Cloud.

๐Ÿ“ User Registration Page

Create a new account:

https://web-production-d3df0.up.railway.app/register

This page allows users to:

  • Create a username
  • Set a password
  • Generate a JWT token for authentication

๐Ÿ”Œ MCP Server Endpoint

Main MCP endpoint used by Claude and N8N:

https://web-production-d3df0.up.railway.app/mcp

This endpoint handles:

  • MCP tool execution
  • AI requests from Claude
  • Automation requests from N8N workflows

๐Ÿงช Health Check (Optional)

Check if the server is running:

https://web-production-d3df0.up.railway.app/health

Expected response:

{"status":"ok"}

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured