内容
# YNAB MCP Server
一个 MCP(模型上下文协议)服务器,使 AI 助手能够通过自然对话与您的 YNAB 预算进行交互。与 Claude、GitHub Copilot、OpenAI Codex 以及任何兼容 MCP 的客户端配合使用。
## Features
- **查看您的预算**:查看预算摘要、账户、类别、交易、收款人、计划交易
- **管理交易**:创建、更新和删除交易,支持拆分交易
- **预算**:设置类别预算、更新类别、查看按月细分
- **账户管理**:创建账户、查看详细信息、核对余额
- **计划交易**:创建和查看定期交易
- **收款人管理**:查看和重命名收款人
- **人性化输入**:使用类别/账户/收款人名称(而非 ID)、金额、灵活的日期
- **智能收款人匹配**:模糊匹配现有收款人,并对新收款人进行确认
- **完整目标详情**:查看所有目标信息,包括目标、进度和资金状况
## Setup
### 1. 获取您的 YNAB API Token
1. 前往 [YNAB](https://app.ynab.com) → 账户设置 → 开发者设置
2. 创建一个新的 Personal Access Token
3. 复制 Token
### 2. 安装依赖项
```bash
npm install
npm run build
```
### 3. 配置您的 MCP Client
#### Claude Code
添加到 `~/.claude/mcp_servers.json`:
```json
{
"ynab": {
"command": "node",
"args": ["/path/to/ynab-mcp/dist/index.js"],
"env": {
"YNAB_API_TOKEN": "your-token-here"
}
}
}
```
#### GitHub Copilot
添加到您的 VS Code `settings.json`:
```json
{
"github.copilot.chat.mcpServers": {
"ynab": {
"command": "node",
"args": ["/path/to/ynab-mcp/dist/index.js"],
"env": {
"YNAB_API_TOKEN": "your-token-here"
}
}
}
}
```
#### OpenAI Codex / Other MCP Clients
使用具有以下命令的 stdio 传输:
```bash
YNAB_API_TOKEN=your-token-here node /path/to/ynab-mcp/dist/index.js
```
或者在您的客户端 MCP 设置中使用以下配置:
- **Command**: `node`
- **Args**: `["/path/to/ynab-mcp/dist/index.js"]`
- **Environment**: `YNAB_API_TOKEN=your-token-here`
将 `/path/to/ynab-mcp` 替换为此目录的实际路径。
## Available Tools
### Discovery
| Tool | Description |
|------|-------------|
| `search_tools` | 按关键字或类别(预算、账户、类别、交易、计划、收款人)搜索可用的 YNAB 工具 |
### Budget
| Tool | Description |
|------|-------------|
| `get_budget_summary` | 概述:准备分配、已预算、活动、账户余额 |
| `get_monthly_budget` | 特定月份的预算摘要 |
| `get_budget_months` | 列出所有预算月份,包括已预算、活动和待预算金额 |
### Accounts
| Tool | Description |
|------|-------------|
| `get_accounts` | 列出所有账户及其余额(已清算/未清算) |
| `get_account` | 按名称获取单个账户的详细信息 |
| `create_account` | 创建一个新账户(支票、储蓄、信用卡等) |
| `reconcile_account` | 核对账户,可选择余额调整 |
### Categories
| Tool | Description |
|------|-------------|
| `get_categories` | 所有类别及其已预算/已花费/可用金额 |
| `get_category` | 特定类别的详细信息,包括完整的目标信息 |
| `get_month_category` | 特定月份的类别详细信息(已预算、活动、余额、目标) |
| `set_category_budget` | 设置特定月份类别的预算金额 |
| `update_category` | 更新类别的名称、备注或目标 |
### Transactions
| Tool | Description |
|------|-------------|
| `get_transactions` | 最近的交易,带有过滤器(账户、类别、收款人、日期) |
| `get_transaction` | 按 ID 获取单个交易 |
| `get_month_transactions` | 特定预算月份的所有交易 |
| `create_transaction` | 添加新的交易,支持智能收款人匹配和拆分 |
| `update_transaction` | 更新现有交易(金额、收款人、类别、已清算状态等) |
| `delete_transaction` | 按 ID 永久删除交易 |
### Scheduled Transactions
| Tool | Description |
|------|-------------|
| `get_scheduled_transactions` | 列出所有计划(定期)交易 |
| `create_scheduled_transaction` | 创建定期交易 |
### Payees
| Tool | Description |
|------|-------------|
| `get_payees` | 列出所有收款人 |
| `get_payee` | 按名称获取单个收款人的详细信息 |
| `update_payee` | 重命名收款人 |
## Data Shown
### Transactions
Each transaction displays:
- Date
- Amount (with inflow/outflow indicator)
- Cleared status (cleared/uncleared/reconciled)
- Approval status (approved/pending)
- Payee, Category, Account
- Memo (if present)
### Categories with Goals
When a category has a goal, you'll see:
- Goal type (TB, TBD, MF, NEED, DEBT)
- Target amount
- Target month
- Progress percentage
- Total funded and remaining
- Under-funded amount (if any)
- Months to budget
- Goal creation date
## Usage Examples
**Check your budget:**
> "What's my budget looking like?"
**View spending:**
> "How much have I spent on groceries this month?"
**Add a transaction:**
> "I spent $45 at Whole Foods for groceries"
**Split transaction:**
> "I spent $100 at Costco — $60 on groceries and $40 on household supplies"
**Update a transaction:**
> "Mark my last Whole Foods transaction as cleared"
**Set a category budget:**
> "Budget $500 for groceries this month"
**Check account balances:**
> "What are my account balances?"
**Reconcile an account:**
> "Reconcile my checking account to $1,234.56"
**View category goal progress:**
> "How am I doing on my vacation savings goal?"
## Smart Features
### Payee Matching
- Fuzzy matches existing payees ("Amazon" finds "Amazon.com")
- Asks for clarification when multiple matches exist
- Confirms before creating new payees
### Flexible Dates
- "today", "yesterday", "tomorrow"
- YYYY-MM-DD format
### Dollar Amounts
- Enter amounts in dollars (e.g., -50.00)
- Negative = spending, Positive = income
- Automatically converted to YNAB's milliunits
## Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| `YNAB_API_TOKEN` | Yes | Your YNAB Personal Access Token |
| `YNAB_BUDGET_ID` | No | Override auto-detected budget |
## Rate Limits
YNAB API 允许每小时 200 个请求。服务器为每个请求获取新数据,以确保准确性。
## License
ISC
MCP 配置
以下是此 MCP Server 的配置信息,可直接复制到 Cursor 或其他 MCP 客户端中使用。
mcp.json
连接信息
猜你喜欢
worldmonitor
实时全球情报仪表盘。基于人工智能的新闻聚合、地缘政治监测和基础设施跟踪,提供统一的态势感知界面。
Vibe-Trading
Vibe-Trading:您的个人交易代理
ai-berkshire
AI 时代的伯克希尔:基于 Claude Code 的价值投资研究框架。巴菲特·芒格·段永平·李录四大师方法论 + 多Agent并行研究。
HexStrike AI
HexStrike AI是一个AI驱动的MCP网络安全自动化平台,拥有150多个工具。
valuecell
Valuecell是一个用于高效数据管理的Python项目。
tradingview-mcp
AI辅助TradingView图表分析 — 将Claude Code连接到您的TradingView Desktop,实现个人工作流自动化