Skip to main content
Glama
Sanchit1403

Math I Choose to Ignore MCP Server

by Sanchit1403
README.md
#  Math I Choose to Ignore (MCP Server)

> *Because your bank account won't ignore it forever.*

**Math I Choose to Ignore** is an AI-powered expense tracking server built using the **Model Context Protocol (MCP)**. It connects LLM clients (like Claude Desktop) directly to your PostgreSQL database, transforming your AI assistant into a personal financial analyst that can track, categorize, summarize, and manage your spending through natural language.

---

##  Features

-  Natural Language Ledger: Add, edit, delete, and query your expenses just by chatting with Claude.
-  Robust PostgreSQL Integration: Uses strict financial schema design (`NUMERIC(10,2)` for currency precision, native `DATE` types, and `SERIAL` primary keys).
-  Safe Dynamic Querying: Built-in SQL injection prevention using parameterized queries and dynamic condition building.
-  Built with FastMCP: Exposes both **MCP Tools** (for database actions) and **MCP Resources** (for read-only context like expense categories).
-  Isolated Environment: Clean dependency management using `uv`.

---

##  Tech Stack

- **Language:** Python
- **MCP Framework:** `fastmcp`
- **Database:** PostgreSQL (`psycopg` / `psycopg2`)
- **Package Manager:** `uv`

---

##  Getting Started

### 1. Prerequisites
- [Python 3.10+](https://www.python.org/)
- [uv](https://github.com/astral-sh/uv) package manager
- [PostgreSQL](https://www.postgresql.org/) installed and running
- [Claude Desktop](https://claude.ai/download) (for client integration)

### 2. Installation & Setup

Clone the repository and install dependencies:

``` powershell
git clone [https://github.com/yourusername/math-i-choose-to-ignore.git](https://github.com/yourusername/math-i-choose-to-ignore.git)
cd math-i-choose-to-ignore
uv venv
uv sync
```

---

### Database Configuration

```
 DB_URL = "dbname=yourdbname user=yourusername password=yourpassword host=localhost port=5432"
```
---

##  Testing with MCP Inspector

```
uv run fastmcp dev inspector main.py
```
---

##  Claude Desktop Integration

```
%APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "Math I Choose to Ignore": {
      "command": "C:\\Users\\YourUsername\\.local\\bin\\uv.exe",
      "args": [
        "--directory",
        "C:\\Users\\YourUsername\\Desktop\\MCP\\math_i_choose_to_ignore",
        "run",
        "--with",
        "fastmcp",
        "fastmcp",
        "run",
        "C:\\Users\\YourUsername\\Desktop\\MCP\\math_i_choose_to_ignore\\main.py"
      ]
    }
  }
}
```
Important: After updating the JSON file, fully quit Claude Desktop from your Windows system tray and restart it.

---

##  Available MCP Tools And Resources

###  Tools (Actions)
| Tool | Description |
| :--- | :--- |
| `add_expense` | Adds a new expense with date, amount, category, subcategory, and optional notes. |
| `list_exp` | Lists all expenses within an inclusive `YYYY-MM-DD` date range. |
| `summarize` | Groups and sums expenses by category over a date range (optional category filter). |
| `edit_exp` | Updates an existing expense amount or record. |
| `delete_exp` | Safely removes an expense entry from the ledger. |

###  Resources (Read-Only Context)
| Resource URI | Description |
| :--- | :--- |
| `expense://categories` | Exposes standard budget categories from a local JSON file so the AI knows valid categorization options. |