Skip to main content
Glama
akutishevsky

LunchMoney MCP Server

get_all_crypto

Retrieve all cryptocurrency assets from your LunchMoney account to view your complete crypto portfolio holdings and track digital asset investments.

Instructions

Get a list of all cryptocurrency assets associated with the user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that fetches the user's cryptocurrency assets from the LunchMoney API endpoint `/crypto`, handles errors, and returns the assets as a JSON string in the MCP response format.
    async () => { const { baseUrl, lunchmoneyApiToken } = getConfig(); const response = await fetch(`${baseUrl}/crypto`, { headers: { Authorization: `Bearer ${lunchmoneyApiToken}`, }, }); if (!response.ok) { return { content: [ { type: "text", text: `Failed to get crypto assets: ${response.statusText}`, }, ], }; } const data = await response.json(); const cryptoAssets: Crypto[] = data.crypto; return { content: [ { type: "text", text: JSON.stringify(cryptoAssets), }, ], }; }
  • Registers the 'get_all_crypto' tool on the MCP server with its description, empty input schema, and inline handler function.
    "get_all_crypto", "Get a list of all cryptocurrency assets associated with the user", {}, async () => { const { baseUrl, lunchmoneyApiToken } = getConfig(); const response = await fetch(`${baseUrl}/crypto`, { headers: { Authorization: `Bearer ${lunchmoneyApiToken}`, }, }); if (!response.ok) { return { content: [ { type: "text", text: `Failed to get crypto assets: ${response.statusText}`, }, ], }; } const data = await response.json(); const cryptoAssets: Crypto[] = data.crypto; return { content: [ { type: "text", text: JSON.stringify(cryptoAssets), }, ], }; } );
  • src/index.ts:31-31 (registration)
    Invokes the registration of crypto tools, including 'get_all_crypto', on the main MCP server instance.
    registerCryptoTools(server);
  • Helper function that registers both crypto-related tools on the MCP server.
    export function registerCryptoTools(server: McpServer) { server.tool( "get_all_crypto", "Get a list of all cryptocurrency assets associated with the user", {}, async () => { const { baseUrl, lunchmoneyApiToken } = getConfig(); const response = await fetch(`${baseUrl}/crypto`, { headers: { Authorization: `Bearer ${lunchmoneyApiToken}`, }, }); if (!response.ok) { return { content: [ { type: "text", text: `Failed to get crypto assets: ${response.statusText}`, }, ], }; } const data = await response.json(); const cryptoAssets: Crypto[] = data.crypto; return { content: [ { type: "text", text: JSON.stringify(cryptoAssets), }, ], }; } ); server.tool( "update_manual_crypto", "Update a manually-managed cryptocurrency asset balance", { input: z.object({ crypto_id: z .number() .describe("ID of the crypto asset to update"), balance: z .number() .optional() .describe("Updated balance of the crypto asset"), }), }, async ({ input }) => { const { baseUrl, lunchmoneyApiToken } = getConfig(); const body: any = {}; if (input.balance !== undefined) { body.balance = input.balance.toString(); } const response = await fetch(`${baseUrl}/crypto/manual/${input.crypto_id}`, { method: "PUT", headers: { Authorization: `Bearer ${lunchmoneyApiToken}`, "Content-Type": "application/json", }, body: JSON.stringify(body), }); if (!response.ok) { return { content: [ { type: "text", text: `Failed to update crypto asset: ${response.statusText}`, }, ], }; } const result = await response.json(); return { content: [ { type: "text", text: JSON.stringify(result), }, ], }; } ); }

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/akutishevsky/lunchmoney-mcp'

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