About Monarch Money TypeScript SDK
Monarch Money TypeScript SDK is a read-only library for accessing personal finance data, with an included MCP server for AI agents. It supports browser-token or credential-based authentication and saved sessions.
Key features
- 01Read accounts and holdings
- 02Retrieve transactions and budgets
- 03Query cashflow and recurring transactions
- 04Authenticate with a browser token or credentials
- 05Save and reload sessions
Use cases
- 01Review account balances and holdings
- 02Analyze transactions over a date range
- 03Check budgets and cashflow
- 04Let an AI agent query financial data
MCP support
The included MCP server exposes tools for querying accounts, holdings, history, transactions, categories, budgets, and cashflow. It authenticates using the MONARCH_TOKEN environment variable.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEMonarch Money TypeScript SDK
A TypeScript library for accessing Monarch Money data.
Installation
bun add monarchmoney
or
npm install monarchmoney
Usage
Quick Start with Browser Token
The easiest way to get started is by using a token directly from your browser session:
import MonarchMoney from 'monarchmoney';
// You can get this token from your browser's localStorage or Cookies after logging in
// to Monarch Money on the web
const token = process.env.MONARCH_TOKEN;
// Create a client with the token
const mm = new MonarchMoney(token);
// Now you can use the API without logging in
const accounts = await mm.getAccounts();
Standard Authentication
If you don't have a token, you can log in with your credentials:
import MonarchMoney, { RequireMFAError } from 'monarchmoney';
// Create a new client
const mm = new MonarchMoney();
// Login using environment variables
const email = process.env.MONARCH_USER;
const password = process.env.MONARCH_PASSWORD;
if (!email || !password) {
throw new Error('MONARCH_USER and MONARCH_PASSWORD environment variables must be set');
}
// Login
try {
await mm.login({
email,
password
});
} catch (error) {
if (error instanceof RequireMFAError) {
// Get MFA code from user
const mfaCode = process.env.MONARCH_MFA || prompt('Enter MFA code:');
await mm.authenticateWithMFA({
email,
password,
mfaCode
});
} else {
throw error;
}
}
Using a Saved Session
You can save your session for later use:
// After logging in, save the session
mm.saveSession();
// Later, load the session
const mm = new MonarchMoney();
mm.loadSession();
// Now you can access data without logging in again
const accounts = await mm.getAccounts();
Accessing Data
// Get accounts
const accounts = await mm.getAccounts();
console.log(accounts);
// Get transactions for current month
const today = new Date();
const firstDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 1);
const lastDayOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0);
const transactions = await mm.getTransactions({
limit: 10,
filters: {
startDate: firstDayOfMonth.toISOString().split('T')[0],
endDate: lastDayOfMonth.toISOString().split('T')[0]
}
});
console.log(transactions);
// Get budgets
const budgets = await mm.getBudgets();
console.log(budgets);
// Get account holdings
const holdings = await mm.getAccountHoldings('account-id-here');
console.log(holdings);
Running the Example
To run the included example, you have two options:
Option 1: Using a Browser Token (Easiest)
# Get the token from your browser after logging in to Monarch Money
# In Chrome: DevTools > Application > Storage > Local Storage > monarchmoney.com > find the auth token
export MONARCH_TOKEN="your-token-from-browser"
# Run the example
bun run example
Option 2: Using Username/Password
# Set your credentials as environment variables
export MONARCH_USER="[email protected]"
export MONARCH_PASSWORD="your-password"
# Optional: Set MFA code if required
export MONARCH_MFA="123456"
# Run the example
bun run example
Available Methods
This SDK provides read-only access to Monarch Money data:
getAccounts()- Get all accountsgetAccountTypeOptions()- Get all account types and subtypesgetAccountHoldings(accountId)- Get securities in a brokerage accountgetAccountHistory(accountId)- Get daily account historygetInstitutions()- Get linked institutionsgetBudgets(startDate, endDate)- Get budgets and actual amountsgetSubscriptionDetails()- Get account subscription statusgetTransactionsSummary()- Get transaction summary datagetTransactions(options)- Get transaction datagetTransactionCategories()- Get transaction categoriesgetTransactionCategoryGroups()- Get transaction category groupsgetTransactionDetails(transactionId)- Get details for a transactiongetTransactionSplits(transactionId)- Get transaction splitsgetTransactionTags()- Get transaction tagsgetCashflow(options)- Get cashflow datagetCashflowSummary(options)- Get cashflow summarygetRecurringTransactions(startDate, endDate)- Get recurring transactions
MCP Server for AI Agents
This SDK includes a Model Context Protocol (MCP) server that allows AI agents to interact with Monarch Money. The MCP server provides tools for querying accounts, transactions, budgets, and more.
To start the MCP server:
# Set up authentication via environment variables
export MONARCH_TOKEN="your-token-from-browser"
# Start the MCP server
bun run mcp
The MCP server will automatically authenticate using the MONARCH_TOKEN environment variable and provides the following tools:
check_authentication- Check if already authenticatedget_accounts- Get all accountsget_account_holdings- Get holdings for an accountget_account_history- Get history for an accountget_transactions- Get transactions with filtersget_transaction_categories- Get transaction categoriesget_budgets- Get budgets for a date rangeget_cashflow- Get cashflow data with filters
Claude Desktop Configuration
To use this with Claude Desktop, add the following to your Claude Desktop configuration file (located at ~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"monarchMoney": {
"command": "bun",
"args": ["run", "mcp"],
"env": {
"MONARCH_TOKEN": "your-monarch-token-here"
},
"cwd": "/path/to/your/monarch-ts"
}
}
}
Replace /path/to/your/monarch-ts with the actual path to your project directory and your-monarch-token-here with your Monarch Money token from your browser.
License
MIT
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.