@expensebot/mcp-server-auth 0.6.21 → 0.6.23

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/README.md CHANGED
@@ -8,15 +8,15 @@
8
8
 
9
9
  Authenticated MCP (Model Context Protocol) server for [ExpenseBot](https://www.expensebot.ai). Lets Copilot, Gemini, Replit, Cursor, Claude Desktop, Claude Code, Continue, Cline, Windsurf, and other MCP-compatible assistants search receipts, submit photos and PDFs, scan Gmail, create reports, and analyze spending using your real ExpenseBot account.
10
10
 
11
- **54 tools** across:
11
+ **Tools** across:
12
12
  - **Search & analytics** — `search_expenses`, `get_spending_summary`, `get_deep_analytics`, `list_categories`, `list_tags`, `list_income_categories`, `search_knowledge`
13
13
  - **Income & P&L** *(v0.6.0)* — `get_income_summary`, `get_pnl`, `get_per_tag_pnl`
14
14
  - **Mileage & Subscriptions** *(v0.6.1)* — `get_mileage_summary`, `get_subscription_audit`
15
15
  - **Receipt and expense capture** — `submit_receipt` (photo/PDF), `get_last_receipt_result`, `add_cash_expense` (including confirmed client advances), `add_mileage_entry`, `add_income`, `add_income_from_file` (screenshot/PDF, parse-preview-confirm), `add_income_from_csv` (CSV/TSV/text, parse-preview-confirm), `parse_expense`, `get_expense_by_id`, `update_expense`, `group_expenses`, `correct_expenses`, `get_spreadsheet_url`
16
16
  - **Gmail** — `scan_gmail`, `process_gmail_receipts`, `scan_gmail_years`, `get_scan_status`
17
- - **Reports & invoicing** — `create_report`, `list_reports`, `get_report_details`, `share_report`, `export_report`, `list_client_invoices`
18
- - **Expense review** — `get_expense_splits`, `get_monthly_books_review`, `get_credits_refunds`, `get_client_advance_balances`
19
- - **Accounting destinations** — `get_accounting_integration_status`, `send_report_to_accounting`, `get_accounting_push_status` (provider-neutral review/confirm/status contract; Zoho Books is the first enabled adapter)
17
+ - **Reports & invoicing** — `create_report`, `list_reports`, `get_report_details`, `share_report`, `export_report`, `list_client_invoices`, `get_client_invoice`, `prepare_client_invoice`, `create_client_invoice`, `mark_client_invoice_paid`
18
+ - **Expense review** — `get_expense_splits`, `get_monthly_books_review`, `get_credits_refunds`, `get_client_advance_balances`, `get_trip_suggestions` (read-only exact trip proposals; grouping still requires confirmation)
19
+ - **Accounting destinations** — `get_accounting_integration_status`, `send_report_to_accounting`, `get_accounting_push_status`, `request_accounting_integration` (provider-neutral review/confirm/status contract plus a confirmed, deduplicated request for an unlisted package; agent-driven posting is currently enabled only for Zoho Books; QuickBooks Online, Xero, Wave, and FreeAgent (beta) are read-only status/push-status only until their canonical planning path is shared)
20
20
  - **Compliance & tax** — `check_compliance`, `fix_compliance`, `check_tax_deductibility`
21
21
  - **Activity, tracing & onboarding** — `get_recent_activity`, `trace_document`, `get_signup_link`, `get_pricing`, `check_feature`, `start_trial_link`
22
22
  - **Business what-if** — `whatif_afford`, `whatif_client`, `whatif_tax_setaside`
@@ -110,7 +110,7 @@ transport and authentication support.
110
110
  ## Token model
111
111
 
112
112
  - **Personal Access Tokens (PAT)** scoped to your ExpenseBot account
113
- - **Configurable expiry**, revokable instantly from Settings → AI Assistant Tokens
113
+ - **Stays valid for as long as you use it** (a token unused for a year lapses), revokable instantly from Settings → AI Assistant Tokens
114
114
  - **Max 5 active tokens per user** — generate one per device/AI client
115
115
  - All actions audit-logged server-side
116
116
  - Tokens stored as SHA-256 hashes; CASA Tier 2 certified
@@ -118,7 +118,7 @@ transport and authentication support.
118
118
  ## Discovery
119
119
 
120
120
  - **Official MCP Registry** — active as
121
- `io.github.TotesMagotes/mcp-server-auth`; version `0.6.21` is the current
121
+ `io.github.TotesMagotes/mcp-server-auth`; version `0.6.23` is the current
122
122
  listing with both npm stdio and remote Streamable HTTP transports
123
123
  - **awesome-mcp-servers** — Finance & Fintech section
124
124
  - **Glama** — <https://glama.ai/mcp/servers/TotesMagotes/expensebot>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expensebot/mcp-server-auth",
3
- "version": "0.6.21",
3
+ "version": "0.6.23",
4
4
  "mcpName": "io.github.TotesMagotes/mcp-server-auth",
5
5
  "description": "ExpenseBot MCP server for receipt and income capture, Gmail scans, spending analytics, and reviewed expense reports from AI assistants.",
6
6
  "homepage": "https://www.expensebot.ai/mcp",
@@ -19,7 +19,8 @@
19
19
  "files": [
20
20
  "src",
21
21
  "scripts",
22
- "README.md"
22
+ "README.md",
23
+ "server.json"
23
24
  ],
24
25
  "keywords": [
25
26
  "mcp",
@@ -19,8 +19,10 @@
19
19
  */
20
20
 
21
21
  import fs from "node:fs";
22
+ import crypto from "node:crypto";
22
23
  import path from "node:path";
23
24
  import { fileURLToPath } from "node:url";
25
+ import { createRequire } from "node:module";
24
26
 
25
27
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
26
28
  const ROOT = path.resolve(__dirname, "..");
@@ -51,6 +53,16 @@ if (!toolBlock) {
51
53
  }
52
54
  }
53
55
 
56
+ const sharedSchemaPattern = /\nconst ([A-Z_][A-Z0-9_]+_SCHEMA)\s*=\s*\{[\s\S]*?\n\};\n/g;
57
+ const sourceCatalog =
58
+ [...indexSrc.matchAll(sharedSchemaPattern)].map((m) => m[0]).join("\n") +
59
+ "\n" +
60
+ (toolBlock?.[1] || "");
61
+ const sourceCatalogSha256 = crypto
62
+ .createHash("sha256")
63
+ .update(sourceCatalog)
64
+ .digest("hex");
65
+
54
66
  // Extract case-branch handlers from handleTool()
55
67
  const caseRe = /\bcase\s+"([a-z_][a-z0-9_]*)":/g;
56
68
  const cases = new Set();
@@ -113,6 +125,11 @@ if (serverVersion && pkg.version !== serverVersion) {
113
125
  `Version drift: package.json=${pkg.version} vs src/index.js Server=${serverVersion}`
114
126
  );
115
127
  }
