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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。