Skip to main content
Glama

YNAB MCP Server

by calebl
ListBudgetsTool.js1.11 kB
import { MCPTool, logger } from "mcp-framework"; import * as ynab from "ynab"; class ListBudgetsTool extends MCPTool { name = "list_budgets"; description = "Lists all available budgets from YNAB API"; schema = {}; api; constructor() { super(); this.api = new ynab.API(process.env.YNAB_API_TOKEN || ""); } async execute() { try { if (!process.env.YNAB_API_TOKEN) { return "YNAB API Token is not set"; } logger.info("Listing budgets"); const budgetsResponse = await this.api.budgets.getBudgets(); logger.info(`Found ${budgetsResponse.data.budgets.length} budgets`); const budgets = budgetsResponse.data.budgets.map((budget) => ({ id: budget.id, name: budget.name, })); return budgets; } catch (error) { logger.error(`Error listing budgets: ${JSON.stringify(error)}`); return `Error listing budgets: ${JSON.stringify(error)}`; } } } export default ListBudgetsTool;

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