128
+ if (Array.isArray(pkg.files) && !pkg.files.includes("server.json")) {
129
+ fail(
130
+ "package.json files[] omits server.json, so the published sync-check command cannot run"
131
+ );
132
+ }
116
133
 
117
134
  // ── 5. server.json ──────────────────────────────────────────────────
118
135
  const serverJson = JSON.parse(
@@ -153,6 +170,133 @@ if (advertisedCount !== null && advertisedCount !== tools.length) {
153
170
  );
154
171
  }
155
172
 
173
+ // ── 8. Canonical current-count drift guard (monorepo) ───────────────
174
+ // The /mcp client inventory (client/src/data/mcpTools.generated.json), the
175
+ // committed remote connector manifest, and the runtime ChatWidget
176
+ // declarations are generated surfaces of this package's TOOLS[] catalog.
177
+ // These checks are dormant by design: they only fail when one committed
178
+ // surface drifts from another (or from the current ChatWidget count), so a
179
+ // future tool addition cannot silently stale the advertised inventory
180
+ // documentation. They never parse prose. When the package is checked out
181
+ // without its monorepo siblings these cross-package checks degrade to a
182
+ // warning and the package-internal checks remain the gate.
183
+ const require = createRequire(import.meta.url);
184
+ const clientMetaPath = path.join(
185
+ ROOT,
186
+ "..",
187
+ "client",
188
+ "src",
189
+ "data",
190
+ "mcpTools.generated.json"
191
+ );
192
+ const remoteManifestPath = path.join(
193
+ ROOT,
194
+ "..",
195
+ "mcp-server-remote",
196
+ "src",
197
+ "tools.generated.json"
198
+ );
199
+ const chatDeclarationsPath = path.join(
200
+ ROOT,
201
+ "..",
202
+ "server",
203
+ "config",
204
+ "chatToolDeclarations.js"
205
+ );
206
+
207
+ let clientStdioTotal = null;
208
+ let clientRemoteTotal = null;
209
+ let remoteManifestTotal = null;
210
+ let chatToolCount = null;
211
+
212
+ if (fs.existsSync(clientMetaPath) && fs.existsSync(remoteManifestPath)) {
213
+ const clientMeta = JSON.parse(fs.readFileSync(clientMetaPath, "utf8"));
214
+ clientStdioTotal = clientMeta.stdioTotal;
215
+ clientRemoteTotal = clientMeta.remoteTotal;
216
+ if (clientStdioTotal !== tools.length) {
217
+ fail(
218
+ `client inventory stdioTotal=${clientStdioTotal} but src/index.js ` +
219
+ `declares ${tools.length} (regenerate with \`npm run build:mcp-tools\` ` +
220
+ `and commit the generated file)`
221
+ );
222
+ }
223
+
224
+ const remoteManifest = JSON.parse(
225
+ fs.readFileSync(remoteManifestPath, "utf8")
226
+ );
227
+ const manifestTools = Array.isArray(remoteManifest)
228
+ ? remoteManifest
229
+ : remoteManifest.tools || [];
230
+ remoteManifestTotal = manifestTools.length;
231
+ if (remoteManifest._meta?.sourceCatalogSha256 !== sourceCatalogSha256) {
232
+ fail(
233
+ "Remote manifest content hash does not match the stdio tool catalog " +
234
+ "(run `cd mcp-server-remote && npm run sync-tools` and commit the result)"
235
+ );
236
+ }
237
+ if (manifestTools.length !== tools.length) {
238
+ fail(
239
+ `remote manifest lists ${manifestTools.length} tools but src/index.js ` +
240
+ `declares ${tools.length} (regenerate with ` +
241
+ `\`cd mcp-server-remote && npm run sync-tools\` and commit)`
242
+ );
243
+ }
244
+
245
+ // Remote surface = manifest − EXCLUDED_TOOLS + the two Deep Research shims
246
+ // (search, fetch). Mirrors scripts/generate-mcp-tool-inventory.js.
247
+ const remoteToolsSrc = fs.readFileSync(
248
+ path.join(ROOT, "..", "mcp-server-remote", "src", "tools.js"),
249
+ "utf8"
250
+ );
251
+ const excludedBlock = remoteToolsSrc.match(
252
+ /EXCLUDED_TOOLS\s*=\s*new Set\(\[([\s\S]*?)\]\)/
253
+ );
254
+ const excludedCount = excludedBlock
255
+ ? new Set([...excludedBlock[1].matchAll(/"([a-z_]+)"/g)].map((m) => m[1]))
256
+ .size
257
+ : 0;
258
+ const derivedRemoteTotal = manifestTools.length - excludedCount + 2;
259
+ if (clientRemoteTotal !== derivedRemoteTotal) {
260
+ fail(
261
+ `client inventory remoteTotal=${clientRemoteTotal} but manifest yields ` +
262
+ `${derivedRemoteTotal} (${manifestTools.length} − ${excludedCount} ` +
263
+ `excluded + 2 Deep Research shims)`
264
+ );
265
+ }
266
+ } else {
267
+ warn(
268
+ "Monorepo artifacts not found under ../ — skipping client/remote " +
269
+ "cross-package count checks"
270
+ );
271
+ }
272
+
273
+ // The ChatWidget surface is derived at runtime from the same manifest plus
274
+ // tool/action policy; no committed artifact records its count, so the
275
+ // expected value is pinned here and must be bumped in lockstep with
276
+ // docs/architecture/mcp-conversational-functionality-catalog.md "Current
277
+ // counts" whenever the in-app surface deliberately changes.
278
+ const EXPECTED_CHAT_TOOL_COUNT = 44;
279
+ if (fs.existsSync(chatDeclarationsPath)) {
280
+ try {
281
+ chatToolCount = require(chatDeclarationsPath).getChatToolDeclarations()
282
+ .length;
283
+ } catch (err) {
284
+ fail(`Could not load server/config/chatToolDeclarations.js: ${err.message}`);
285
+ }
286
+ if (chatToolCount !== EXPECTED_CHAT_TOOL_COUNT) {
287
+ fail(
288
+ `ChatWidget declarations=${chatToolCount} but expected ` +
289
+ `${EXPECTED_CHAT_TOOL_COUNT} — bump EXPECTED_CHAT_TOOL_COUNT and the ` +
290
+ `catalog inventory together`
291
+ );
292
+ }
293
+ } else {
294
+ warn(
295
+ "server/config/chatToolDeclarations.js not found — skipping ChatWidget " +
296
+ "count check"
297
+ );
298
+ }
299
+
156
300
  // ── Report ──────────────────────────────────────────────────────────
