sad-mcp 0.1.12 → 0.1.13

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.
@@ -1,6 +1,14 @@
1
1
  import officeparser from "officeparser";
2
2
  import pdf from "pdf-parse";
3
+ import { mkdirSync } from "fs";
4
+ import { join } from "path";
5
+ import { homedir } from "os";
3
6
  import { isGoogleWorkspaceFile } from "./drive.js";
7
+ // officeparser defaults to a relative "officeParserTemp" dir which resolves to
8
+ // C:\Windows\System32 when Claude Desktop launches the MCP server → EPERM.
9
+ // Use a safe temp location under the user's home instead.
10
+ const OFFICE_TEMP_DIR = join(homedir(), ".sad-mcp", "office-temp");
11
+ mkdirSync(OFFICE_TEMP_DIR, { recursive: true });
4
12
  // pdf-parse uses console.log('Warning: ...') internally, which writes to stdout
5
13
  // and corrupts the MCP JSON-RPC transport. Redirect console.log to stderr during parsing.
6
14
  function withSilentStdout(fn) {
@@ -50,7 +58,7 @@ export async function extractText(file, buffer) {
50
58
  if (mimeType === "application/vnd.openxmlformats-officedocument.presentationml.presentation" ||
51
59
  name.endsWith(".pptx")) {
52
60
  try {
53
- const text = await officeparser.parseOfficeAsync(buffer);
61
+ const text = await officeparser.parseOfficeAsync(buffer, { tempFilesLocation: OFFICE_TEMP_DIR });
54
62
  return text;
55
63
  }
56
64
  catch (err) {
@@ -61,7 +69,7 @@ export async function extractText(file, buffer) {
61
69
  if (mimeType === "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ||
62
70
  name.endsWith(".docx")) {
63
71
  try {
64
- const text = await officeparser.parseOfficeAsync(buffer);
72
+ const text = await officeparser.parseOfficeAsync(buffer, { tempFilesLocation: OFFICE_TEMP_DIR });
65
73
  return text;
66
74
  }
67
75
  catch (err) {
@@ -72,7 +80,7 @@ export async function extractText(file, buffer) {
72
80
  if (mimeType === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
73
81
  name.endsWith(".xlsx")) {
74
82
  try {
75
- const text = await officeparser.parseOfficeAsync(buffer);
83
+ const text = await officeparser.parseOfficeAsync(buffer, { tempFilesLocation: OFFICE_TEMP_DIR });
76
84
  return text;
77
85
  }
78
86
  catch (err) {
package/dist/tools.js CHANGED
@@ -201,8 +201,10 @@ export function registerToolHandlers(server) {
201
201
  saveTextEntry(matchedFile.id, { modifiedTime: matchedFile.modifiedTime, text });
202
202
  bestMatch = { file: matchedFile, text };
203
203
  }
204
- catch {
205
- const errText = `Found file "${matchedFile.name}" but could not extract its text content. It may be an image-heavy presentation. Try searching for a transcript of the same lecture instead (e.g., search for the lecture name in transcripts).`;
204
+ catch (err) {
205
+ const errorDetail = err instanceof Error ? err.message : String(err);
206
+ console.error(`[sad-mcp] get_material failed for "${matchedFile.name}": ${errorDetail}`);
207
+ const errText = `Found file "${matchedFile.name}" but could not extract its text content (${errorDetail}). Try searching for a transcript of the same lecture instead.`;
206
208
  trackToolCall(name, toolArgs, { success: false, responseChars: errText.length }, Date.now() - startTime);
207
209
  return { content: [{ type: "text", text: errText }] };
208
210
  }
package/dist/tracking.js CHANGED
@@ -4,7 +4,7 @@ import { homedir } from "os";
4
4
  import { randomUUID } from "crypto";
5
5
  const CONFIG_DIR = join(homedir(), ".sad-mcp");
6
6
  const ANON_ID_PATH = join(CONFIG_DIR, "anonymous-id.txt");
7
- const VERSION = "0.1.12";
7
+ const VERSION = "0.1.13";
8
8
  const WEBHOOK_URL = "https://script.google.com/macros/s/AKfycbxGraOdki3CUMz6Ch9u17qt_9P01nTAsWeZZN_wrOL9mRUosNriXZmBdEG5RTS2cCjr/exec";
9
9
  // Session ID — unique per server process lifetime
10
10
  const sessionId = randomUUID().slice(0, 8);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sad-mcp",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "MCP server for Software Analysis and Design course materials at BGU",
5
5
  "type": "module",
6
6
  "bin": {