ofw-mcp 1.5.2 → 1.5.4

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/bundle.js CHANGED
@@ -21145,13 +21145,13 @@ async function handleTool2(name, args, client2) {
21145
21145
  const messages = listData.data ?? [];
21146
21146
  const unread = [];
21147
21147
  for (const msg of messages) {
21148
- const detail = await client2.request("GET", `/pub/v3/messages/${msg.id}`);
21149
- const unreadRecipients = (detail.recipients ?? []).filter((r) => !r.viewed).map((r) => r.user.name);
21148
+ if (!msg.showNeverViewed) continue;
21149
+ const unreadRecipients = (msg.recipients ?? []).filter((r) => !r.viewed).map((r) => r.user.name);
21150
21150
  if (unreadRecipients.length > 0) {
21151
21151
  unread.push({
21152
- id: detail.id,
21153
- subject: detail.subject,
21154
- sentAt: detail.date.dateTime,
21152
+ id: msg.id,
21153
+ subject: msg.subject,
21154
+ sentAt: msg.date.dateTime,
21155
21155
  unreadBy: unreadRecipients
21156
21156
  });
21157
21157
  }
@@ -21381,7 +21381,7 @@ for (const tool of toolDefinitions3) handlers[tool.name] = (n, a) => handleTool3
21381
21381
  for (const tool of toolDefinitions4) handlers[tool.name] = (n, a) => handleTool4(n, a, client);
21382
21382
  for (const tool of toolDefinitions5) handlers[tool.name] = (n, a) => handleTool5(n, a, client);
21383
21383
  var server = new Server(
21384
- { name: "ofw", version: "1.0.1" },
21384
+ { name: "ofw", version: "1.5.4" },
21385
21385
  { capabilities: { tools: {} } }
21386
21386
  );
21387
21387
  server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: allTools }));
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ for (const tool of expenseTools)
26
26
  handlers[tool.name] = (n, a) => handleExpenses(n, a, client);
27
27
  for (const tool of journalTools)
28
28
  handlers[tool.name] = (n, a) => handleJournal(n, a, client);
29
- const server = new Server({ name: 'ofw', version: '1.0.1' }, { capabilities: { tools: {} } });
29
+ const server = new Server({ name: 'ofw', version: '1.5.4' }, { capabilities: { tools: {} } });
30
30
  server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: allTools }));
31
31
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
32
32
  const { name, arguments: args = {} } = request.params;
@@ -190,22 +190,25 @@ export async function handleTool(name, args, client) {
190
190
  const sentFolder = (foldersData.systemFolders ?? []).find((f) => f.folderType === 'SENT_MESSAGES');
191
191
  if (!sentFolder)
192
192
  throw new Error('Sent folder not found');
193
- // Step 2: list sent messages
193
+ // Step 2: list sent messages (the list endpoint already includes per-recipient viewed status)
194
194
  const listPath = `/pub/v3/messages?folders=${encodeURIComponent(sentFolder.id)}&page=${page}&size=${size}&sort=date&sortDirection=desc`;
195
195
  const listData = await client.request('GET', listPath);
196
196
  const messages = listData.data ?? [];
197
- // Step 3: fetch each message detail and filter to unread
197
+ // Step 3: filter to unread using showNeverViewed (avoids N+1 detail fetches
198
+ // and the detail endpoint's inconsistent viewed field which can return null
199
+ // for read messages instead of the epoch sentinel the list endpoint uses)
198
200
  const unread = [];
199
201
  for (const msg of messages) {
200
- const detail = await client.request('GET', `/pub/v3/messages/${msg.id}`);
201
- const unreadRecipients = (detail.recipients ?? [])
202
+ if (!msg.showNeverViewed)
203
+ continue;
204
+ const unreadRecipients = (msg.recipients ?? [])
202
205
  .filter((r) => !r.viewed)
203
206
  .map((r) => r.user.name);
204
207
  if (unreadRecipients.length > 0) {
205
208
  unread.push({
206
- id: detail.id,
207
- subject: detail.subject,
208
- sentAt: detail.date.dateTime,
209
+ id: msg.id,
210
+ subject: msg.subject,
211
+ sentAt: msg.date.dateTime,
209
212
  unreadBy: unreadRecipients,
210
213
  });
211
214
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ofw-mcp",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "OurFamilyWizard MCP server for Claude — developed and maintained by AI (Claude Sonnet 4.6)",
5
5
  "author": "Claude Sonnet 4.6 (AI) <https://www.anthropic.com/claude>",
6
6
  "repository": {