@sheetlink/mcp 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +10 -6
- package/package.json +2 -2
- package/src/index.ts +12 -9
package/dist/index.js
CHANGED
|
@@ -89,8 +89,11 @@ async function listTransactions(args) {
|
|
|
89
89
|
// Filter by category
|
|
90
90
|
if (args.category) {
|
|
91
91
|
const cat = args.category.toUpperCase();
|
|
92
|
-
allTransactions = allTransactions.filter((t) =>
|
|
93
|
-
|
|
92
|
+
allTransactions = allTransactions.filter((t) => {
|
|
93
|
+
const pfc = t.personal_finance_category;
|
|
94
|
+
return ((pfc?.primary ?? "").toUpperCase().includes(cat) ||
|
|
95
|
+
(pfc?.detailed ?? "").toUpperCase().includes(cat));
|
|
96
|
+
});
|
|
94
97
|
}
|
|
95
98
|
// Sort newest first
|
|
96
99
|
allTransactions.sort((a, b) => b.date.localeCompare(a.date));
|
|
@@ -103,8 +106,9 @@ async function listTransactions(args) {
|
|
|
103
106
|
}
|
|
104
107
|
const lines = transactions.map((t) => {
|
|
105
108
|
const amount = typeof t.amount === "number" ? t.amount.toFixed(2) : t.amount;
|
|
106
|
-
const name = t.merchant_name ?? t.
|
|
107
|
-
const
|
|
109
|
+
const name = t.merchant_name ?? t.description_raw ?? "Unknown";
|
|
110
|
+
const pfc = t.personal_finance_category;
|
|
111
|
+
const cat = pfc?.primary ?? "";
|
|
108
112
|
return `${t.date} ${String(name).padEnd(35)} $${String(amount).padStart(8)} ${cat}`;
|
|
109
113
|
});
|
|
110
114
|
const header = `${"Date".padEnd(10)} ${"Merchant".padEnd(35)} ${"Amount".padStart(9)} Category`;
|
|
@@ -145,8 +149,8 @@ async function getSpendingSummary(args) {
|
|
|
145
149
|
const totals = {};
|
|
146
150
|
for (const t of allTransactions) {
|
|
147
151
|
const key = groupBy === "merchant"
|
|
148
|
-
? (t.merchant_name ?? t.
|
|
149
|
-
: (t.
|
|
152
|
+
? (t.merchant_name ?? t.description_raw ?? "Unknown")
|
|
153
|
+
: ((t.personal_finance_category?.primary) ?? "Uncategorized");
|
|
150
154
|
totals[key] = (totals[key] ?? 0) + t.amount;
|
|
151
155
|
}
|
|
152
156
|
// Sort by spend descending
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheetlink/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "MCP server for SheetLink — connect Claude to your bank transactions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
"@types/node": "^20.0.0"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
|
-
"node": ">=
|
|
23
|
+
"node": ">=16"
|
|
24
24
|
}
|
|
25
25
|
}
|
package/src/index.ts
CHANGED
|
@@ -120,11 +120,13 @@ async function listTransactions(args: {
|
|
|
120
120
|
// Filter by category
|
|
121
121
|
if (args.category) {
|
|
122
122
|
const cat = args.category.toUpperCase();
|
|
123
|
-
allTransactions = allTransactions.filter(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
(
|
|
127
|
-
|
|
123
|
+
allTransactions = allTransactions.filter((t) => {
|
|
124
|
+
const pfc = t.personal_finance_category as { primary?: string; detailed?: string } | null;
|
|
125
|
+
return (
|
|
126
|
+
(pfc?.primary ?? "").toUpperCase().includes(cat) ||
|
|
127
|
+
(pfc?.detailed ?? "").toUpperCase().includes(cat)
|
|
128
|
+
);
|
|
129
|
+
});
|
|
128
130
|
}
|
|
129
131
|
|
|
130
132
|
// Sort newest first
|
|
@@ -143,8 +145,9 @@ async function listTransactions(args: {
|
|
|
143
145
|
|
|
144
146
|
const lines = transactions.map((t) => {
|
|
145
147
|
const amount = typeof t.amount === "number" ? t.amount.toFixed(2) : t.amount;
|
|
146
|
-
const name = t.merchant_name ?? t.
|
|
147
|
-
const
|
|
148
|
+
const name = t.merchant_name ?? t.description_raw ?? "Unknown";
|
|
149
|
+
const pfc = t.personal_finance_category as { primary?: string } | null;
|
|
150
|
+
const cat = pfc?.primary ?? "";
|
|
148
151
|
return `${t.date} ${String(name).padEnd(35)} $${String(amount).padStart(8)} ${cat}`;
|
|
149
152
|
});
|
|
150
153
|
|
|
@@ -205,8 +208,8 @@ async function getSpendingSummary(args: {
|
|
|
205
208
|
for (const t of allTransactions) {
|
|
206
209
|
const key =
|
|
207
210
|
groupBy === "merchant"
|
|
208
|
-
? ((t.merchant_name ?? t.
|
|
209
|
-
: ((t.
|
|
211
|
+
? ((t.merchant_name ?? t.description_raw ?? "Unknown") as string)
|
|
212
|
+
: (((t.personal_finance_category as { primary?: string } | null)?.primary) ?? "Uncategorized");
|
|
210
213
|
totals[key] = (totals[key] ?? 0) + (t.amount as number);
|
|
211
214
|
}
|
|
212
215
|
|