Skip to main content
Glama

YNAB MCP Server

by calebl
getBudgetMonth.js1.33 kB
#!/usr/bin/env node async function getBudgetMonth(budgetId) { try { if (!process.env.YNAB_API_TOKEN) { throw new Error("YNAB_API_TOKEN environment variable is not set"); } const response = await fetch( `https://api.ynab.com/v1/budgets/${budgetId}/months/current`, { headers: { 'Authorization': `Bearer ${process.env.YNAB_API_TOKEN}` } } ); if (!response.ok) { const error = await response.json(); throw new Error(error.error.detail || 'Failed to fetch category'); } const responseData = await response.json(); console.log("Month Data:"); const monthData = responseData.data.month; // console.log(JSON.stringify(monthData, null, 2)); const categories = monthData.categories .filter( (category) => category.deleted === false && category.hidden === false ); console.log("Categories:"); console.log(JSON.stringify(categories, null, 2)); return categories; } catch (error) { console.error("Error fetching category:", error.message); process.exit(1); } } // Get command line arguments const args = process.argv.slice(2); if (args.length !== 1) { console.error("Usage: node getBudgetMonth.js <budgetId>"); process.exit(1); } const [budgetId] = args; getBudgetMonth(budgetId);

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/calebl/ynab-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server