YNAB MCP Server

MIT License
15
1
  • Apple

Integrations

  • Supports publishing the MCP server as an npm package for easier distribution and installation

  • Used for building tools that interact with YNAB's API through typed interfaces

  • Utilized for schema validation of tool inputs when interacting with YNAB data

ynab-mcp-服务器

使用 mcp-framework 构建的模型上下文协议 (MCP) 服务器。此 MCP 提供与 YNAB 预算设置( https://ynab.com)交互的工具。

为了让 AI 与此工具交互,您需要从 YNAB 获取您的个人访问令牌: https://api.ynab.com/#personal-access-tokens 。将此 MCP 服务器添加到任何客户端时,您需要以 YNAB_API_TOKEN 的形式提供您的个人访问令牌。此令牌绝不会直接发送给 LLM。它被私密地存储在环境变量中,以便与 YNAB API 一起使用。

设置

指定环境变量:

  • YNAB_API_TOKEN(必需)
  • YNAB_BUDGET_ID(可选)

目标

该项目的目标是能够通过 AI 对话与我的 YNAB 预算进行交互。我希望启用以下几个主要工作流程:

工作流程:

首次设置

  • 系统会提示您从可用预算中选择预算。如果您先尝试使用其他工具,则会出现此提示,要求您设置默认预算。
    • 所需工具:ListBudgets

管理超支类别

添加新交易

批准交易

检查每月总支出与总收入

根据类别目标自动分配资金

当前状态

可用工具:

  • ListBudgets - 列出您帐户中的可用预算
  • 预算摘要 - 提供资金不足的类别和低资金账户的摘要
  • GetUnapprovedTransactions - 检索所有未批准的交易
  • CreateTransaction - 为指定的预算和账户创建交易。
    • 示例提示: Add a transaction to my Ally account for $3.98 I spent at REI today
    • 需要先调用 GetBudget 才能知道账户 ID
  • ApproveTransaction - 批准 YNAB 预算中的现有交易
    • 需要交易 ID 才能批准
    • 可以与 GetUnapprovedTransactions 结合使用来批准待处理的交易
    • 拨打获取未批准交易后,提示: approve the transaction for $6.95 on the Apple Card

下一个:

  • 一次通话即可批准多笔交易
  • updateCategory 工具 - 或者 updateTransaction 更通用的工具,如果我可以获得可选参数以便与 zod 和 mcp 框架正确配合使用
  • 脱离 mcp 框架直接使用模型上下文协议 sdk?

快速入门

# Install dependencies npm install # Build the project npm run build

项目结构

ynab-mcp-server/ ├── src/ │ ├── tools/ # MCP Tools │ └── index.ts # Server entry point ├── .cursor/ │ └── rules/ # Cursor AI rules for code generation ├── package.json └── tsconfig.json

添加组件

YNAB sdk 描述了可用的 api 端点: https://github.com/ynab/ynab-sdk-js

YNAB 开放 API 规范位于: https://api.ynab.com/papi/open\ _api\_spec.yaml 。这可用于提示 AI 生成新工具。光标代理的示例提示:

create a new tool based on the readme and this openapi doc: https://api.ynab.com/papi/open_api_spec.yaml The new tool should get the details for a single budget

您可以使用 CLI 添加更多工具:

# Add a new tool mcp add tool my-tool # Example tools you might create: mcp add tool data-processor mcp add tool api-client mcp add tool file-handler

工具开发

示例工具结构:

import { MCPTool } from "mcp-framework"; import { z } from "zod"; interface MyToolInput { message: string; } class MyTool extends MCPTool<MyToolInput> { name = "my_tool"; description = "Describes what your tool does"; schema = { message: { type: z.string(), description: "Description of this input parameter", }, }; async execute(input: MyToolInput) { // Your tool logic here return `Processed: ${input.message}`; } } export default MyTool;

发布到 npm

  1. 更新你的 package.json:
    • 确保name唯一并遵循 npm 命名约定
    • 设置适当的version
    • 添加descriptionauthorlicense等。
    • 检查bin指向正确的入口文件
  2. 本地构建和测试:
    npm run build npm link ynab-mcp-server # Test your CLI locally
  3. 登录 npm(如有必要,请创建帐户):
    npm login
  4. 发布你的包:
    npm publish

发布后,用户可以将其添加到他们的 claude 桌面客户端(见下文)或使用 npx 运行它

与 Claude Desktop 一起使用

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 YNAB 预算助手:

npx -y @smithery/cli install @calebl/ynab-mcp-server --client claude

本地开发

将此配置添加到您的 Claude Desktop 配置文件:

MacOS~/Library/Application Support/Claude/claude_desktop_config.json Windows%APPDATA%/Claude/claude_desktop_config.json

{ "mcpServers": { "ynab-mcp-server": { "command": "node", "args":["/absolute/path/to/ynab-mcp-server/dist/index.js"] } } }

发布后

将此配置添加到您的 Claude Desktop 配置文件:

MacOS~/Library/Application Support/Claude/claude_desktop_config.json Windows%APPDATA%/Claude/claude_desktop_config.json

{ "mcpServers": { "ynab-mcp-server": { "command": "npx", "args": ["ynab-mcp-server"] } } }

其他 MCP 客户端

检查https://modelcontextprotocol.io/clients以了解其他可用的客户端。

构建和测试

  1. 更改您的工具
  2. 运行npm run build进行编译
  3. 服务器将在启动时自动加载您的工具

了解更多

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

模型上下文协议服务器可实现与 YNAB(你需要预算)数据的 AI 交互,允许用户通过对话界面查询他们的预算。

  1. Setup
    1. Goal
      1. Workflows:
        1. First time setup
        2. Manage overspent categories
        3. Adding new transactions
        4. Approving transactions
        5. Check total monthly spending vs total income
        6. Auto-distribute ready to assign funds based on category targets
      2. Current state
        1. Quick Start
          1. Project Structure
            1. Adding Components
              1. Tool Development
                1. Publishing to npm
                  1. Using with Claude Desktop
                    1. Installing via Smithery
                    2. Local Development
                    3. After Publishing
                    4. Other MCP Clients
                  2. Building and Testing
                    1. Learn More

                      Related MCP Servers

                      • A
                        security
                        F
                        license
                        A
                        quality
                        An MCP server that allows users to interact with YNAB data, enabling access to account balances, transactions, and the creation of new transactions through the Model Context Protocol.
                        Last updated -
                        10
                        1
                        Python
                      • -
                        security
                        F
                        license
                        -
                        quality
                        Provides access to YNAB (You Need A Budget) functionality through the Model Context Protocol, allowing users to view account balances, access transaction data, and create new transactions.
                        Last updated -
                        Python
                      • -
                        security
                        A
                        license
                        -
                        quality
                        A Model Context Protocol server that enables AI assistants to manage meeting data, including creating meeting bots, searching transcripts, and organizing calendar events.
                        Last updated -
                        7
                        TypeScript
                        MIT License
                        • Apple
                      • -
                        security
                        A
                        license
                        -
                        quality
                        A Model Context Protocol (MCP) server for interacting with YNAB (You Need A Budget). Provides tools for accessing budget data through MCP-enabled clients like Claude Desktop.
                        Last updated -
                        Python
                        MIT License

                      View all related MCP servers

                      ID: k7h1fcvgs1