Expense Tracker MCP Server
Authenticates users through Google OAuth: the MCP client's OAuth flow is proxied to Google, and the returned Google token is verified to extract the user's email, automatically provisioning an isolated expense-tracker account (with default categories) for each authenticated Google user.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Expense Tracker MCP ServerAdd 450 for dinner under Food and check my Food budget this month"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Expense Tracker MCP Server
A powerful, highly detailed MCP (Model Context Protocol) server that exposes a full-featured personal expense tracker to any MCP-compatible AI client โ including Claude Desktop, Claude Code, and the MCP Inspector.
Manage your finances through natural language directly in your AI assistant. Add, edit, delete, and query expenses; set monthly budgets; and generate comprehensive spending reports seamlessly.
๐ Key Features
๐ธ Natural Language Expense Management: Add, list, edit, and delete expenses effortlessly using AI prompts (e.g., "I just spent 500 on dinner, add it to Food").
๐๏ธ Intelligent Categorization: Group expenses into categories. Automatically provisions default categories (Food, Transport, Utilities, Entertainment, Shopping) on user signup.
๐ฐ Proactive Budgeting: Set per-category or overall monthly spending limits. Get overspend warnings directly in your AI chats.
๐ Advanced Analytics & Reporting: View monthly summaries with month-over-month (MoM) spending comparisons and percentage changes.
๐ Data Export: Generate full expense reports exported as Markdown or CSV strings right in your AI assistant's context.
๐ Contextual Resources: Expose read-only MCP resources for browsing expenses and budget statuses (e.g.
expenses://month/2026-07).โ๏ธ Cloud-Native Storage: Uses PostgreSQL for robust, ACID-compliant data storage. Fully prepared for SSE-based cloud deployment.
๐ Secure OAuth Authentication: Uses Google OAuth for seamless and secure user authentication. Automatically provisions isolated accounts for each user, ensuring your financial data remains private and strictly sandboxed.
Related MCP server: ExpenseTracker MCP Server
๐๏ธ Architecture & Stack
Framework: Built on FastMCP, a modern declarative framework for writing MCP servers in Python.
Database: PostgreSQL via the
asyncpgdriver for high-performance, async database operations. Schema migrations execute automatically and idempotently on server startup.Authentication Flow:
The MCP Client initializes the connection.
The server requests OAuth authentication via FastMCP's
OAuthProxy.The user logs in via Google OAuth.
The
DatabaseGoogleTokenVerifierintercepts the Google token, extracts the email, and gracefully provisions a new user record in the PostgreSQL database if they don't exist.Subsequent tool calls securely map to that specific user's
user_id.
Database Schema
The PostgreSQL database enforces strong relational integrity. All financial amounts are stored safely as integer cents to avoid floating-point math errors.
users: Stores OAuth-provisioned accounts with a securetoken_hashandsalt.categories: User-specific expense categories (Unique peruser_id+name).expenses: Individual transactions linking auser_id,category_id,amount_cents, andexpense_date.budgets: Monthly limits (overall or category-specific) tracked byYYYY-MM.
๐ Getting Started
Prerequisites
Python 3.13+
uv (Extremely fast Python package installer and resolver)
PostgreSQL database (Local, Docker, or managed cloud like Neon or Supabase)
Google Cloud Console account (for setting up OAuth Credentials)
1. Installation
git clone <repo-url>
cd expense-tracker-mcp-server
uv sync2. Google OAuth Setup
Go to the Google Cloud Console.
Create a new project (or use an existing one).
Navigate to APIs & Services > Credentials.
Click Create Credentials > OAuth client ID.
Choose Web application.
Set the Authorized redirect URIs to your deployed server URL (or
http://localhost:8000/callbackif testing locally via SSE).Copy your Client ID and Client Secret.
3. Environment Configuration
Copy the .env.example file to .env and configure your environment:
cp .env.example .envVariable | Requirement | Default | Description |
| Required | None | Postgres connection string (e.g. |
| Required | None | Your Google OAuth Client ID |
| Required | None | Your Google OAuth Client Secret |
| Optional |
| Google Auth endpoint |
| Optional |
| Google Token endpoint |
| Optional |
| Default currency formatting (e.g., USD, EUR, GBP) |
4. Running the Server Locally
# Run over STDIO (Standard input/output) โ For direct Claude Desktop integration
uv run python -m expense_tracker_mcp_server
# Or use the installed CLI script
uv run expense-tracker-mcp
# Development mode with the web-based MCP Inspector UI
uv run fastmcp dev inspector src/expense_tracker_mcp_server/server.py๐ค Claude Desktop Configuration
To use this server with Claude Desktop over STDIO, add it to your claude_desktop_config.json file.
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"Expense Tracker": {
"command": "uv",
"args": [
"run",
"--directory",
"/absolute/path/to/expense-tracker-mcp-server",
"expense-tracker-mcp"
],
"env": {
"DATABASE_URL": "postgresql://user:pass@localhost:5432/expenses",
"EXPENSE_DEFAULT_CURRENCY": "USD"
}
}
}
}Note: OAuth is typically used for Cloud/SSE deployments. For local STDIO usage, FastMCP may skip authentication depending on the client setup.
Restart Claude Desktop after saving the configuration. The expense tracker tools will appear in the tools panel (the hammer icon).
๐ ๏ธ MCP Capabilities Reference
Available Tools
Tool | Parameters | Description |
|
| Add a new expense (date defaults to today). |
|
| List expenses for a specific month (format: |
|
| Edit an existing expense record. |
|
| Permanently delete an expense record. |
| โ | List all available categories. |
|
| Set a monthly spending limit (overall or per category). |
|
| Show spending vs budget limits with percentage utilized. |
|
| Get a monthly summary with category breakdown & MoM comparison. |
|
| Export a full report as a formatted Markdown or CSV string. |
Available Resources
URI Template | Description |
| Read-only view of all expenses for a month (e.g. |
| Read-only view of budget status for a specific month |
| Read-only list of all available expense categories |
๐ฌ Example AI Prompts
Once connected to your AI assistant, try asking:
"List my expense categories."
"I just paid my electric bill. Add an expense of $120 to Utilities."
"Set an overall monthly budget of $2000 for this month."
"Show me my budget status for this month. Am I close to my limit in any category?"
"Give me a summary of my spending for July 2026. How does it compare to June?"
"Export my expense report for this month as a CSV so I can put it in Excel."
โ๏ธ Cloud Deployment
This server is fully prepared for cloud deployment using Server-Sent Events (SSE) transport over HTTP.
Docker Deployment (Render, Fly.io, Railway, etc.)
The included Dockerfile starts the FastMCP server over SSE transport on port 8000.
To deploy, link your GitHub repository to your cloud provider (like Render), and they will automatically build and run the Docker image.
Critical Deployment Steps:
Set the
DATABASE_URLenvironment variable to your production PostgreSQL connection string.Set your
OAUTH_CLIENT_IDandOAUTH_CLIENT_SECRETenvironment variables.Update your Google OAuth Credentials in the Cloud Console to include your deployed URL as an Authorized redirect URI (e.g.,
https://your-app.onrender.com/callback).
FastMCP Cloud
If deploying via the fastmcp CLI (e.g., to Prefect Horizon), the project is already configured in fastmcp.json to use sse transport on port 8000.
๐งช Development & Testing
We use pytest for unit testing. The test suite is configured to automatically provision and drop a fresh database schema for isolated testing.
Make sure you have set TEST_DATABASE_URL in your .env file before running tests.
# Run all tests with verbose output
uv run pytest tests/ -v๐ License
This project is licensed under the MIT License โ see the LICENSE file for details.
This server cannot be deployed
Maintenance
Related MCP Connectors
Personal-finance workspace for AI agents: accounts, spending, budgets, goals, and investments.
Personal finance ledger for AI agents โ query spending, track bills, forecast cash flow.
- Era ContextOAuthapp.era
Personal finance, bank account, and shared memory connector for Claude, ChatGPT, Gemini Spark & more
Track expenses from your AI chat: log, categorize, monthly CSV reports. All data is local.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceEnables AI agents to manage personal expenses through natural language conversations. Supports adding, searching, and analyzing transactions with automatic categorization and financial insights.3MIT
- FlicenseCqualityDmaintenanceEnables AI assistants to manage personal finances by storing, analyzing, and exporting expense data using a persistent PostgreSQL database. Supports adding/editing expenses, generating spending summaries, detecting top categories, and creating monthly reports.12-
- AlicenseNot gradedqualityBmaintenanceManage your finances through natural language directly in your AI assistant. Add, edit, delete, and query expenses; set monthly budgets; and generate comprehensive spending reports seamlessly.1MIT
- AlicenseAqualityBmaintenanceEnables AI assistants to securely manage and analyze personal finances through natural language, with full control over data via a private PostgreSQL database.12MIT