Skip to main content
Glama
SyedSarimAbbas

Expense_Tracker_MCP

README.md
# ๐Ÿ’ฐ Expense Tracker MCP

## ๐Ÿค– AI-Powered Expense Management using Model Context Protocol

<p align="center"> </p> <p align="center"> <img src="https://img.shields.io/badge/Python-3.13-blue?style=for-the-badge&logo=python"/> <img src="https://img.shields.io/badge/FastMCP-3.4.4-purple?style=for-the-badge"/> <img src="https://img.shields.io/badge/MongoDB-Database-green?style=for-the-badge&logo=mongodb"/> <img src="https://img.shields.io/badge/FastAPI-Backend-009688?style=for-the-badge&logo=fastapi"/> </p>

---

# ๐Ÿ“Œ Overview

Expense Tracker MCP is an **AI-powered financial management system** built using**Model Context Protocol (MCP )**.

The system allows Large Language Models to interact with expense data throughMCP tools, enabling users to:

- Add expenses

- Search expenses

- Analyze spending patterns

- Generate financial insights

- Communicate with expense data using natural language

---

# ๐Ÿง  MCP Architecture

```mermaid
flowchart TB


USER["๐Ÿ‘ค User"]

CLIENT["๐Ÿ”Œ MCP Client"]

SERVER["โšก FastMCP Server"]

TOOLS["๐Ÿ›  MCP Tools"]

FASTAPI["๐Ÿš€ FastAPI Application"]

MONGO["๐Ÿƒ MongoDB Database"]



USER --> CLIENT

CLIENT --> SERVER

SERVER --> TOOLS

TOOLS --> FASTAPI

FASTAPI --> MONGO
```

# ๐Ÿš€ Key Features

๐Ÿ’ธ Expense Managementโœ… Create expensesโœ… Update expensesโœ… Delete expensesโœ… Retrieve expense recordsโœ… Store financial history

๐Ÿ”Œ Model Context Protocol

This project implements MCP architecture:

User|MCP Client|FastMCP Server|Expense Tools|MongoDB

## ๐Ÿ› ๏ธ Technology Stack

###๐Ÿ Core Development

<p align="center"> <img src="https://skillicons.dev/icons?i=python"/> </p>
Python >= 3.13
Setuptools
Wheel

### โšก MCP Framework

<img src="https://img.shields.io/badge/FastMCP-3.4.4-purple?style=flat-square">
MCP Server implementation
Tool registration
LLM communication layer

### ๐Ÿš€ Backend

<p align="center"> <img src="https://skillicons.dev/icons?i=fastapi"/> </p>
FastAPI
Uvicorn
REST APIs

### ๐Ÿƒ Database

<p align="center"> <img src="https://skillicons.dev/icons?i=mongodb"/> </p>
MongoDB
PyMongo
Motor Async Driver

### ๐Ÿ“ฆ Validation & Configuration

Pydantic v2Pydantic SettingsEnvironment Variablespython-dotenv

## ๐Ÿ“‚ Project Structure

```
Expense_Tracker/
โ”‚
โ”œโ”€โ”€ app/
โ”‚   โ””โ”€โ”€ db/
โ”‚       โ”œโ”€โ”€ database.py       # MongoDB connection configurations & client initialization
โ”‚       โ””โ”€โ”€ application.py    # Core FastAPI application routing and logic
โ”‚
โ”œโ”€โ”€ mcp/
โ”‚   โ”œโ”€โ”€ mcp_client.py         # MCP Client implementation for context bridging
โ”‚   โ””โ”€โ”€ mcp_server.py         # FastMCP Server registering the operational tools
โ”‚
โ”œโ”€โ”€ .env                      # Local environment variable configuration
โ”œโ”€โ”€ .gitignore                # Specified version control exclusions (e.g., venv, __pycache__ )
โ”œโ”€โ”€ .python-version           # Explicit python version pinning
โ”œโ”€โ”€ pyproject.toml            # Project metadata, dependencies, and editable tool configurations
โ””โ”€โ”€ README.md                 # System documentation## โš™๏ธ Installation
```

Clone repository:

```
git clone https://github.com/YOUR_USERNAME/Expense-Tracker-MCP.git

cd Expense-Tracker-MCP

Install dependencies:

pip install -e .
```

## ๐Ÿ” Environment Configuration

```

Create .env


MONGODB_URI=your_mongodb_connection_string

DATABASE_NAME=expense_tracker
```

โ–ถ๏ธ Running Application

### Start MCP Server

-expense-server

or

```
python mcp_server.py
```

## ๐ŸŒ Remote MCP Server

This project also provides a remote MCP server that users can connect to:[https://expense-tracker-01.fastmcp.app/mcp](https://expense-tracker-01.fastmcp.app/mcp)

## API Documentation:

```
http://localhost:8000/docs
```

## ๐Ÿ”ฎ Future Improvements

-Expense prediction using ML-Budget recommendation engine-Voice-based expense entry-Multi-user authentication-React dashboard-Cloud deployment-Mobile application

## ๐Ÿ‘จโ€๐Ÿ’ป Developer

Sarim Abbas

AI Engineer | Backend Developer | Agentic AI Developer

<p align="center"> <img src="https://skillicons.dev/icons?i=python,fastapi,mongodb,docker,aws"/> </p>

โญ Star this repository if you find it useful!