Expense Tracker MCP Server
README.md
# Expense Tracker MCP Server
A local Model Context Protocol (MCP) server for a personal Expense Tracker built with Python and SQLite3.
## Features
- `add_expense` — add an expense; decreases available credit
- `list_expenses` — list expenses (newest first), optionally filtered by category
- `summarize_expenses` — totals by category, count, credit added, and available credit
- `edit_expense` — edit an expense; adjusts credit by the difference in amount
- `delete_expense` — delete an expense; refunds the amount to credit
- `add_credit` — add credit to the available balance
All balance-changing operations run inside SQLite transactions.
## Folder structure
```
local MCP server/
├── main.py # MCP server + tool definitions (entry point)
├── expense_tracker/
│ ├── __init__.py
│ ├── database.py # SQLite connection + schema setup
│ └── operations.py # Core expense/credit business logic
├── pyproject.toml # Project config (fastmcp dependency)
├── uv.lock # Lockfile
└── README.md
```
The database file `expense_tracker.db` is created automatically on the first tool call.
## Installation
Clone the repo:
```powershell
git clone https://github.com/YogeshSharma2007/Local-Expense-tracker-MCP.git
cd Local-Expense-tracker-MCP
```
Create and activate a virtual environment:
```powershell
python -m venv .venv
.\.venv\Scripts\Activate.ps1
```
Install dependencies:
```powershell
uv sync # or: pip install -e .
```
## Run the server
```powershell
python main.py
```
Then register the server as a local MCP stdio server in your MCP client.
## Register with an MCP client (OpenCode example)
Add to your OpenCode config (`opencode.json` or wherever your client config lives):
```json
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"local-mcp": {
"type": "local",
"command": [
"<path-to-repo>\\.venv\\Scripts\\python.exe",
"<path-to-repo>\\main.py"
],
"enabled": true
}
}
}
```
Replace `<path-to-repo>` with the full path to wherever you cloned this repo, for example:
```
C:\Users\<your-username>\Documents\Local-Expense-tracker-MCP
```
## Configuration
The database path defaults to `expense_tracker.db` in the project folder. Override it with the environment variable:
```powershell
$env:EXPENSE_TRACKER_DB = "C:\path\to\expense_tracker.db"
```
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues