Expense Tracker MCP Server

Expense Tracker MCP Server

An AI-native expense tracker MCP server that enables AI assistants to add and list expenses in a local SQLite database.

Category
访问服务器

README

💸 Expense Tracker MCP Server

<div align="center">

Python FastMCP SQLite UV License

A blazing-fast, AI-native Expense Tracker built as an MCP (Model Context Protocol) Server using FastMCP and SQLite.

Plug it directly into Claude Desktop, Cursor, or any MCP-compatible AI client — let your AI manage your finances for you.

</div>


📖 Table of Contents


🤖 What is MCP?

The Model Context Protocol (MCP) is an open standard by Anthropic that allows AI models (like Claude) to securely interact with external tools, APIs, and data sources. This project exposes expense-tracking capabilities as MCP tools, meaning you can literally tell Claude:

"Add an expense: Coffee, $4.50, Food & Drink, Cash, 2026-08-02"

...and it will call this server and record it in your local SQLite database — no UI needed.


✨ Features

  • 📝 Add Expenses — Record expenses with title, amount, category, payment method, date, and optional description
  • 📋 List Expenses — Retrieve all stored expenses as structured data
  • 🗄️ Persistent SQLite Storage — Auto-creates a local expenses.db database on first run
  • ⚡ FastMCP Powered — Minimal boilerplate, maximum capability
  • 🔍 Built-in Inspector — Visual tool inspector for debugging and testing
  • 🔌 MCP-Compatible — Works with Claude Desktop, Cursor, and any MCP client

📁 Project Structure

expense_tracker_mcp_server/
├── expense_mcp_server.py      # 🎯 Main MCP server — all tools defined here
├── pyproject.toml             # Project metadata & dependencies
├── uv.lock                    # Locked dependency versions
├── .python-version            # Python version pin
├── .gitignore                 # Git ignore rules
├── src/
│   └── expense_tracker_mcp_server/
│       └── __init__.py        # Package entry point
└── README.md                  # You are here!

🛠️ Prerequisites

Make sure you have the following installed:

  • Python 3.11+
  • pip (comes with Python)
  • uv — Fast Python package manager

🚀 Installation

Step 1 — Clone the Repository

git clone https://github.com/talha963/expense_mcp_server.git
cd expense_mcp_server

Step 2 — Install uv

pip install uv

Step 3 — Initialize the Project with uv

uv init .

Step 4 — Install FastMCP

# Via pip (global)
pip install fastmcp

# OR via uv (recommended — adds to project)
uv add fastmcp

Step 5 — Sync Dependencies

uv sync

▶️ Running the Server

Option 1 — Run directly with Python

python expense_mcp_server.py

Starts an HTTP server on http://0.0.0.0:8000

Option 2 — Run via uv

uv run expense_mcp_server.py

Option 3 — Run via FastMCP CLI (Recommended for MCP clients)

uv run --active fastmcp run expense_mcp_server.py

🔧 Available Tools

The server exposes the following MCP tools that AI models can call:

add_expense

Adds a new expense entry to the database.

Parameter Type Required Description
title string ✅ Name/title of the expense
amount float ✅ Amount spent (e.g. 12.50)
category string ✅ Category (e.g. Food, Transport)
payment_method string ✅ e.g. Cash, Card, Online
expense_date string ✅ Date in YYYY-MM-DD format
description string ❌ Optional notes about the expense

Example response:

{
  "success": true,
  "expense_id": 1,
  "message": "Expense added successfully."
}

list_expenses

Returns all recorded expenses from the database.

No parameters required.

Example response:

[
  {
    "id": 1,
    "title": "Coffee",
    "amount": 4.5,
    "category": "Food & Drink",
    "payment_method": "Cash",
    "expense_date": "2026-08-02",
    "description": "Morning coffee at the office"
  }
]

🖥️ Connecting to Claude Desktop

To use this server with Claude Desktop, add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "expense-tracker": {
      "command": "uv",
      "args": [
        "run",
        "--active",
        "fastmcp",
        "run",
        "/absolute/path/to/expense_mcp_server.py"
      ]
    }
  }
}

Config file location:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

After saving, restart Claude Desktop and the Expense Tracker tools will appear automatically.


🔍 Development & Inspection

Use the FastMCP Inspector to visually test and explore your tools in the browser:

uv run --active fastmcp dev expense_mcp_server.py

This opens an interactive web UI where you can:

  • See all registered tools
  • Call tools manually with test inputs
  • Inspect request/response payloads

🧰 Tech Stack

Technology Purpose
FastMCP MCP server framework
SQLite3 Lightweight persistent storage
uv Ultra-fast Python package manager
Python 3.11+ Runtime

👤 Author

Talha — @talha963


📄 License

This project is licensed under the MIT License — feel free to use, modify, and distribute.


<div align="center"> <sub>Built with ❤️ using FastMCP — making AI tool integration effortless.</sub> </div>

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选