Skip to main content
Glama
whitebirchio

Monarch Money MCP Server

by whitebirchio

get_accounts

Retrieve all financial accounts from Monarch Money to view balances, track assets, and manage personal finances through integration with Claude Desktop.

Instructions

Get all financial accounts from Monarch Money

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/tools.ts:13-21 (registration)
    Tool registration for 'get_accounts' in the MCP tool definitions array, including name, description, and input schema (empty object, no required parameters)
    {
      name: 'get_accounts',
      description: 'Get all financial accounts from Monarch Money',
      inputSchema: {
        type: 'object',
        properties: {},
        required: [],
      },
    },
  • Route handler in executeTool switch statement that dispatches to getAccounts() method when tool name is 'get_accounts'
    case 'get_accounts':
      return await this.getAccounts();
  • Implementation of getAccounts() handler method that calls the API, formats the response with success/data/summary structure, and handles errors
    private async getAccounts(): Promise<any> {
      try {
        const accounts = await this.api.getAccounts();
        return {
          success: true,
          data: accounts,
          summary: `Found ${accounts?.length || 0} accounts`,
        };
      } catch (error) {
        throw new Error(
          `Failed to get accounts: ${
            error instanceof Error ? error.message : 'Unknown error'
          }`
        );
      }
    }
  • Underlying MonarchMoneyAPI.getAccounts() method that executes GraphQL query to fetch accounts with detailed fields and handles authentication errors
    async getAccounts(): Promise<Account[]> {
      const query = `
            query GetAccounts {
              accounts {
                ...AccountFields
                __typename
              }
              householdPreferences {
                id
                accountGroupOrder
                __typename
              }
            }
    
            fragment AccountFields on Account {
              id
              displayName
              syncDisabled
              deactivatedAt
              isHidden
              isAsset
              mask
              createdAt
              updatedAt
              displayLastUpdatedAt
              currentBalance
              displayBalance
              includeInNetWorth
              hideFromList
              hideTransactionsFromReports
              includeBalanceInNetWorth
              includeInGoalBalance
              dataProvider
              dataProviderAccountId
              isManual
              transactionsCount
              holdingsCount
              manualInvestmentsTrackingMethod
              order
              logoUrl
              type {
                display
                group
                name
                __typename
              }
              subtype {
                name
                display
                __typename
              }
              credential {
                id
                updateRequired
                disconnectedFromDataProviderAt
                dataProvider
                institution {
                  id
                  plaidInstitutionId
                  name
                  status
                  __typename
                }
                __typename
              }
              institution {
                id
                name
                primaryColor
                url
                __typename
              }
              __typename
            }
      `;
    
      try {
        const data: any = await this.graphQLClient.request(query);
        return data.accounts || [];
      } catch (error: any) {
        if (
          error.message.includes('401') ||
          error.message.includes('unauthorized')
        ) {
          throw new Error(
            'Authentication failed. Please check your MONARCH_TOKEN environment variable.'
          );
        }
        throw new Error(`Failed to get accounts: ${error.message}`);
      }
    }
  • TypeScript interface definition for Account type with properties like id, displayName, currentBalance, type, subtype, and institution
    export interface Account {
      id: string;
      mask: string | null;
      displayName: string;
      currentBalance: number;
      includeInNetWorth: boolean;
      type: {
        name: string;
        group: string;
        display: string;
      };
      subtype: {
        name: string;
        display: string;
      };
      institution?: {
        id: string;
        name: string;
      };
    }

Latest Blog Posts

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/whitebirchio/monarch-mcp'

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