{"record":{"id":"da948d4b86d42a63","repo":"thedotmack/claude-mem","slug":"mcp-server-script-not-found","errorCode":null,"errorMessage":"MCP server script not found","messagePattern":"MCP server script not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/services/integrations/AntigravityCliHooksInstaller.ts","lineNumber":208,"sourceCode":"// B0 found `~/.gemini/config/mcp_config.json` existing but genuinely empty (0\n// bytes) on a live machine — a fresh placeholder created alongside the CLI's\n// app-data dir, not corrupt data. readJsonSafe (reused by writeMcpJsonConfig)\n// intentionally throws on empty files to prevent data loss on real corruption\n// elsewhere — that contract must stay intact for every other caller. Here we\n// only pre-seed a *zero-byte* file with `{}` immediately before delegating to\n// the shared writer, so an empty placeholder doesn't get misread as corrupt.\nfunction seedEmptyMcpConfigFile(mcpConfigPath: string): void {\n  if (existsSync(mcpConfigPath) && readFileSync(mcpConfigPath, 'utf-8').trim() === '') {\n    writeFileSync(mcpConfigPath, '{}\\n');\n  }\n}\n\nfunction registerAntigravityMcp(): void {\n  const mcpServerPath = getMcpServerAbsolutePath();\n  if (!mcpServerPath) {\n    console.error('Could not find MCP server script');\n    console.error('   Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs');\n    throw new Error('MCP server script not found');\n  }\n\n  for (const mcpConfigPath of ANTIGRAVITY_MCP_CONFIG_PATHS) {\n    seedEmptyMcpConfigFile(mcpConfigPath);\n    writeMcpJsonConfig(mcpConfigPath, mcpServerPath);\n    console.log(`  MCP config written to: ${mcpConfigPath}`);\n  }\n}\n\nfunction setupRulesContextFile(): void {\n  injectContextIntoMarkdownFile(RULES_CONTEXT_PATH, PLACEHOLDER_CONTEXT);\n  console.log(`  Context placeholder written to: ${RULES_CONTEXT_PATH}`);\n}\n\nexport async function installAntigravityCliHooks(): Promise<number> {\n  console.log('\\nInstalling Claude-Mem Antigravity CLI hooks + MCP...\\n');\n\n  const workerServicePath = findWorkerServicePath();","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d768ba364302d12b76e69e4f021f0bb1d2d50ed6/src/services/integrations/AntigravityCliHooksInstaller.ts#L190-L226","documentation":"registerAntigravityMcp() resolves the bundled MCP server script via getMcpServerAbsolutePath(); if that returns null (the script is not where the plugin expects it), the installer throws rather than write MCP configs pointing at a non-existent command. The expected location is ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs.","triggerScenarios":"The Antigravity install step runs but the plugin marketplace has not been fully installed/synced — scripts/mcp-server.cjs is absent from the thedotmack marketplace directory. Happens when claude-mem was invoked via npx without a prior `claude-mem install`, or the marketplace install was interrupted.","commonSituations":"Running the Antigravity integration install before the core plugin marketplace install completed; the plugin directory was partially deleted; running from a cloned repo where `npm run build-and-sync` was never run; a custom CLAUDE_PLUGIN_ROOT points somewhere without the scripts dir.","solutions":["Run the full install first: `npx claude-mem@latest install` (or `npm run build-and-sync` in a dev checkout) so scripts/mcp-server.cjs is materialized.","Verify the expected file exists: ls ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs.","If you set CLAUDE_PLUGIN_ROOT / PLUGIN_ROOT, make sure it points at a tree that contains plugin/scripts/mcp-server.cjs.","Re-run the Antigravity installer step once the file is present."],"exampleFix":"# before — file missing\nls ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs\n# -> No such file\n\n# after\nnpx claude-mem@latest install   # materializes the marketplace\nls ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs\n# -> .../mcp-server.cjs","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs';\nimport path from 'path';\nimport { homedir } from 'os';\n\nfunction mcpServerPresent(): boolean {\n  return existsSync(path.join(homedir(), '.claude', 'plugins', 'marketplaces', 'thedotmack', 'plugin', 'scripts', 'mcp-server.cjs'));\n}","typeGuard":"function isMcpServerMissing(e: unknown): boolean {\n  return e instanceof Error && /MCP server script not found/i.test(e.message);\n}","tryCatchPattern":"try {\n  await installAntigravityCliHooks();\n} catch (e) {\n  if (e instanceof Error && /MCP server script not found/i.test(e.message)) {\n    console.error('Run `npx claude-mem@latest install` first to materialize the plugin marketplace.');\n    return 1;\n  }\n  throw e;\n}","preventionTips":["Always run the core marketplace install before any IDE-specific integration step.","In dev, run `npm run build-and-sync` to ensure scripts/mcp-server.cjs exists.","Verify the expected file path with ls before invoking integration installers."],"tags":["installer","filesystem","mcp","antigravity","plugin-layout"],"backgroundTag":null,"analyzedSha":"d768ba364302d12b76e69e4f021f0bb1d2d50ed6","analyzedAt":"2026-08-12T23:52:55.241Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}