Working with MCP

Remote MCP with Azure Container Apps (Node.js/TypeScript/JavaScript)

How to build an expense tracking app with MCP and Agent VSCode

Following the guide here I was able to start using the MCP with Agent in VSCode.

First, I start the prompt “I need to modify the tools to add the models for an expense tracking tools, Date Description Amount Category are the required fields. Later on, I want to have the ability to add/remove/edit the transaction, also query by months, classify highest spending category.”

GitHub Copilot
To add models for an expense tracking tool, you'll need to define a structure for expenses with the required fields: Date, Description, Amount, and Category. You will also need to implement functions to add, remove, edit, and query expenses, as well as classify the highest spending category and provide recommendations.

The first step is to define the expense model and basic CRUD operations in your data layer (db.ts). Then, you can expose these as tools in tools.ts, similar to how the TODO tools are structured.

I'll start by adding the model and function stubs for expenses in db.ts.

Read db.ts, lines 1 to 50

Read db.ts, lines 51 to 68

I have the context for your data layer. Next, I will:

Add an expenses table with fields: id, date, description, amount, category.
Implement functions in db.ts for:
Adding an expense
Listing all expenses
Deleting an expense
Updating an expense
Querying expenses by month
Getting the highest spending category
(Stub) Recommendation logic
After that, I will update tools.ts to expose these as tools. Let's start by updating db.ts.

db.ts
Read tools.ts, lines 1 to 10

Read tools.ts, lines 11 to 108

Now I will add a new ExpenseTools array in tools.ts to expose the expense tracking operations, following the same structure as TodoTools. This will include add, list, delete, update, query by month, get highest spending category, and get recommendations.

tools.ts+133-0
There are TypeScript errors due to missing type annotations for the expense objects in the new tools. I will fix these by adding explicit type assertions for the expense objects and query results in the relevant places within the ExpenseTools array.

tools.ts+13-8
The error is because TypeScript infers the array elements as unknown. To resolve this, I need to cast the expenses array to the correct type before mapping. I will update the relevant lines to cast the arrays to the expected expense type.

tools.ts+5-11
The expense tracking model and tools are now added. You can add, remove, edit, and query expenses, as well as get the highest spending category and recommendations, using the new ExpenseTools array in tools.ts.

The agent can recognize the error in typescript and fix itself.

Then I gave it a csv file with all transactions to import: First attempt: It wasn’t able to reuse the mcp command to import but suggesting the script to manually insert to db Second attempt: After removing the unused code from Todo and restart the server:

To add the expenses from activity.csv, I will parse each row and add it as an expense. The system expects the date in YYYY-MM-DD format, a description, an amount (as a number), and a category. Since the CSV does not include a category, I will use a default category such as "Uncategorized" for each entry.

I will now process and add these expenses.

mcp-server-sse (MCP Server)
mcp-server-sse (MCP Server)

list all expenses in June 2025

mcp-server-sse (MCP Server)
Here are all expenses recorded for June 2025:

2025-06-19 | LONDON NORTH EASTERN RAILWAY | $-1.86
2025-06-19 | TEMU.COM TEMU.COM LONDON | $15.95
2025-06-18 | LNER WEB/APP YORK | $18.60
2025-06-17 | AMZNMKTPLACE AMAZON.CO.UK | $-11.35
2025-06-17 | LONDON NORTH EASTERN RAILWAY | $-0.29
2025-06-16 | GAIL'S BRACKNELL BRACKNELL | $4.50
2025-06-16 | LNER WEB/APP YORK | $2.90
2025-06-16 | LONDON NORTH EASTERN RAILWAY | $-0.29
2025-06-16 | M&S READING READING | $18.00
2025-06-15 | H&M BRACKNELL | $15.00
2025-06-15 | HOLLAND & BARRETT BRACK BRACKNELL | $6.50
2025-06-15 | HOTEL CHOCOLAT RETAIL BRACKNELL | $4.36
2025-06-14 | LNER WEB/APP YORK | $2.90
2025-06-13 | AMZNMKTPLACE AMAZON.CO.UK | $-8.26
2025-06-12 | LONDON NORTH EASTERN RAILWAY | $-1.86
2025-06-11 | LNER WEB/APP YORK | $18.60
2025-06-07 | PRET A MANGER Gatwick | $4.45
2025-06-06 | CREDIT ADJUSTMENT | $-1.81
2025-06-06 | CREDIT ADJUSTMENT | $-0.29
2025-06-06 | LONDON NORTH EASTERN RAILWAY | $-1.81
All are categorized as "Uncategorized." If you want to import more or need a summary, let me know!

summarize the total expenses this month

GitHub Copilot
mcp-server-sse (MCP Server)
The total expenses for June 2025 are calculated as follows:

Sum = -1.86 + 15.95 + 18.60 + (-11.35) + (-0.29) + 4.50 + 2.90 + (-0.29) + 18.00 + 15.00 + 6.50 + 4.36 + 2.90 + (-8.26) + (-1.86) + 18.60 + 4.45 + (-1.81) + (-0.29) + (-1.81)

Total expenses for June 2025: $87.64

This is the net sum of all recorded transactions for the month. If you need a breakdown or more details, let me know!
Jasmine Nguyen