Socket
Book a DemoInstallSign in
Socket

expense-log-mcp

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expense-log-mcp

A MCP server that provides tools for logging expenses.

1.0.10
latest
Source
npmnpm
Version published
Weekly downloads
732
Maintainers
1
Weekly downloads
 
Created
Source

Expense Log MCP

A MCP server that provides tools for logging expenses.

✨ Features

  • Log a new expense to a ledger.
  • Delete an expense record.
  • Retrieve a list of all available expense categories.
  • Retrieve and group expenses by payer and category.

🚀 Getting Started

Prerequisites

  • Node.js
  • A PostgreSQL database

Installation & Setup

  • Clone the repository:

    git clone https://github.com/evanxd/expense-log-mcp.git
    
  • Install dependencies:

    npm install
    
  • Set up the database:

    • Create a .env file in the root of the project.
    • Add your PostgreSQL connection string to the .env file:
      DB_USER="postgres"
      DB_HOST="localhost"
      DB_PORT="5432"
      DB_DATABASE="postgres"
      DB_PASSWORD="YOUR_DB_PASSWORD"
      DATABASE_URL="postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_DATABASE}?schema=public"
      
    • Apply the database schema:
      npx prisma db push
      
    • Seed the database with initial categories:
      npm run db:seed
      
  • Build the project:

    npm run build
    
  • Set up the MCP server:

    • Add the following configuration to your MCP host (e.g., Gemini CLI) settings:
    "mcpServers": {
      "expense-log-mcp": {
        "command": "node",
        "args": [
          "/path/to/expense-log-mcp/dist/index.js"
        ],
        "env": {
          "DATABASE_URL": "postgresql://postgres:YOUR_DB_PASSWORD@localhost:5432/postgres?schema=public"
        }
      }
    }
    

🛠️ Tools

The server exposes the following tools:

addExpense

Adds a new expense record.

Parameters:

NameTypeDescription
ledgerIdstringThe ID of the ledger to add the expense to.
categoryIdstringThe ID of the expense category.
messageIdstringA unique ID for the message to prevent duplicates.
descriptionstringA description of the expense.
amountnumberThe amount of the expense.
payerstringThe name of the person who paid.

Returns:

A JSON string confirming the expense has been added, e.g.:

{
  "success": true,
  "code": "OK",
  "message": "Expense added successfully.",
  "data": {
    "expenseId": "clx...456"
  }
}

deleteExpense

Deletes an expense record.

Parameters:

NameTypeDescription
ledgerIdstringThe ID of the ledger the expense belongs to.
messageIdstringThe unique message ID of the expense to be deleted.

Returns:

A JSON string confirming the expense has been deleted, and including details of the deleted expense, e.g.:

{
  "success": true,
  "code": "OK",
  "message": "Expense deleted successfully.",
  "data": {
    "id": "clx...123",
    "description": "Lunch",
    "amount": 15.75,
    "createdAt": "Sun Sep 07 2025"
  }
}

getExpenseCategories

Retrieves the list of all expense categories.

Parameters:

None.

Returns:

A JSON string containing the list of expense categories, e.g.:

{
  "success": true,
  "code": "OK",
  "message": "Expense categories retrieved successfully.",
  "data": [
    {
      "expenseCategoryId": "clx...1",
      "expenseCategoryName": "Transportation"
    },
    {
      "expenseCategoryId": "clx...2",
      "expenseCategoryName": "Utilities"
    }
  ]
}

getGroupedExpenses

Retrieves and groups expenses by payer and then by category name, returning the total amount for each category, with optional filters for category IDs, payer, and a date range.

Parameters:

NameTypeDescription
ledgerIdstringThe ID of the ledger to retrieve expenses from.
categoryIdsstring[]Optional. An array of category IDs to filter by.
payerstringOptional. The name of the payer to filter by.
startDatestringOptional. The start date for filtering expenses (ISO 8601 format).
endDatestringOptional. The end date for filtering expenses (ISO 8601 format).

Returns:

A JSON string containing the grouped expenses, e.g.:

{
  "success": true,
  "code": "OK",
  "message": "Grouped expenses retrieved successfully.",
  "data": {
    "Payer1": {
      "expenseCategories": {
        "Entertainment": 100,
        "Transportation": 50
      },
      "totalAmount": 150
    },
    "Payer2": {
      "expenseCategories": {
        "Dining/Snacks": 75
      },
      "totalAmount": 75
    }
  }
}

🗄️ Database Schema

This project uses Prisma to manage the database schema. The schema is defined in prisma/schema.prisma and includes the following models:

  • Ledger: Represents a collection of expenses.
  • ExpenseCategory: Represents a category for an expense.
  • Expense: Represents a single expense record. A unique constraint is added on ledgerId and messageId to prevent duplicate expenses.

All models include createdAt and updatedAt timestamps. IDs are generated using cuid().

🙌 Contributing

Contributions are welcome! Please feel free to submit a pull request.

📄 License

This project is licensed under the MIT License.

Keywords

mcp

FAQs

Package last updated on 07 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.