ExpenseTracker MCP服务器
使用FastMCP构建的模型上下文协议(MCP)服务器,用于高效管理和跟踪费用。
📋 概述
这是一个基于FastMCP的服务器,提供以下工具:
- 记录新支出
- 查看费用历史记录
- 生成费用汇总和分析
- 通过结构化界面管理财务数据
✨ 特性
可用工具
- 增加支出 -记录一项新的支出,包括详细信息(金额、类别、描述、日期)
- 列出费用 -使用筛选选项检索所有记录的费用
- 汇总费用 -按类别、日期范围或总费用获取摘要
🚀 入门指南
先决条件
- Python 3.10或更高版本
uv包管理器(UV工具)- FastMCP库
安装
- 克隆存储库:
git clone
cd ExpenceTracker-mcp-server- 安装依赖项:
uv sync运行服务器
使用紫外线(推荐)
uv run --with fastmcp fastmcp run main.py直接执行Python
python main.py📁 项目结构
ExpenceTracker-mcp-server/
├── main.py # Main server entry point
├── pyproject.toml # Project configuration and dependencies
├── README.md # This file
└── __pycache__/ # Python cache directory🔧 配置
服务器运行在 stdio 默认情况下传输,可以在MCP客户端的配置文件中配置:
{
"mcpServers": {
"Demo Server": {
"command": "C:\\Users\\SUNIL\\AppData\\Local\\Programs\\Python\\Python310\\Scripts\\uv.exe",
"args": [
"run",
"--with",
"fastmcp",
"fastmcp",
"run",
"E:\\POC_DEC_2025\\MCP_2025\\12TH_DEC_MCP\\ExpenceTracker-mcp-server\\main.py"
],
"transport": "stdio"
}
}
}📝 使用示例
添加费用
Tool: Add Expense
Parameters:
- amount: 50.00
- category: "Food"
- description: "Lunch"
- date: "2025-12-13"列出所有费用
Tool: List Expenses
Parameters:
- category: (optional filter)
- date_from: (optional filter)获取摘要
Tool: Summarize Expenses
Parameters:
- group_by: "category" | "date"🛠️ 发展
项目依赖项
看 pyproject.toml 完整列表:
- fastmcp
- 指定的其他依赖关系
添加新工具
要添加新工具,请修改 main.py:
@server.tool()
def your_new_tool(parameter: str) -> str:
"""Tool description"""
return "result"📤 部署
推送到Git
- 初始化存储库:
git init- 阶段和提交更改:
git add .
git commit -m "Initial commit: ExpenseTracker MCP Server"- 创建要素分支:
git checkout -b feature/expense-tracker- 添加远程存储库:
git remote add origin - 按到遥控器:
git push -u origin feature/expense-tracker🤝 贡献
- 为您的功能创建新分支
- 进行更改
- 以明确的信息提交
- 推到您的分支
- 创建拉取请求
📞 支持
对于问题或疑问:
- 检查GitHub上的现有问题
- 创建具有详细描述的新问题
- 包括错误消息和日志
📄 许可证
\[在此处添加您的许可证\]
👤 作者
\[苏尼尔·蒂特\] \[sthite175@gmail.com\]
