YNAB MCP Server

YNAB MCP Server

Enables AI assistants to help manage your You Need A Budget (YNAB) finances through comprehensive budget operations. Supports account management, transaction handling, category budgeting, split transactions, scheduled payments, and spending analytics with robust error handling and automatic retry logic.

Category
访问服务器

README

YNAB MCP Server

MCP server for YNAB (You Need A Budget) integration, enabling AI assistants to help manage your budget.

Setup

  1. Install dependencies with uv:
uv sync
  1. Get your YNAB Personal Access Token:

    • Go to https://app.ynab.com/settings/developer
    • Create a new Personal Access Token
    • Copy the token
  2. Create .env file:

cp .env.example .env
  1. Add your token to .env:
YNAB_ACCESS_TOKEN=your_token_here

Running the Server

uv run python -m ynab_mcp

Installing in Claude Code

Add to your Claude Code configuration:

claude mcp add ynab -- uv --directory /path/to/ynab-mcp run python -m ynab_mcp

Or add to .claude.json manually in the mcpServers section:

{
  "ynab": {
    "type": "stdio",
    "command": "uv",
    "args": ["--directory", "/home/your-user/Code/ynab-mcp", "run", "python", "-m", "ynab_mcp"],
    "env": {}
  }
}

Available Tools

Health & Diagnostics

  • health_check - Check server health and YNAB API connectivity

Account Management

  • get_accounts - Get all accounts for a budget

Category & Budget Management

  • get_category - Get a single category with full details including goal information
  • get_categories - Get all categories for a budget (lightweight list)
  • get_budget_summary - Get budget summary for a specific month
  • update_category - Update category properties (name, note, group, or goal target)
  • update_category_budget - Update the budgeted amount for a category in a specific month
  • move_category_funds - Move funds from one category to another

Transaction Management

  • get_transaction - Get a single transaction with full details including subtransactions
  • get_transactions - Get transactions with pagination and filtering (date range, account, category, limit, page)
  • search_transactions - Search transactions by text in payee name or memo
  • create_transaction - Create a new transaction
  • update_transaction - Update an existing transaction (⚠️ cannot add/modify splits on existing transactions)
  • get_unapproved_transactions - Get all unapproved transactions that need review

Split Transaction Management

  • create_split_transaction - Create a new transaction split across multiple categories
  • prepare_split_for_matching - Split an existing imported transaction by creating a matching split for manual reconciliation in YNAB UI

Scheduled Transactions

  • get_scheduled_transactions - List all scheduled transactions
  • create_scheduled_transaction - Create future/recurring transactions
  • delete_scheduled_transaction - Delete scheduled transactions

Analytics & Reporting

  • get_category_spending_summary - Get spending summary with optional terminal graph visualization
  • compare_spending_by_year - Year-over-year spending comparison with optional graph

Features

Robust Error Handling

  • Custom exception classes for different error types
  • Automatic retry logic with exponential backoff
  • Rate limit detection and handling (respects Retry-After headers)
  • Comprehensive logging (configurable via LOG_LEVEL environment variable)

Performance & Reliability

  • HTTP connection pooling for better performance
  • Input validation on all parameters
  • Timeout configuration (30s default)
  • Milliunits conversion handled automatically

Split Transaction Support

Split transactions allow you to allocate a single transaction across multiple categories (e.g., splitting a grocery store purchase into "Groceries" and "Household Items").

Creating New Split Transactions:

create_split_transaction(
  budget_id="last-used",
  account_id="account-id",
  date="2025-10-06",
  amount=-80.00,
  subtransactions='[{"amount": -50.00, "category_id": "groceries-id", "memo": "Food"}, {"amount": -30.00, "category_id": "household-id", "memo": "Supplies"}]'
)

Splitting Existing Imported Transactions: Due to YNAB API limitations, you cannot directly modify an existing transaction to add splits. Instead, use prepare_split_for_matching:

  1. Call prepare_split_for_matching with the existing transaction ID and desired splits
  2. The tool fetches the original transaction details and creates a new unapproved split transaction
  3. Go to YNAB (web or mobile) and manually match the two transactions
  4. YNAB merges them into one split transaction, preserving the bank import connection

Important Limitations:

  • Cannot add or update subtransactions on existing transactions via the API
  • Cannot convert a regular transaction into a split transaction directly
  • Once created, subtransactions cannot be modified via the API
  • Split transaction dates and amounts cannot be changed after creation

Analytics & Visualization

  • Server-side spending aggregation to reduce context usage
  • Optional terminal-based graph visualization using termgraph
  • Year-over-year spending comparisons
  • Monthly spending summaries

Configuration

Environment Variables

  • YNAB_ACCESS_TOKEN (required) - Your YNAB Personal Access Token
  • LOG_LEVEL (optional) - Logging level (DEBUG, INFO, WARNING, ERROR, default: INFO)

Troubleshooting

MCP Server Not Connecting

  1. Run the health check tool: health_check
  2. Check that YNAB_ACCESS_TOKEN is set in your .env file
  3. Verify the token is valid at https://app.ynab.com/settings/developer
  4. Check logs with LOG_LEVEL=DEBUG

Rate Limit Errors

The YNAB API has a rate limit of 200 requests per hour. The server automatically:

  • Detects 429 (rate limit) responses
  • Retries with exponential backoff
  • Respects Retry-After headers

If you consistently hit rate limits, consider:

  • Using analytics tools (get_category_spending_summary, compare_spending_by_year) instead of fetching all transactions
  • Reducing the frequency of requests
  • Caching results when possible

Large Response Sizes

For queries spanning long time periods, use:

  • get_category_spending_summary - Returns aggregated summary instead of all transactions
  • compare_spending_by_year - Returns year-over-year totals instead of individual transactions
  • Pagination with get_transactions (use limit and page parameters)

Development

Running Tests

Install dev dependencies:

uv sync --extra dev

Run tests:

uv run pytest tests/ -v

Code Quality

The codebase includes:

  • Input validation on all parameters
  • Custom exception classes for proper error handling
  • Comprehensive logging
  • Type hints with from __future__ import annotations
  • Connection pooling for HTTP requests
  • Automatic retry logic for transient failures

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选