A Model Context Protocol (MCP) server for tracking personal expenses and managing financial records using SQLite database.
- Add Expenses: Record expenses with amount, category, description, and date
- List Expenses: View and filter expenses by category, and date range
- SQLite Storage: All expenses are stored in a local SQLite database
- Type-Safe: Built with TypeScript and Zod for robust validation
- Node.js (v16 or higher)
- npm or yarn
- Claude Desktop App
- Clone the repository:
git clone https://github.com/Deepak-Dhungel/track-my-spend-mcp.git
cd track-my-spend-mcp- Install dependencies:
npm install- Build the project:
npm run buildAdd the server to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"TrackMySpend": {
"command": "node",
"args": ["/absolute/path/to/track-my-spend-mcp/build/server.js"],
}
}
}Replace /absolute/path/to/track-my-spend-mcp with the actual path to your project directory.
After configuration, restart Claude Desktop. You can then interact with the expense tracker through natural language:
"Add an expense of $50 for groceries"
"Track a $25 expense for lunch with description 'Team lunch at cafe'"
"Add $100 expense for travel on 2024-12-20"
"List my expenses"
"Show me all food expenses"
"List expenses from last week"
"Show the last 5 expenses"
Add a new expense to the tracker.
Parameters:
amount(number, required): Amount spent (must be >= 0)category(string, required): Category of expense (e.g., food, transport, entertainment)description(string, optional): Additional details about the expensedate(string, optional): Date in YYYY-MM-DD format (defaults to today)
List and filter expenses.
Parameters:
category(string, optional): Filter by specific categorystartDate(string, optional): Show expenses from this date onwards (YYYY-MM-DD)endDate(string, optional): Show expenses up to this date (YYYY-MM-DD)
track-my-spend-mcp/
├── src/
│ ├── db.ts # SQLite database configuration
│ ├── server.ts # MCP server setup and tool registration
│ └── tools/
│ ├── index.ts # Tool exports
│ ├── addExpense.ts # Add expense tool implementation
│ └── listExpenses.ts # List expenses tool implementation
├── build/ # Compiled JavaScript files
├── expenses.db # SQLite database (created automatically)
├── package.json
├── tsconfig.json
└── README.md
npm run buildRun the server directly to test:
node build/server.jsThe server communicates via stdio, so you won't see output unless there are errors (which go to stderr).
Check Claude Desktop logs:
macOS: ~/Library/Logs/Claude/mcp-server-TrackMySpend.log
Windows: %APPDATA%\Claude\logs\mcp-server-TrackMySpend.log
The expenses table structure:
CREATE TABLE expenses (
id INTEGER PRIMARY KEY AUTOINCREMENT,
amount REAL NOT NULL,
category TEXT NOT NULL,
description TEXT,
date TEXT NOT NULL
);- TypeScript: Type-safe development
- Model Context Protocol (MCP): Claude integration
- better-sqlite3: SQLite database operations
- Zod: Schema validation
- Node.js: Runtime environment
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
- Check that the path in
claude_desktop_config.jsonis correct and absolute - Ensure you've run
npm run buildafter making changes - Check the logs for specific error messages
- Restart Claude Desktop completely (quit and reopen)
- Verify Node.js is installed and accessible at the path specified
- Check file permissions on the build directory
- Ensure no
console.logstatements exist (useconsole.errorinstead)
For issues and questions, please open an issue on the GitHub repository.