Monarchmoney
БесплатноНе проверенTypeScript/JavaScript library for interacting with Monarch Money's GraphQL API
Описание
TypeScript/JavaScript library for interacting with Monarch Money's GraphQL API
README
npm version License: MIT Build Status Coverage
A comprehensive, production-ready TypeScript/JavaScript SDK for the MonarchMoney API with advanced context optimization for AI/MCP integrations.
🚀 Key Features
🎯 Context-Optimized for AI Assistants
- 99% Response Size Reduction with intelligent verbosity levels
- Emoji-Rich Formatting for Claude Desktop and other AI assistants
- Smart Query Selection for optimal GraphQL usage
- Zero Context Overflow - maintain unlimited conversation length
🔧 Complete API Coverage
- 70+ Dynamic Methods across accounts, transactions, budgets, categories
- Full TypeScript Support with comprehensive type definitions
- Production-Ready Authentication with MFA/TOTP support
- Advanced Session Management with AES-256 encryption
⚡ Performance & Reliability
- Multi-Level Caching (memory + persistent)
- Smart Rate Limiting respects API boundaries
- Comprehensive Error Handling with retry logic
- Dual Package Support (CommonJS + ESM)
📦 Installation
npm install monarchmoney
🏃 Quick Start
Standard Usage
import { MonarchClient } from 'monarchmoney'
const client = new MonarchClient({
baseURL: 'https://api.monarchmoney.com',
timeout: 30000
})
// Login with credentials and MFA
await client.login({
email: '[email protected]',
password: 'your-password',
mfaSecretKey: 'your-mfa-secret' // Optional TOTP secret
})
// Get accounts with different verbosity levels
const accounts = await client.accounts.getAll({ verbosity: 'light' })
const transactions = await client.transactions.getTransactions({
limit: 10,
verbosity: 'ultra-light'
})
AI Assistant Integration
import { MonarchClient, ResponseFormatter } from 'monarchmoney'
const client = new MonarchClient(/* config */)
await client.login(/* credentials */)
// Get ultra-compact responses perfect for AI context
const accounts = await client.accounts.getAll({ verbosity: 'ultra-light' })
// Returns: "💰 12 accounts, Total: $145,678"
// Or format existing data for AI consumption
const formatted = ResponseFormatter.formatAccounts(rawAccounts, 'ultra-light')
const quickStats = ResponseFormatter.formatQuickStats(accounts, recentTransactions)
// Returns: "💰 $52,345 • ⬇️ -$3,200 • 📊 14 accounts"
🎯 Context Optimization Features
Verbosity Levels
Control response detail to optimize AI context usage:
| Level | Use Case | Characters/Item | Example |
|---|---|---|---|
ultra-light |
Quick overviews | ~60 chars | 💰 5 accounts, Total: $23,456 |
light |
Moderate detail | ~180 chars | Account names + balances + institutions |
standard |
Full analysis | ~800 chars | Complete account details + metadata |
Smart Query Selection
import { getQueryForVerbosity } from 'monarchmoney'
// Automatically select optimal GraphQL query
const query = getQueryForVerbosity('accounts', 'ultra-light')
// Returns optimized query with minimal fields
Response Formatters
import { ResponseFormatter } from 'monarchmoney'
// Ultra-compact account summary
const summary = ResponseFormatter.formatAccounts(accounts, 'ultra-light')
// "💰 12 accounts, Total: $145,678"
// Quick financial overview
const overview = ResponseFormatter.formatQuickStats(accounts, transactions)
// "💰 $52,345 • ⬇️ -$3,200 • 📊 14 accounts"
// Spending by category
const spending = ResponseFormatter.formatSpendingSummary(transactions, 5)
// "🍽️ $450 • ⛽ $280 • 🛒 $380 (top 3 this month)"
📚 API Documentation
Accounts API (15+ methods)
// Get accounts with verbosity control
const accounts = await client.accounts.getAll({
includeHidden: false,
verbosity: 'light'
})
// Get specific account details
const account = await client.accounts.getById('account-id')
// Get balance history
const history = await client.accounts.getBalanceHistory('account-id')
Transactions API (25+ methods)
// Get transactions with smart filtering
const transactions = await client.transactions.getTransactions({
limit: 50,
startDate: '2024-01-01',
endDate: '2024-01-31',
verbosity: 'ultra-light'
})
// Smart search with natural language
const amazonCharges = await client.transactions.smartQuery({
query: "last 5 Amazon charges over $50"
})
Budgets API (12+ methods)
// Get budget data
const budgets = await client.budgets.getBudgets({
startDate: '2024-01-01',
endDate: '2024-01-31'
})
// Get budget performance
const performance = await client.budgets.getBudgetSummary()
Categories & Insights APIs
// Get all categories
const categories = await client.categories.getCategories()
// Get financial insights
const insights = await client.insights.getNetWorthHistory()
// Get cashflow analysis
const cashflow = await client.cashflow.getCashflowSummary()
⚙️ Configuration
Client Configuration
const client = new MonarchClient({
baseURL: 'https://api.monarchmoney.com',
timeout: 30000,
retries: 3,
retryDelay: 1000,
rateLimit: {
requestsPerSecond: 10,
burstSize: 20
},
cache: {
enabled: true,
ttl: 300000, // 5 minutes
maxSize: 1000
}
})
Authentication Options
// Basic login
await client.login({
email: '[email protected]',
password: 'your-password'
})
// Login with MFA/TOTP
await client.login({
email: '[email protected]',
password: 'your-password',
mfaSecretKey: 'YOUR_TOTP_SECRET_KEY'
})
// Interactive login (prompts for credentials)
await client.interactiveLogin()
🎨 MCP Integration Example
Perfect for Claude Desktop and other Model Context Protocol integrations:
// MCP Tool Implementation
async function getAccountsSummary(verbosity = 'ultra-light') {
const accounts = await client.accounts.getAll({ verbosity })
// Returns context-optimized response:
// "💰 12 accounts, Total: $145,678"
return accounts
}
async function smartTransactionSearch(query: string) {
const result = await client.transactions.smartQuery({ query })
// Natural language to optimized GraphQL:
// "last 3 Amazon charges" → targeted GraphQL query
return ResponseFormatter.formatTransactions(result.transactions, 'light', query)
}
🧪 Testing & Coverage
Comprehensive test suite with 92%+ coverage on optimization features:
npm test # Run all tests
npm run test:unit # Run unit tests
npm run test:coverage # Run with coverage report
npm run test:integration # Integration tests (requires credentials)
Test Coverage:
- ResponseFormatter: 98% statement, 83% branch coverage
- Operations: 83% statement, 100% function coverage
- 37 comprehensive tests covering all optimization features
📊 Performance Metrics
Response Size Optimization
- Ultra-light: 99% reduction vs standard
- Light: 85% reduction vs standard
- Standard: Full API response
AI Context Benefits
- Unlimited conversations - no context overflow
- Sub-100ms formatting even with 1000+ accounts
- Professional emoji formatting for Claude Desktop
- Smart GraphQL selection minimizes API payload
🚀 CI/CD Pipeline
Automated testing across Node.js versions with:
- Unit Tests: 37 tests covering optimization features
- Performance Tests: Response time and size validation
- Security Audits: Dependency vulnerability scanning
- Integration Tests: Real API validation (when credentials provided)
- Coverage Enforcement: 90%+ coverage requirements
🛠️ Development
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test
# Run linting
npm run lint
# Run type checking
npm run type-check
📄 License
MIT License - see LICENSE file for details.
🙏 Acknowledgments
- Built on MonarchMoney's GraphQL API
- Inspired by hammem's Python library
- Optimized for AI assistant integrations and MCP protocol
📈 Project Stats
- 70+ API Methods - Complete MonarchMoney coverage
- 99% Context Reduction - Ultra-compact AI responses
- 3 Verbosity Levels - Flexible detail control
- 92%+ Test Coverage - Production-ready reliability
- Zero Dependencies - Minimal attack surface
- Claude Desktop Ready - Perfect MCP integration
Transform your financial data into AI-friendly insights 💰🤖
Perfect for Claude Desktop, MCP servers, and other AI assistant integrations requiring optimized context usage.# CI Test
Установить Monarchmoney в Claude Desktop, Claude Code, Cursor
unyly install monarchmoneyСтавит в Claude Desktop, Claude Code, Cursor и VS Code — сам разбирается с npx, uvx и сборкой из исходников.
Впервые? Поставь CLI: curl -fsSL https://unyly.org/install | sh
Или настроить вручную
Выполни в терминале:
claude mcp add monarchmoney -- npx -y monarchmoneyFAQ
Monarchmoney MCP бесплатный?
Да, Monarchmoney MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Monarchmoney?
Нет, Monarchmoney работает без API-ключей и переменных окружения.
Monarchmoney — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Monarchmoney в Claude Desktop, Claude Code или Cursor?
Открой Monarchmoney на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Stripe
Payments, customers, subscriptions
автор: Stripemalamutemayhem/unclick-agent-native-endpoints
110+ tools for AI agents spanning social media, finance, gaming, music, AU-specific services, and utilities. Zero-config local tools plus platform connectors. n
автор: malamutemayhemwhiteknightonhorse/APIbase
Unified API hub for AI agents with 56+ tools across travel (Amadeus, Sabre), prediction markets (Polymarket), crypto, and weather. Pay-per-call via x402 micropa
автор: whiteknightonhorsetrackerfitness729-jpg/sitelauncher-mcp-server
Deploy live HTTPS websites in seconds. Instant subdomains ($1 USDC) or custom .xyz domains ($10 USDC) on Base chain. Templates for crypto tokens and AI agent pr
Compare Monarchmoney with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории finance
