UNPKG

@baruchiro/actual-mcp

Version:

Actual Budget MCP server exposing API functionality

24 lines (23 loc) 948 B
import { getAccounts, getCategories, getTransactions, } from "../../actual-api.js"; export class MonthlySummaryDataFetcher { /** * Fetch accounts, categories, and all transactions for the given period. * If accountId is provided, only fetch transactions for that account. */ async fetchAll(accountId, start, end) { const accounts = await getAccounts(); const categories = await getCategories(); let transactions = []; if (accountId) { transactions = await getTransactions(accountId, start, end); } else { const onBudgetAccounts = accounts.filter((a) => !a.offbudget && !a.closed); for (const account of onBudgetAccounts) { const tx = await getTransactions(account.id, start, end); transactions = [...transactions, ...tx]; } } return { accounts, categories, transactions }; } }