Expense Tracker MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add -e "SUPABASE_URL=${SUPABASE_URL}" -e "SUPABASE_KEY=${SUPABASE_KEY}" -e "GOOGLE_API_KEY=${GOOGLE_API_KEY}" expense-tracker -- python "<FULL_PATH_TO_EXPENSE_TRACKER_MCP>/dist/index.js"

Replace <FULL_PATH_TO_EXPENSE_TRACKER_MCP>/dist/index.js with the actual folder you prepared in step 1.

Required:SUPABASE_URLSUPABASE_KEYGOOGLE_API_KEY
README.md

AI-powered expense tracking system with natural language interface

Expense Tracker Backend

AI-powered expense tracking system with natural language interface, intelligent categorization, and real-time sync.

Architecture

The system uses a two-server architecture:

  1. MCP Server: Core expense tracking tools exposed via Model Context Protocol
  2. Gemini AI Server: FastAPI server providing chat interface with authentication

Features

  • šŸ¤– Natural language expense management via Gemini AI
  • 🧠 Intelligent categorization using embeddings and similarity search
  • šŸ” JWT authentication with Supabase
  • šŸ“Š Hierarchical categories for organization
  • šŸ·ļø Predefined tag system
  • šŸ“ˆ Real-time data sync
  • šŸ”„ Learning system that improves over time

Quick Start

Prerequisites

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Environment Setup

cp .env.example .env
# Add your credentials:
# - SUPABASE_URL
# - SUPABASE_KEY
# - GOOGLE_API_KEY (for Gemini)

Database Setup

Execute the SQL scripts in your Supabase SQL Editor:

# Core tables
scripts/create_tables.sql
# Embeddings support
scripts/create_embeddings_schema.sql

Run Both Servers

Terminal 1 - MCP Server:

python run_mcp.py

Terminal 2 - Gemini AI Server:

uvicorn app.servers.gemini.main:app --reload --port 8000

Initialize Data

# Populate categories
python scripts/populate_hierarchical_categories.py

# Populate predefined tags
python scripts/populate_predefined_tags.py

API Endpoints

Chat Interface

  • POST /chat - Send natural language commands
  • POST /auth/refresh - Refresh JWT token

MCP Tools (via chat)

  • Create expenses from natural language
  • Auto-categorize transactions
  • Get spending summaries
  • Analyze subscriptions
  • View recent transactions

Flutter Client

refer https://github.com/keyurgit45/expense-tracker-client

Testing

# Run all tests with mocks
ENVIRONMENT=test pytest tests/ -v

# Run specific components
ENVIRONMENT=test pytest tests/test_mcp_tools.py -v
ENVIRONMENT=test pytest tests/test_categorization.py -v

Project Structure

backend/
ā”œā”€ā”€ app/
│   ā”œā”€ā”€ core/              # Business logic
│   ā”œā”€ā”€ servers/
│   │   ā”œā”€ā”€ gemini/       # AI chat server
│   │   └── mcp/          # MCP tool server
│   └── shared/           # Shared configs
ā”œā”€ā”€ scripts/              # Utilities
└── tests/               # Test suite

AI Categorization

The system uses a hybrid approach:

  1. Generates embeddings for transactions using Sentence Transformers
  2. Finds similar past transactions using pgvector
  3. Uses weighted voting to predict categories
  4. Falls back to rule-based matching
  5. Learns from user confirmations

Development

  • API docs: http://localhost:8000/docs
  • Frontend integration: Configure CORS in Gemini server
  • MCP tools can be tested directly via chat interface

Tools (4)

create_expenseCreate expenses from natural language input
get_spending_summaryGenerate spending summaries for a specific period
analyze_subscriptionsAnalyze recurring subscriptions and expenses
view_recent_transactionsRetrieve a list of recent financial transactions

Environment Variables

SUPABASE_URLrequiredURL for the Supabase database instance
SUPABASE_KEYrequiredAPI key for Supabase authentication
GOOGLE_API_KEYrequiredAPI key for accessing Gemini AI services

Configuration

claude_desktop_config.json
{"mcpServers": {"expense-tracker": {"command": "python", "args": ["/path/to/expense-tracker-mcp/run_mcp.py"]}}}

Try it

→Add an expense for $15 at Starbucks for coffee.
→What is my total spending summary for this month?
→Analyze my current subscriptions and identify any I might want to cancel.
→Show me my last 5 transactions.

Frequently Asked Questions

What are the key features of Expense Tracker MCP?

Natural language expense management via Gemini AI. Intelligent categorization using embeddings and similarity search. Hierarchical categories for financial organization. Real-time data synchronization. Learning system that improves categorization accuracy over time.

What can I use Expense Tracker MCP for?

Quickly logging daily expenses using natural language commands. Automating the categorization of transactions to save time on manual entry. Identifying recurring subscription costs to optimize monthly spending. Generating periodic financial summaries to track budget adherence.

How do I install Expense Tracker MCP?

Install Expense Tracker MCP by running: python3 -m venv venv && source venv/bin/activate && pip install -r requirements.txt

What MCP clients work with Expense Tracker MCP?

Expense Tracker MCP works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Expense Tracker MCP docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare