Expense Tracker MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Expense Tracker MCP ServerAdd a $50 expense for groceries yesterday."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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.
Related MCP server: expense-tracker-mcp-server
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 correctedAdd input validation on
categoryagainst the categories resource, instead of accepting any string
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/zeeshanali45/Building-My-Own-MCP-Server-Expense-Tracker-'
If you have feedback or need assistance with the MCP directory API, please join our Discord server