This project includes a read-only MCP endpoint for YNAB at:
/api/ynab-mcp
It exposes tools for listing plans, accounts, categories, month summaries, transactions, and a compact plan overview.
Each tool advertises an MCP outputSchema and returns matching structuredContent alongside a text rendering of the same payload.
Users connect their own YNAB accounts through OAuth:
/api/ynab/oauth/connect
Add these variables in Vercel under Project Settings > Environment Variables:
| Variable | Required | Purpose |
|---|---|---|
YNAB_CLIENT_ID |
Yes | OAuth application client ID from YNAB Developer Settings. |
YNAB_CLIENT_SECRET |
Yes | OAuth application client secret from YNAB Developer Settings. |
YNAB_REDIRECT_URI |
Recommended | Full callback URL, for example https://mcp.rodneymandap.com/api/ynab/oauth/callback. |
UPSTASH_REDIS_REST_URL |
Yes for production OAuth | Persistent token store URL. |
UPSTASH_REDIS_REST_TOKEN |
Yes for production OAuth | Persistent token store token. |
YNAB_ACCESS_TOKEN |
Optional | Owner-only fallback personal access token. |
MCP_API_KEY |
Optional | Shared secret for the owner-only fallback mode. |
YNAB_API_BASE |
No | Defaults to https://api.ynab.com/v1. |
https://mcp.rodneymandap.com/api/ynab/oauth/callback
For local development, also add:
http://localhost:3000/api/ynab/oauth/callback
YNAB_CLIENT_ID and YNAB_CLIENT_SECRET.scope=read-only during authorization.YNAB starts new OAuth applications in Restricted Mode. That currently allows a limited number of users outside the application owner until YNAB reviews and approves the app.
OAuth access tokens expire and refresh tokens must be stored server-side. For Vercel, use Upstash Redis:
UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.Without Redis, the code falls back to in-memory storage for local development only. That is not reliable on Vercel because serverless functions can restart.
Use this when the MCP server is only for your own use.
YNAB_CLIENT_ID, YNAB_CLIENT_SECRET, YNAB_REDIRECT_URI, UPSTASH_REDIS_REST_URL, and UPSTASH_REDIS_REST_TOKEN.https://rodneymandap.com/api/ynab/oauth/connect
https://rodneymandap.com/api/ynab-mcp
Use this when you want cleaner logs, environment variables, and deployment history.
YNAB_CLIENT_ID, YNAB_CLIENT_SECRET, YNAB_REDIRECT_URI, UPSTASH_REDIS_REST_URL, and UPSTASH_REDIS_REST_TOKEN.mcp.rodneymandap.com.https://mcp.rodneymandap.com/api/ynab/oauth/connect
https://mcp.rodneymandap.com/api/ynab-mcp
After a user finishes OAuth, the callback page returns a token beginning with ynab_. MCP clients must send:
Authorization: Bearer <ynab_connection_token>
The YNAB access and refresh tokens stay server-side in the token store and are never sent to the MCP client.
Owner-only fallback is still available for your own use. If YNAB_ACCESS_TOKEN and MCP_API_KEY are configured, you can send:
Authorization: Bearer <MCP_API_KEY>
Create .env.local with:
YNAB_CLIENT_ID=your_client_id
YNAB_CLIENT_SECRET=your_client_secret
YNAB_REDIRECT_URI=http://localhost:3000/api/ynab/oauth/callback
Start the app and check:
http://localhost:3000/api/ynab-mcp
You should see the server health response and the available tool names.