Lunch Money MCP Server
Lunch Money MCP 服务器
一个 模型上下文协议 (MCP) 服务器,使 AI 智能体能够与您的 Lunch Money 个人财务数据进行交互。
功能
此 MCP 服务器提供了 15 个用于管理财务数据的工具:
用户与账户
get_user— 获取您的个人资料和账户信息
类别
get_categories— 列出所有类别(扁平或嵌套)create_category— 创建新的自定义类别update_category— 修改现有类别
交易
get_transactions— 使用过滤器(日期范围、类别、状态等)查询交易create_transaction— 添加新交易(单笔或批量最多 500 笔)update_transaction— 更新交易或将其拆分为多个条目
资产与账户
get_assets— 列出手动管理的资产create_asset— 添加新的手动资产get_plaid_accounts— 列出已连接 Plaid 的银行账户trigger_plaid_fetch— 触发 Plaid 账户同步
预算与规划
get_budgets— 查看任何日期范围内的预算和支出upsert_budget— 设置或更新预算金额get_recurring_items— 查看定期支出和收入
标签
get_tags— 列出所有交易标签
Related MCP server: LunchMoney MCP Server
先决条件
安装
选项 1:克隆并构建(本地 stdio 传输)
适用于 Cursor、Claude Desktop 或其他基于 stdio 的 MCP 客户端的本地使用:
# Clone the repository
git clone https://github.com/yourusername/lunchmoney-mcp.git
cd lunchmoney-mcp
# Install dependencies
npm install
# Build the TypeScript
npm run build选项 2:Cloudflare Workers(远程 HTTP 传输)
部署为可通过 HTTP 访问的远程 MCP 服务器:
# Clone the repository
git clone https://github.com/yourusername/lunchmoney-mcp.git
cd lunchmoney-mcp
# Install dependencies
npm install
# Set your API key as a secret
npx wrangler secret put LUNCH_MONEY_API_KEY
# Enter your Lunch Money API key when prompted
# Deploy to Cloudflare Workers
npm run deploy选项 3:使用 npx(仅限本地)
您可以直接运行 MCP 服务器而无需克隆:
npx -y lunchmoney-mcp注意:您仍然需要设置 LUNCH_MONEY_API_KEY 环境变量。
配置
获取您的 API 密钥
登录 Lunch Money
前往 设置 → 开发者
生成一个新的 API 密钥
复制密钥(请妥善保管!)
Cursor IDE
添加到您的 Cursor MCP 配置 (~/.cursor/mcp.json) 中:
{
"mcpServers": {
"lunchmoney": {
"command": "node",
"args": ["/path/to/lunchmoney-mcp/dist/index.js"],
"env": {
"LUNCH_MONEY_API_KEY": "your_api_key_here"
}
}
}
}或者使用 npx:
{
"mcpServers": {
"lunchmoney": {
"command": "npx",
"args": ["-y", "lunchmoney-mcp"],
"env": {
"LUNCH_MONEY_API_KEY": "your_api_key_here"
}
}
}
}Claude Desktop
添加到您的 Claude Desktop 配置(macOS 上为 ~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"lunchmoney": {
"command": "node",
"args": ["/path/to/lunchmoney-mcp/dist/index.js"],
"env": {
"LUNCH_MONEY_API_KEY": "your_api_key_here"
}
}
}
}其他 MCP 客户端
任何支持 stdio 传输的 MCP 客户端都可以使用此服务器。设置 LUNCH_MONEY_API_KEY 环境变量并运行:
node /path/to/lunchmoney-mcp/dist/index.js通过 Cloudflare Workers 进行远程 MCP(自带 API 密钥)
Cloudflare Workers 部署被设计为一个公共 MCP 服务器,每个用户使用自己的 API 密钥。服务器从不存储任何 API 密钥。
工作原理:
将服务器部署到 Cloudflare Workers(或使用共享实例)
每个用户使用自己的 Lunch Money API 密钥进行连接
API 密钥随每个请求在
X-LunchMoney-API-Key请求头中发送
使用 mcp-remote 代理连接:
{
"mcpServers": {
"lunchmoney": {
"command": "npx",
"args": ["mcp-remote", "https://lunchmoney-mcp.your-subdomain.workers.dev/mcp"],
"env": {
"MCP_HEADERS": "X-LunchMoney-API-Key: your_api_key_here"
}
}
}
}注意: mcp-remote 代理必须支持自定义请求头。某些 MCP 客户端可能尚不支持此功能。
⚠️ 请像对待凭据文件一样对待您的
mcp.json文件。 它现在包含您的 Lunch Money API 密钥。切勿将其提交到 Git 仓库(包括 dotfiles 仓库)。如果它位于其中,请将其添加到.gitignore。任何拥有此文件读取权限的人都可以读取和修改您的 Lunch Money 数据。
安全性: 这是最安全的模型,因为:
服务器从不存储任何 API 密钥
每个用户仅访问自己的数据
API 密钥按请求传递,不存储在服务器上
公共 worker 强制执行基于 IP 的速率限制,且从不记录请求体或请求头
Cloudflare Workers 部署(公共服务器)
这将创建一个公共 MCP 服务器,任何人都可以使用自己的 API 密钥使用它。服务器不存储任何凭据。
先决条件
Cloudflare 账户(免费层级即可)
已安装 Wrangler CLI
部署
安装依赖项:
npm install部署到 Cloudflare Workers:
npm run deploy您的公共 MCP 服务器现已上线! URL 将显示在输出中:
https://lunchmoney-mcp.your-account.workers.dev/mcp可选: 您可以设置一个默认的 API 密钥用于测试:
npx wrangler secret put LUNCH_MONEY_API_KEY用户如何连接
用户使用他们自己的 Lunch Money API 密钥连接到您的公共服务器:
{
"mcpServers": {
"lunchmoney": {
"command": "npx",
"args": ["mcp-remote", "https://lunchmoney-mcp.your-account.workers.dev/mcp"],
"env": {
"MCP_HEADERS": "X-LunchMoney-API-Key: their_api_key_here"
}
}
}
}使用 Wrangler 进行本地开发
# Run locally with hot reload
npm run dev:worker安全模型
服务器从不存储 API 密钥 — 密钥通过请求头按请求传递
用户仅访问自己的数据 — 每个请求使用用户自己的密钥
公开可访问 — 任何人都可以使用该服务器,但他们需要自己的 Lunch Money 账户
这类似于公共 API 网关的工作方式 — 基础设施是共享的,但凭据是针对每个用户的。
使用示例
配置完成后,您可以向 AI 助手询问如下问题:
“显示我本月按类别划分的支出”
“我上周最大的一笔支出是什么?”
“对三月份所有未分类的交易进行分类”
“创建一个名为 '自由职业收入' 的新类别”
“我在第一季度在杂货上花了多少钱?”
“列出我所有的定期订阅”
开发
本地 stdio 模式(适用于 Cursor、Claude Desktop)
# Install dependencies
npm install
# Run in development mode with hot reload
npm run dev
# Build for production
npm run build
# Type check without emitting
npm run typecheck
# Test with MCP Inspector
npm run inspectCloudflare Workers 模式(适用于远程 HTTP 访问)
# Build the Worker
npm run build
# Run locally with Wrangler
npm run dev:worker
# Deploy to production
npm run deploy项目结构
src/
├── index.ts # MCP server entry point (stdio mode)
├── worker.ts # Cloudflare Workers entry point (HTTP mode)
├── client.ts # Lunch Money API client
├── types.ts # TypeScript type definitions
├── tool-utils.ts # Shared tool utilities
└── tools/ # Individual tool implementations
├── user.ts
├── categories.ts
├── transactions.ts
├── assets.ts
├── plaid.ts
├── budgets.ts
├── recurring.ts
└── tags.ts部署模式
模式 | 传输 | 用例 | 入口点 |
本地 | stdio | Cursor, Claude Desktop |
|
Cloudflare Workers | 流式 HTTP | 远程访问, Web 客户端 |
|
两种模式共享相同的工具实现和 API 客户端。
安全性
API 密钥保护
切勿提交您的 API 密钥。 因此
.env文件已包含在.gitignore中。将您的密钥存储在环境变量或安全的 MCP 配置文件中。
如果您的密钥泄露,请立即在 Lunch Money 开发者页面 撤销它并生成一个新的。
数据隐私
此服务器充当您的 AI 助手和 Lunch Money 之间的代理。
您的财务数据根据 Lunch Money 的隐私政策 进行处理。
错误消息经过脱敏处理,以防止意外的信息泄露。
权限
您提供的 API 密钥决定了 MCP 服务器可以执行的操作。Lunch Money API 密钥可以:
读取您的所有财务数据
创建、更新和删除交易
修改类别和预算
触发 Plaid 同步
API 参考
此 MCP 服务器使用 Lunch Money API v1。
速率限制
Lunch Money API 有速率限制。MCP 服务器将透传来自 API 的任何速率限制错误。如果您遇到速率限制,请等待几分钟后再试。
错误处理
服务器处理 Lunch Money API 错误并将其作为 MCP 工具错误返回。注意事项:
Lunch Money 有时会将逻辑错误作为 HTTP 200 响应返回 — 这些会被标准化为正确的错误
服务器会对错误消息进行脱敏处理,以删除潜在的敏感信息
完整的错误详情会记录到 stderr 以供调试
故障排除
“Missing LUNCH_MONEY_API_KEY” 错误
未设置 LUNCH_MONEY_API_KEY 环境变量。检查您的 MCP 配置并确保密钥已正确配置。
“Unauthorized” 错误
您的 API 密钥可能无效或已撤销。请在 https://my.lunchmoney.app/developers 验证您的密钥。
交易未显示
如果您使用已连接 Plaid 的账户,您可能需要触发同步:
使用
trigger_plaid_fetch工具排队后台同步请注意,这仅会将作业加入队列 — 交易可能需要几分钟才会显示
贡献
欢迎贡献!请随时提交 Pull Request。
Fork 本仓库
创建您的功能分支 (
git checkout -b feature/amazing-feature)提交您的更改 (
git commit -m 'feat: add amazing feature')推送到分支 (
git push origin feature/amazing-feature)打开 Pull Request
许可证
本项目采用 ISC 许可证 — 有关详细信息,请参阅 LICENSE 文件。
致谢
使用 模型上下文协议 SDK 构建
由 Lunch Money 提供支持
支持
如果此 MCP 服务器有问题,请提交 GitHub Issue
有关 Lunch Money API 的问题,请参阅 Lunch Money API 文档
有关 MCP 协议的问题,请参阅 MCP 文档
免责声明: 这是一个非官方的社区项目。它不隶属于 Lunch Money,也不受其认可。
Available Tools
15 toolscreate_assetC
Create a manually managed asset in Lunch Money.
Inputs: type_name (required), name (required), balance (required), subtype_name, +6 more.
create_categoryC
Create a new Lunch Money category.
Inputs: name (required), description, is_income, exclude_from_budget, +3 more.
create_transactionC
Create one or more Lunch Money transactions.
Inputs: transactions (required), apply_rules, skip_duplicates, check_for_recurring, +2 more.
get_assetsARead-only
List manually managed Lunch Money assets.
Inputs: no named parameters.
get_budgetsARead-only
Get Lunch Money budgets and spending for a date range.
Inputs: start_date (required), end_date (required), currency.
get_categoriesARead-only
List Lunch Money categories in flattened or nested form.
Inputs: format.
get_plaid_accountsARead-only
List Lunch Money Plaid-connected accounts.
Inputs: no named parameters.
get_recurring_itemsARead-only
Get Lunch Money recurring items for the current or specified month range.
Inputs: start_date, end_date, debit_as_negative.
get_tagsARead-only
List all Lunch Money tags.
Inputs: no named parameters.
get_transactionsCRead-only
Get Lunch Money transactions with optional filters.
Inputs: tag_id, recurring_id, plaid_account_id, category_id, +9 more.
get_userARead-only
Get information about the Lunch Money user connected to the configured API key.
Inputs: no named parameters.
trigger_plaid_fetchC
Trigger a Lunch Money fetch for eligible Plaid accounts. This queues a background fetch job.
Inputs: start_date, end_date, plaid_account_id.
update_categoryC
Update an existing Lunch Money category.
Inputs: category_id (required), name, description, is_income, +4 more.
update_transactionC
Update a Lunch Money transaction or split it into multiple child transactions.
Inputs: transaction_id (required), transaction, split, debit_as_negative, +1 more.
upsert_budgetC
Create or update a Lunch Money budget entry for a category and month.
Inputs: start_date (required), category_id (required), amount (required), currency.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Each tool targets a distinct resource or action, with clear separation between asset, category, transaction, budget, account, recurring item, tag, and user operations. No overlapping functionality.
All tools follow a consistent verb_noun pattern (e.g., create_asset, get_transactions, update_category), using the same set of verbs (create, get, update, upsert, trigger) throughout.
With 15 tools, the server covers the core aspects of personal finance management without being overloaded or underdeveloped. Each tool has a clear purpose.
The server provides create, read, and update operations for several resources, but lacks delete operations for all resources and missing update for assets and recurring items. Tags only have a get operation, leaving significant gaps in the lifecycle.
Maintenance
Related MCP Connectors
Read-only Lunch Money accounts, transactions, categories and budgets. Unofficial connector.
The budget app your AI agent can use. Check budgets and log spending, with no bank logins.
Connect AI agents to bank accounts, transactions, balances, and investments.
Personal finance, bank account, and shared memory connector for Claude, ChatGPT, Gemini Spark & more
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables managing personal finances through the Lunch Money API, including transactions, categories, budgets, and accounts via natural language commands.145MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants and MCP clients to access and manage LunchMoney personal finance data, including transactions, categories, tags, budgets, accounts, recurring items, and crypto through LunchMoney's API.41 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants and MCP clients to manage personal finance data through the LunchMoney API, including transactions, budgets, categories, tags, accounts, recurring items, and crypto balances.41 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants and other MCP clients to interact with LunchMoney data for automated financial insights, transaction management, budgeting, and more. Provides comprehensive tools for categories, tags, transactions, recurring items, budgets, accounts, cryptocurrency, and balance history via LunchMoney's API.41 npmMIT