YNAB MCP Server
MCP server for YNAB (You Need A Budget) integration, enabling AI assistants to help manage your budget.
Setup
- Install dependencies with
uv:
uv sync
-
Get your YNAB Personal Access Token:
- Go to https://app.ynab.com/settings/developer
- Create a new Personal Access Token
- Copy the token
-
Create
.envfile:
cp .env.example .env
- 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 informationget_categories- Get all categories for a budget (lightweight list)get_budget_summary- Get budget summary for a specific monthupdate_category- Update category properties (name, note, group, or goal target)update_category_budget- Update the budgeted amount for a category in a specific monthmove_category_funds- Move funds from one category to another
Transaction Management
get_transaction- Get a single transaction with full details including subtransactionsget_transactions- Get transactions with pagination and filtering (date range, account, category, limit, page)search_transactions- Search transactions by text in payee name or memocreate_transaction- Create a new transactionupdate_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 categoriesprepare_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 transactionscreate_scheduled_transaction- Create future/recurring transactionsdelete_scheduled_transaction- Delete scheduled transactions
Analytics & Reporting
get_category_spending_summary- Get spending summary with optional terminal graph visualizationcompare_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_LEVELenvironment 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:
- Call
prepare_split_for_matchingwith the existing transaction ID and desired splits - The tool fetches the original transaction details and creates a new unapproved split transaction
- Go to YNAB (web or mobile) and manually match the two transactions
- 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 TokenLOG_LEVEL(optional) - Logging level (DEBUG, INFO, WARNING, ERROR, default: INFO)
Troubleshooting
MCP Server Not Connecting
- Run the health check tool:
health_check - Check that
YNAB_ACCESS_TOKENis set in your.envfile - Verify the token is valid at https://app.ynab.com/settings/developer
- 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-Afterheaders
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 transactionscompare_spending_by_year- Returns year-over-year totals instead of individual transactions- Pagination with
get_transactions(uselimitandpageparameters)
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
Metadata
Release files for ynab-mcp-dgalarza 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ynab_mcp_dgalarza-0.1.1.tar.gz | 70.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ynab_mcp_dgalarza-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 92.5 kB
Release files / ynab_mcp_dgalarza-0.1.1.tar.gz
| Download URL | ynab_mcp_dgalarza-0.1.1.tar.gz |
|---|---|
| Size | 70.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d98b2ca1e11df29b495f1a4c9243cf70e1d5469bca1dc9a22e6ed92276b4c855
|
|
BLAKE2b-256 checksum How to use checksums |
3f47b2d719eea9f85049a0a398bde9cfc62163959555d10dc1d0a37be69f8068
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / ynab_mcp_dgalarza-0.1.1-py3-none-any.whl
| Download URL | ynab_mcp_dgalarza-0.1.1-py3-none-any.whl |
|---|---|
| Size | 22.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a246b1f4cb48f08cf3f4457d63c7d1e32ec7f7b228ea6bd8725fccaeb416cb7
|
|
BLAKE2b-256 checksum How to use checksums |
a9b421620f30ba3100147f7117887f74e9723dd7e84a6e43c30b0813ebd7d6c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Security for ynab-mcp-dgalarza 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.