Skip to main content
Glama
juansebashr

Money Lover MCP Server

by juansebashr

Money Lover MCP 服务器

这是一个 Node.js 实现的模型上下文协议 (MCP) 服务器,封装了非官方的 Money Lover REST API。该服务器公开了 27 个 MCP 工具,涵盖身份验证、钱包、分类、交易、事件、债务和静态配置,使 AI 助手或兼容 MCP 的客户端能够查询和管理个人财务数据。

功能特性

  • 通过 EMAIL/PASSWORD 环境变量自动进行身份验证 — 大多数工具无需传递令牌。

  • 23 个读取工具,涵盖用户信息、钱包、分类、交易、事件、债务、图标、提供商和静态配置。

  • 4 个写入工具:创建、更新和删除交易、钱包和分类。

  • 大响应自动截断,以保持 LLM 上下文可控(可通过 limit 参数配置)。

  • 基于 Stdio 的服务器,兼容 Claude Code、Claude Desktop、Cursor 以及任何 MCP 主机。

  • 每个邮箱的令牌缓存位于 ~/.moneylover-mcp/ 下,并在身份验证错误时自动刷新。

Related MCP server: YNAB Assistant

前置要求

  • Node.js 22 或更高版本。

  • Money Lover 账户凭据。

安装

npm install

使用

通过 stdio 启动 MCP 服务器:

npm start

项目级配置 (Claude Code)

在项目根目录添加 .mcp.json

{
  "mcpServers": {
    "mcp-moneylover": {
      "command": "node",
      "args": ["/absolute/path/to/moneylover-mcp/src/server.js"],
      "env": {
        "EMAIL": "your@email.com",
        "PASSWORD": "your-password"
      }
    }
  }
}

并在 .claude/settings.json 中启用它:

{ "enabledMcpjsonServers": ["mcp-moneylover"] }

全局配置 (Claude Desktop / Cursor)

{
  "mcpServers": {
    "mcp-moneylover": {
      "command": "npx",
      "args": ["@ferdhika31/moneylover-mcp@latest"],
      "env": {
        "EMAIL": "your@email.com",
        "PASSWORD": "your-password"
      }
    }
  }
}

可用工具

身份验证 (Auth)

工具

描述

参数

login

获取 JWT 令牌。

email, password

用户 (User)

工具

描述

参数

get_user_info

与会话关联的个人资料。

get_user_account

设备和活动会话。

get_user_profile

扩展的个人资料数据。

钱包 (Wallets)

工具

描述

参数

get_wallets

列出所有钱包。

get_wallet_balance

钱包余额摘要。

walletId

get_shared_wallets

与其他用户共享的钱包。

get_awaiting_shared_wallets

待处理的共享邀请。

add_wallet

创建新钱包。

name, currencyId; 可选 icon

edit_wallet

更新钱包名称、图标或货币。

walletId, currencyId (API 必需); 可选 name, icon

delete_wallet

永久删除钱包。

walletId

分类 (Categories)

工具

描述

参数

get_categories

特定钱包的分类。

walletId

get_all_categories

所有钱包中的所有分类。

可选 limit (默认 50)

add_category

在钱包中创建分类。

walletId, name, icon (使用 get_icons 获取有效名称,例如 icon_3), type (1=收入, 2=支出)

edit_category

重命名分类或更改其图标。

categoryId, icon (即使仅重命名,API 也需要); 可选 name

delete_category

删除分类。

categoryId

交易 (Transactions)

工具

描述

参数

get_transactions

日期范围内的交易。

walletId, startDate, endDate (YYYY-MM-DD)

add_transaction

创建交易。来自 get_categories 的分类 ID 会自动解析为全局 ID。

walletId, categoryId, amount, date; 可选 note, with

edit_transaction

更新交易。API 要求每次编辑都提供完整载荷 — 如果需要当前值,请先获取交易。categoryId 会自动解析为全局 ID。

transactionId, walletId, categoryId, amount, date; 可选 note, with

delete_transaction

删除交易。

transactionId

search_transactions

带有可选过滤器的自由格式搜索。

可选 filters, limit (默认 20)

get_debt_transactions

标记为债务/贷款的交易。

get_related_transactions

按 ID 列表关联的交易。

ids (数组)

get_related_transactions_by_category

按分类关联的交易。

categoryId

get_related_transactions_by_wallet

按钱包关联的交易。

walletId

get_transaction_search_config

可用的搜索过滤选项。

可选 limit (默认 20)

静态与配置 (Static & Config)

工具

描述

参数

get_events

钱包的储蓄目标/事件。

walletId; 可选 limit (默认 50)

get_debts

钱包中的未结债务。

walletId

get_icons

图标包元数据。

可选 pack (默认 "default")

get_linked_providers

支持的银行提供商。

get_currencies

货币目录。

可选 limit (默认 100)

get_exchange_rates

基于美元的汇率快照。

get_other_config

其他运行时配置。

工具使用示例

每个工具的提示示例、必需与可选字段、注意事项以及常见的步骤模式:docs/examples.md

库使用

import { MoneyloverClient } from './src/moneyloverClient.js';

const token = await MoneyloverClient.getToken(email, password);
const client = new MoneyloverClient(token);

const wallets = await client.getWallets();
const txns = await client.getTransactions(walletId, '2026-01-01', '2026-04-30');
await client.addTransaction({ walletId, categoryId, amount: '50000', date: '2026-04-18' });
await client.editTransaction('txn-id', { amount: '60000', note: 'updated' });
await client.deleteTransaction('txn-id');

测试

单元测试

模拟单元测试 — 无需实时 API 调用:

