Skip to main content
Glama
Sharan0402

Expense Tracker MCP Server

by Sharan0402
models.py1.32 kB
"""Data models for expense tracker.""" from dataclasses import dataclass from typing import Optional @dataclass class Receipt: """Represents a parsed receipt.""" store_name: str purchase_date: str # ISO format: YYYY-MM-DD total: float subtotal: Optional[float] = None tax: Optional[float] = None def __post_init__(self): """Validate receipt data.""" if self.total <= 0: raise ValueError("Total must be positive") @dataclass class LineItem: """Represents a single item from a receipt.""" item_name_raw: str item_type: str line_total: float quantity: float = 1.0 unit_price: Optional[float] = None def __post_init__(self): """Calculate unit price if not provided.""" if self.unit_price is None and self.quantity > 0: self.unit_price = self.line_total / self.quantity if self.line_total <= 0: raise ValueError("Line total must be positive") if self.quantity <= 0: raise ValueError("Quantity must be positive") @dataclass class ItemStats: """Statistics for a specific item type.""" item_type: str total_purchases: int last_purchase_date: str first_purchase_date: str total_spent: float average_days_between: Optional[float] = None

Implementation Reference

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Sharan0402/expense-tracker-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server