loading…
Search for a command to run...
loading…
Enables natural language expense logging, parsing amounts, currencies, and dates, and storing entries in an Excel file.
Enables natural language expense logging, parsing amounts, currencies, and dates, and storing entries in an Excel file.
Enterprise-grade documentation for a Python-based Model Context Protocol (MCP) expense tracking server.
⚠️ Proof of Concept (PoC)
This is a quick and dirty implementation based on frameworks and libraries available as of February 2026.
Behavior, APIs, and integration patterns may evolve in future versions of FastMCP, OpenAI Codex, and related tooling. This is just for demonstrative purposes
This project implements a local Model Context Protocol (MCP) server using Python and FastMCP.
📢 Educational Proof of Concept
This repository contains intentionally simple and demonstrative code designed to get started with MCP servers and understand how they work. The implementation prioritizes clarity and approachability over production-grade architecture, advanced patterns, or highly optimized design.
The server allows natural-language expense logging such as:
"I spent 20 dollars on a Batman figure yesterday"
The server:
This project demonstrates:
![]()
The solution consists of:
Transport Type: - STDIO (standard input/output)
Data Storage: - Excel file (expenses.xlsx)
Execution Model: - Event-driven tool invocation
The environment was configured using uv for fast dependency
management.
uv init
uv add fastmcp openpyxl dateparser pypandoc
This creates:
Package Purpose
fastmcp MCP server implementation openpyxl Excel read/write operations dateparser Natural language date parsing pypandoc Documentation generation re Regex amount parsing pathlib File handling datetime Timestamp management
project-root/
│
├── server.py
├── expenses.xlsx
├── README.md
└── .venv/
The server is initialized as:
mcp = FastMCP("expense-tracker")
Tools are registered using:
@mcp.tool
The server starts via:
if __name__ == "__main__":
mcp.run()
The server communicates using STDIO and must not print to stdout.
Extracts numeric amount using regex. Handles: - 12.000,16 - 12,000.16 - 12000
Returns:
float
Detects: - $ → USD - € → EUR - £ → GBP - keyword matches (dollars, euro, etc.)
Returns ISO currency code.
Uses:
dateparser.search.search_dates()
Configuration: - PREFER_DATES_FROM = "past" - RELATIVE_BASE = datetime.now() - RETURN_AS_TIMEZONE_AWARE = False
Returns:
YYYY-MM-DD
Fallback: - If no date detected → today
Combines: - amount - currency - date - description
Returns structured dictionary:
{
"amount": float,
"currency": str,
"date_iso": str,
"description": str
}
Excel file created if missing:
expenses.xlsx
Header structure:
["Date", "Description", "Amount", "Currency", "Raw Text", "Logged At"]
Append logic ensures: - Workbook exists - Correct sheet name - ISO timestamp logging
Read logic: - Dynamically maps header row - Avoids tuple index errors - Skips blank rows
.\.venv\Scripts\python.exe server.py
The process should remain running (stdio server).
Launch:
npx @modelcontextprotocol/inspector python server.py
Steps: 1. Open browser UI 2. View tools 3. Call log_expense 4. Call
list_expenses
"Connect to a custom MCP"
Select: - STDIO
Command to launch:
C:\Users\andre\Documents\Python\MCP\Python\Stdio Server\.venv\Scripts\python.exe
Arguments:
C:\Users\andre\Documents\Python\MCP\Python\Stdio Server\server.py
No environment variables required.
After saving: - Enable the MCP tool - Use in Codex chat:
Example:
Log this expense: I spent 50 dollars on groceries yesterday
Выполни в терминале:
claude mcp add expense-tracker -- npx Безопасность
Низкий рискАвтоматическая эвристика по публичным данным — не гарантия безопасности.