npm test

集成测试 (mcp-tester)

mcp-tester 是一个基于 ReAct 代理的 MCP 测试框架。它启动服务器,驱动 LLM 根据自然语言提示调用工具,并断言调用了正确的工具且参数正确。

安装

pipx install --index-url https://pypi.artifacts.furycloud.io/simple/ mcp-tester

配置

tests/mcp-tester/mcps.json — 使用您的凭据指向本地服务器:

{
  "mcp-moneylover": {
    "command": "node",
    "args": ["/absolute/path/to/src/server.js"],
    "transport": "stdio",
    "env": {
      "EMAIL": "your@email.com",
      "PASSWORD": "your-password"
    }
  }
}

运行

mcp-tester run-tests \
  --mcps tests/mcp-tester/mcps.json \
  --model gpt-4o-mini \
  --concurrent-runs 3 \
  tests/mcp-tester/read-tools.yaml

结果

tests/mcp-tester/read-tools.yaml 包含 25 个集成测试,涵盖了每个读取工具:

total 25, success 25, failures 0

使测试稳定的关键决策:

  • 读取工具上没有令牌参数 — 公开可选的 token 字段会导致 LLM 将钱包 ID 注入其中。服务器通过环境变量自动进行身份验证。

  • 响应截断 — 多个端点会从共享的 MoneyLover 数据库返回数十万条记录。工具接受 limit 参数(默认:20–100)以保持 LLM 上下文可控。

  • 字典包装 — 所有工具响应都返回一个 JSON 对象(从不返回纯数组),以便通过 MCP 框架验证。

写入工具测试 (mcp-tester)

另外三个 YAML 文件测试了钱包、分类和交易在三个连续阶段的完整 CRUD 生命周期。每个阶段同时运行所有三种资源类型。

文件

阶段

测试

write-create.yaml

创建

add_wallet, add_category, add_transaction

write-edit.yaml

编辑

edit_wallet, edit_category, edit_transaction

write-delete.yaml

删除

delete_wallet, delete_category, delete_transaction

按顺序运行阶段 — 每个阶段都依赖于前一个阶段:

# Phase 1: Create
mcp-tester run-tests --mcps tests/mcp-tester/mcps.json --model gpt-4o-mini --concurrent-runs 3 tests/mcp-tester/write-create.yaml

# Phase 2: Edit (after Phase 1 passes)
mcp-tester run-tests --mcps tests/mcp-tester/mcps.json --model gpt-4o-mini --concurrent-runs 3 tests/mcp-tester/write-edit.yaml

# Phase 3: Delete (after Phase 2 passes)
mcp-tester run-tests --mcps tests/mcp-tester/mcps.json --model gpt-4o-mini --concurrent-runs 3 tests/mcp-tester/write-delete.yaml

所有三个阶段的结果:

Phase 1 (Create): total 3, success 3, failures 0
Phase 2 (Edit):   total 3, success 3, failures 0
Phase 3 (Delete): total 3, success 3, failures 0

写入工具测试的关键设计决策:

  • 变异前的发现 — 编辑和删除测试指示代理首先调用读取工具(get_wallets, get_categories, get_transactions)以按名称定位目标,然后调用变异工具。这反映了代理在不知道 ID 的情况下在现实世界中的行为。

  • 写入工具断言的 args: !any — 该框架要求精确的参数匹配。写入工具接受代理可能自行包含的可选字段(icon, with 等);!any 验证工具被调用并成功,而不会因无害的额外内容而失败。读取工具断言可以使用精确的参数匹配,因为它们的模式中没有 LLM 会自发添加的可选字段。

  • 可预测的标识符 — 测试资源使用固定名称(MCP-Test-Wallet, MCP-Test-Category)和固定备注(MCP test transaction),以便代理可以在编辑和删除阶段按名称定位它们,而无需在测试运行之间共享状态。

  • 完整载荷编辑断言edit_transaction 是一个完全替换操作;测试提示指示代理首先获取现有交易(get_transactions)并携带所有当前字段值,仅更改备注。这验证了工具描述所需的多步推理。

安全说明

  • 切勿提交真实的凭据或令牌。

  • 缓存的令牌位于 ~/.moneylover-mcp/ 中,仅限当前用户访问。

  • 删除该目录以撤销所有缓存的会话。

Install Server
A
license - permissive license
A
quality
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to interact with the WYGIWYH expense tracking API through 75 dynamically generated MCP tools. Supports comprehensive financial operations including transaction management, account handling, recurring expenses, and investment tracking.
    7
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to interact with YNAB budgets through natural language. Supports managing accounts, categories, transactions, and budget months with 21 tools for comprehensive budget operations.
  • A
    license
    A
    quality
    D
    maintenance
    Enables AI assistants to interact with Money Lover personal finance app through unofficial REST API. Supports authentication, wallet management, transaction querying, and creating new transactions for expense tracking.
    6
    20
    4
    ISC
  • A
    license
    A
    quality
    D
    maintenance
    Enables AI assistants to manage personal finances through the Realbyte Money Manager mobile app, providing transaction management, asset tracking, credit card monitoring, and financial analytics with 18 comprehensive tools.
    18
    17
    11
    MIT

View all related MCP servers

Related MCP Connectors

  • Log, query, and edit expenses, budgets, and accounts in Ledgy from any MCP-compatible AI assistant.

  • Connect AI agents to bank accounts, transactions, balances, and investments.

  • Gateway between LLM agents and world data through eight tools and a bundled endpoint catalog.

View all MCP Connectors

Latest Blog Posts

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/juansebashr/moneylover-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server