š MCP Server - Personal Expense Manager
An MCP (Model Context Protocol) server for managing and analyzing personal expenses from CSV files.
š Features
Add expenses to a CSV file with categorization
Get recent expenses with day-based filtering
MCP Resource for direct access to all expenses
Specialized prompt that generates automatic analytical summaries
Analysis by category and payment method
Trend detection and spending patterns
š Requirements
šļø Project Structure
š ļø Installation & Usage
1. Clone or create the project
2. Create virtual environment (recommended)
3. Install dependencies
4. Run the server
š§ Available Functionalities
Tools
1. agregar_gasto (Add Expense)
Adds a new expense to the system.
Parameters:
fecha: Date in 'YYYY-MM-DD' formatcategoria: Expense category (e.g., "Food", "Transport")cantidad: Expense amount (float)metodo_pago: Payment method used
Example:
2. obtener_gastos_recientes (Get Recent Expenses)
Gets expenses from the last N days.
Parameters:
dias: Number of days to query (default: 5)
Example:
Resource
resource://gastos
Direct access to all stored expenses.
Specialized Prompt
Resumen de Gastos Recientes (Recent Expenses Summary)
Generates a prompt with structured data for AI to create a complete analysis including:
š Statistical calculations (totals, averages)
š·ļø Category analysis
š³ Payment method distribution
š Trend identification
š” Personalized recommendations
š CSV Structure
The data/expenses.csv file has the following structure:
š MCP Client Integration
Python Client Example
šÆ Use Cases
1. Daily Expense Tracking
2. Weekly Analysis
3. Monthly Report
š Example Generated Analysis
The specialized prompt generates analysis like:
š ļø Troubleshooting
Error: "FileNotFoundError"
Ensure the
data/directory existsServer creates the file automatically with the first expense
Error: "Encoding issues"
Server uses UTF-8 for special character compatibility
Error: "Invalid date format"
Use exact format:
YYYY-MM-DDExample:
2024-01-18
š License
MIT License
š Support
For issues and questions, open a ticket in the project repository.
Start tracking your expenses intelligently! š