Skip to main content
Glama

MCP Agent - AI Expense Tracker

by dev-muhammad
seed_data.py•5.5 kB
#!/usr/bin/env python3 """Seed the database with sample transaction data""" from datetime import datetime, timedelta from models import TransactionCreate, TransactionType, Category from store import TransactionStore def seed_database(): """Populate database with sample transactions""" store = TransactionStore() # Sample income transactions income_transactions = [ { "title": "Monthly Salary", "amount": 5000.00, "type": TransactionType.INCOME, "category": Category.SALARY, "description": "Monthly salary payment", "tags": ["salary", "monthly"], "date": datetime.now() - timedelta(days=5) }, { "title": "Freelance Project", "amount": 1500.00, "type": TransactionType.INCOME, "category": Category.FREELANCE, "description": "Web development project", "tags": ["freelance", "web-dev"], "date": datetime.now() - timedelta(days=10) }, { "title": "Stock Dividends", "amount": 250.00, "type": TransactionType.INCOME, "category": Category.INVESTMENT, "description": "Quarterly dividends", "tags": ["stocks", "passive-income"], "date": datetime.now() - timedelta(days=15) }, ] # Sample expense transactions expense_transactions = [ { "title": "Grocery Shopping", "amount": 150.00, "type": TransactionType.EXPENSE, "category": Category.FOOD, "description": "Weekly groceries at Whole Foods", "tags": ["groceries", "food"], "date": datetime.now() - timedelta(days=2) }, { "title": "Monthly Rent", "amount": 1800.00, "type": TransactionType.EXPENSE, "category": Category.HOUSING, "description": "Apartment rent payment", "tags": ["rent", "housing"], "date": datetime.now() - timedelta(days=1) }, { "title": "Uber Rides", "amount": 45.00, "type": TransactionType.EXPENSE, "category": Category.TRANSPORTATION, "description": "Ride sharing", "tags": ["uber", "transport"], "date": datetime.now() - timedelta(days=3) }, { "title": "Electric Bill", "amount": 120.00, "type": TransactionType.EXPENSE, "category": Category.UTILITIES, "description": "Monthly electricity bill", "tags": ["utilities", "bills"], "date": datetime.now() - timedelta(days=7) }, { "title": "Netflix Subscription", "amount": 15.99, "type": TransactionType.EXPENSE, "category": Category.ENTERTAINMENT, "description": "Monthly streaming subscription", "tags": ["entertainment", "subscription"], "date": datetime.now() - timedelta(days=12) }, { "title": "New Laptop", "amount": 1200.00, "type": TransactionType.EXPENSE, "category": Category.SHOPPING, "description": "MacBook Pro purchase", "tags": ["electronics", "work"], "date": datetime.now() - timedelta(days=20) }, { "title": "Online Course", "amount": 99.00, "type": TransactionType.EXPENSE, "category": Category.EDUCATION, "description": "Python programming course", "tags": ["education", "programming"], "date": datetime.now() - timedelta(days=14) }, { "title": "Doctor Visit", "amount": 75.00, "type": TransactionType.EXPENSE, "category": Category.HEALTHCARE, "description": "Annual checkup", "tags": ["health", "medical"], "date": datetime.now() - timedelta(days=8) }, { "title": "Restaurant Dinner", "amount": 85.00, "type": TransactionType.EXPENSE, "category": Category.FOOD, "description": "Dinner with friends", "tags": ["dining", "social"], "date": datetime.now() - timedelta(days=4) }, { "title": "Gas Station", "amount": 55.00, "type": TransactionType.EXPENSE, "category": Category.TRANSPORTATION, "description": "Fuel refill", "tags": ["gas", "car"], "date": datetime.now() - timedelta(days=6) }, ] # Create all transactions print("🌱 Seeding database with sample data...") for txn_data in income_transactions + expense_transactions: txn = store.create(TransactionCreate(**txn_data)) print(f"āœ… Created: {txn.title} - ${txn.amount}") # Display summary summary = store.get_summary() print("\nšŸ“Š Database Summary:") print(f" Total Income: ${summary['total_income']:.2f}") print(f" Total Expenses: ${summary['total_expenses']:.2f}") print(f" Net Balance: ${summary['net_balance']:.2f}") print(f" Total Transactions: {summary['transaction_count']}") print("\n✨ Database seeding completed successfully!") if __name__ == "__main__": seed_database()

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/dev-muhammad/MCPAgent'

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