157
301
  console.log(`\n=== MCP server-auth sync-check ===`);
158
302
  console.log(`Tools declared: ${tools.length}`);
@@ -166,6 +310,12 @@ console.log(
166
310
  `Advertised tool count: ${advertisedCount ?? "n/a"}` +
167
311
  (usesDynamicAdvertisedCount ? " (dynamic)" : "")
168
312
  );
313
+ console.log(`Client inventory: ${clientStdioTotal ?? "n/a"} stdio / ${clientRemoteTotal ?? "n/a"} remote`);
314
+ console.log(`Remote manifest: ${remoteManifestTotal ?? "n/a"} tools`);
315
+ console.log(
316
+ `ChatWidget surface: ${chatToolCount ?? "n/a"} tools` +
317
+ (chatToolCount !== null ? ` (expected ${EXPECTED_CHAT_TOOL_COUNT})` : "")
318
+ );
169
319
  console.log("");
170
320
 
171
321
  if (warnings.length) {
package/server.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.TotesMagotes/mcp-server-auth",
4
+ "title": "ExpenseBot",
5
+ "description": "Capture receipts, scan Gmail, analyze spending, and create reviewed reports from AI assistants.",
6
+ "repository": {
7
+ "url": "https://github.com/TotesMagotes/expensebot-mcp",
8
+ "source": "github"
9
+ },
10
+ "version": "0.6.23",
11
+ "websiteUrl": "https://www.expensebot.ai/mcp",
12
+ "icons": [
13
+ {
14
+ "src": "https://raw.githubusercontent.com/TotesMagotes/expensebot-mcp/main/assets/expensebot.png",
15
+ "mimeType": "image/png",
16
+ "sizes": [
17
+ "400x400"
18
+ ]
19
+ }
20
+ ],
21
+ "remotes": [
22
+ {
23
+ "type": "streamable-http",
24
+ "url": "https://mcp.expensebot.ai/mcp"
25
+ }
26
+ ],
27
+ "packages": [
28
+ {
29
+ "registryType": "npm",
30
+ "identifier": "@expensebot/mcp-server-auth",
31
+ "version": "0.6.23",
32
+ "transport": {
33
+ "type": "stdio"
34
+ }
35
+ }
36
+ ]
37
+ }
package/src/client.js CHANGED
@@ -46,7 +46,7 @@ export class ExpenseBotClient {
46
46
  headers: {
47
47
  Authorization: `Bearer ${this.token}`,
48
48
  "Content-Type": "application/json",
49
- "User-Agent": "expensebot-mcp-auth/0.6.21",
49
+ "User-Agent": "expensebot-mcp-auth/0.6.23",
50
50
  "X-ExpenseBot-MCP-Transport": "stdio",
51
51
  ...options.headers,
52
52
  },