🚀 LunchMoney MCP 服務器
LunchMoney MCP 服務器是一個針對 LunchMoney 的模型上下文協議(MCP)服務器實現,它通過 LunchMoney 的 API 為個人財務管理提供了編程式訪問方式。藉助該服務器,用戶可以利用程序自動化地進行財務洞察分析、交易管理、預算規劃等操作。
🚀 快速開始
若要使用此 MCP 服務器與任何兼容 MCP 的客戶端(如 Claude Desktop)進行交互,你需要將其添加到客戶端的配置中。
配置
服務器可以在你的 MCP 客戶端配置文件中進行配置。具體位置和格式可能因客戶端而異,但通常遵循以下模式:
{
"mcpServers": {
"lunchmoney": {
"command": "npx",
"args": ["@akutishevsky/lunchmoney-mcp"],
"env": {
"LUNCHMONEY_API_TOKEN": "your-api-token-here"
}
}
}
}
請將 "your-api-token-here" 替換為你從 LunchMoney 開發者設置 獲取的實際 LunchMoney API 令牌。
常見 MCP 客戶端配置位置
不同的 MCP 客戶端將其配置存儲在不同的位置:
- Claude Desktop:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
- Linux:
~/.config/Claude/claude_desktop_config.json
- 其他 MCP 客戶端:請查看客戶端文檔以獲取配置文件的位置。
設置步驟
- 找到你的 MCP 客戶端配置文件(如果不存在則創建)。
- 將 LunchMoney 服務器配置添加到
mcpServers 部分。
- 保存文件並重啟 MCP 客戶端。
- 此時,LunchMoney 工具應已在你的客戶端中可用。
要求
- 系統中安裝了 Node.js 16 或更高版本。
- 系統路徑中可使用
npx。
- 擁有具有適當權限的有效 LunchMoney API 令牌。
作為獨立 MCP 服務器運行
LUNCHMONEY_API_TOKEN="your-api-token" npx @akutishevsky/lunchmoney-mcp
✨ 主要特性
全面的工具覆蓋
- 用戶管理 - 訪問用戶賬戶詳細信息。
- 類別管理 - 創建、更新和組織消費類別。
- 標籤管理 - 管理交易標籤。
- 交易管理 - 對交易進行完整的 CRUD 操作,並支持高級過濾。
- 定期項目管理 - 跟蹤和管理定期費用。
- 預算管理 - 按類別創建和監控預算。
- 資產跟蹤 - 跟蹤手動管理的資產。
- Plaid 賬戶管理 - 管理連接的銀行賬戶。
- 加密貨幣管理 - 跟蹤加密貨幣持有量。
關鍵能力
- 與 LunchMoney API v1 完全集成。
- 使用 TypeScript 和 Zod 驗證實現類型安全。
- 模塊化架構,便於擴展。
- 使用標準輸入輸出傳輸實現標準 MCP 服務器。
💻 使用示例
基礎用法
以下是一些可以與 LunchMoney MCP 服務器一起使用的示例提示:
# 賬戶概述
- "Show me my LunchMoney account details"(顯示我的 LunchMoney 賬戶詳細信息)
- "What's my current account status?"(我當前的賬戶狀態如何?)
# 類別管理
- "List all my spending categories"(列出我所有的消費類別)
- "Create a new category called 'Subscriptions' with a monthly budget of $100"(創建一個名為 'Subscriptions' 的新類別,每月預算為 100 美元)
- "Show me details for my 'Food & Dining' category"(顯示我的 'Food & Dining' 類別的詳細信息)
- "Create a category group for all my entertainment expenses"(為我所有的娛樂費用創建一個類別組)
- "Delete the 'Unused Category' and reassign its transactions to 'Miscellaneous'"(刪除 'Unused Category' 類別,並將其交易重新分配到 'Miscellaneous' 類別)
# 交易管理
- "Show me all transactions from last month"(顯示我上個月的所有交易)
- "Find all transactions over $100 in the past week"(查找過去一週內超過 100 美元的所有交易)
- "Create a new expense for $45.99 at Amazon in the Shopping category"(在購物類別中創建一筆在亞馬遜的 45.99 美元新費用)
- "Update transaction #12345 to change the amount to $50"(將交易 #12345 的金額更新為 50 美元)
- "Show me all pending transactions"(顯示所有待處理的交易)
- "Group these coffee shop transactions together"(將這些咖啡店交易分組)
# 預算管理
- "Show me my budget summary for this month"(顯示我本月的預算摘要)
- "Set a budget of $500 for Groceries this month"(為本月的雜貨設定 500 美元的預算)
- "Remove the budget for Entertainment category"(移除娛樂類別的預算)
- "How much have I spent vs budgeted in each category?"(我在每個類別中的實際花費與預算相比如何?)
# 資產跟蹤
- "List all my assets"(列出我所有的資產)
- "Create a new asset for my savings account with a balance of $10,000"(為我的儲蓄賬戶創建一個餘額為 10,000 美元的新資產)
- "Update my investment account balance to $25,000"(將我的投資賬戶餘額更新為 25,000 美元)
# 定期費用管理
- "Show me all my recurring expenses"(顯示我所有的定期費用)
- "What subscriptions do I have?"(我有哪些訂閱服務?)
- "List recurring items for the next 3 months"(列出未來 3 個月的定期項目)
# 銀行集成
- "Show me all my connected Plaid accounts"(顯示我所有連接的 Plaid 賬戶)
- "Refresh my bank account data"(刷新我的銀行賬戶數據)
- "Trigger a sync for my checking account"(觸發我的支票賬戶同步)
# 加密貨幣管理
- "Show me all my crypto holdings"(顯示我所有的加密貨幣持有量)
- "Update my Bitcoin balance to 0.5 BTC"(將我的比特幣餘額更新為 0.5 BTC)
- "List all my manually tracked crypto assets"(列出我所有手動跟蹤的加密貨幣資產)
# 分析與洞察
- "What are my top spending categories this month?"(我本月的主要消費類別有哪些?)
- "Show me all transactions tagged as 'vacation'"(顯示所有標記為 'vacation' 的交易)
- "Find all transactions at coffee shops"(查找所有在咖啡店的交易)
- "List all transactions that need to be categorized"(列出所有需要分類的交易)
📚 詳細文檔
可用工具
| 工具類型 |
工具名稱 |
功能描述 |
| 用戶工具 |
get_user |
檢索當前用戶詳細信息 |
| 類別工具 |
get_all_categories |
列出所有消費類別 |
| 類別工具 |
get_single_category |
獲取特定類別的詳細信息 |
| 類別工具 |
create_category |
創建新類別 |
| 類別工具 |
create_category_group |
創建類別組 |
| 類別工具 |
update_category |
更新類別屬性 |
| 類別工具 |
add_to_category_group |
將類別添加到組中 |
| 類別工具 |
delete_category |
刪除類別 |
| 類別工具 |
force_delete_category |
強制刪除並清理數據 |
| 標籤工具 |
get_all_tags |
列出所有可用標籤 |
| 交易工具 |
get_transactions |
列出具有廣泛過濾選項的交易 |
| 交易工具 |
get_single_transaction |
獲取詳細的交易信息 |
| 交易工具 |
create_transactions |
創建新交易 |
| 交易工具 |
update_transaction |
更新現有交易 |
| 交易工具 |
unsplit_transactions |
從拆分組中移除交易 |
| 交易工具 |
get_transaction_group |
獲取交易組詳細信息 |
| 交易工具 |
create_transaction_group |
創建交易組 |
| 交易工具 |
delete_transaction_group |
刪除交易組 |
| 定期項目工具 |
get_recurring_items |
列出指定日期範圍內的定期項目 |
| 預算工具 |
get_budget_summary |
按日期範圍獲取預算摘要 |
| 預算工具 |
upsert_budget |
創建或更新預算金額 |
| 預算工具 |
remove_budget |
移除類別預算 |
| 資產工具 |
get_all_assets |
列出所有手動管理的資產 |
| 資產工具 |
create_asset |
創建新資產 |
| 資產工具 |
update_asset |
更新資產屬性 |
| Plaid 賬戶工具 |
get_all_plaid_accounts |
列出所有連接的 Plaid 賬戶 |
| Plaid 賬戶工具 |
trigger_plaid_fetch |
觸發從 Plaid 獲取最新數據 |
| 加密貨幣工具 |
get_all_crypto |
列出所有加密貨幣資產 |
| 加密貨幣工具 |
update_manual_crypto |
更新手動管理的加密貨幣餘額 |
🔧 技術細節
項目結構
lunchmoney-mcp/
├── src/
│ ├── index.ts # 服務器入口點
│ ├── config.ts # 配置管理
│ ├── types.ts # TypeScript 類型定義
│ └── tools/ # 工具實現
│ ├── user.ts
│ ├── categories.ts
│ ├── tags.ts
│ ├── transactions.ts
│ ├── recurring-items.ts
│ ├── budgets.ts
│ ├── assets.ts
│ ├── plaid-accounts.ts
│ └── crypto.ts
├── build/ # 編譯後的 JavaScript 輸出
├── package.json
├── tsconfig.json
└── README.md
構建項目
npm run build
添加新工具
- 在
src/tools/ 中創建一個新文件。
- 使用 MCP SDK 實現工具處理程序。
- 在
src/index.ts 中註冊工具。
- 如有需要,將類型添加到
src/types.ts 中。
📚 API 參考
服務器實現了完整的 LunchMoney API v1。有關詳細的 API 文檔,請參閱:
🤝 貢獻
歡迎貢獻代碼!請隨時提交拉取請求。
📄 許可證
本項目採用 MIT 許可證。