Expense Tracker MCP Server
An MCP server that enables any MCP-compatible client to add, list, and summarize expenses through natural conversation, using FastMCP and aiosqlite for async database operations.
README
Building My Own MCP Server (Expense Tracker)
Most of my MCP work so far has been connecting to servers from LangGraph agents. This project is the other side: an MCP server built from scratch with FastMCP, so any MCP-compatible client can add, list, and summarize expenses through natural conversation.
What it exposes
Tools:
add_expense(date, amount, category, subcategory="", note="")— inserts a new expense row and returns the new row's idlist_expenses(start_date, end_date)— returns all expenses in an inclusive date range, most recent firstsummarize(start_date, end_date, category=None)— aggregates total spend and entry count per category over a date range, optionally filtered to one category
Resource:
expense:///categories— exposes the available expense categories as JSON, so a client can validate a category before callingadd_expense. Falls back to a sensible default category list ifcategories.jsonis missing.
How it's built
- FastMCP (
mcp.tool()/mcp.resource()decorators) turns plain async functions into MCP-discoverable tools — no manual schema wiring needed, the docstring and type hints are enough for a client to know how to call them. - aiosqlite for all runtime queries, so the server doesn't block while reading/writing the database — consistent with the async patterns I've used across the LangGraph chatbot and MCP client projects.
- Synchronous
sqlite3used once, at startup only —init_db()creates the table (withPRAGMA journal_mode=WALfor safer concurrent access) and does a throwaway insert/delete to confirm the process actually has write access to the database file before the server starts accepting requests. - Database stored in the OS temp directory (
tempfile.gettempdir()) rather than a fixed path, so the server works regardless of where it's deployed or who's running it, without permission issues. - Runs over streamable HTTP (
mcp.run(transport="http", ...)), so it can be reached remotely — this is the same server referenced as the"expense"MCP connection in my LangGraph + MCP client project and the RAG-enabled chatbot platform.
There's also a small proxy.py, which exposes the same remote server over stdio instead — useful for MCP clients (like Claude Desktop) that expect a local stdio-based server rather than a remote HTTP URL.
What building the server side (not just the client side) clarified
Connecting to MCP servers made them feel like a black box with a protocol I had to satisfy. Building one showed that an MCP tool is genuinely just an async Python function with a docstring and typed parameters — FastMCP's job is making that function discoverable and callable by any compliant client, not adding complexity to the function itself. The interesting engineering is still normal backend concerns: database access patterns, concurrency (WAL mode), and graceful fallbacks (the categories resource, the write-access check at startup).
Tools
Python, FastMCP, aiosqlite, SQLite (WAL mode)
What I'd build next
- Connect this server directly into my persistent LangGraph chatbot platform, so "how much did I spend on food last month?" is answerable in an ongoing conversation instead of a one-off script
- Add an
update_expense/delete_expensetool — right now entries can only be added, not corrected - Add input validation on
categoryagainst the categories resource, instead of accepting any string
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.