{"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":null,"httpStatus":null,"severity":"error","filePath":"src/services/integrations/AntigravityCliHooksInstaller.ts","lineNumber":293,"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":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/services/integrations/AntigravityCliHooksInstaller.ts#L275-L311","documentation":"registerAntigravityMcp() registers the claude-mem MCP server in Antigravity's MCP config files. Before writing any config it resolves the absolute path to the bundled MCP server script (~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs) via getMcpServerAbsolutePath(). If that script cannot be found on disk, it throws because writing MCP configs that point at a nonexistent server would leave Antigravity with a broken MCP integration.","triggerScenarios":"installAntigravityCliHooks() -> registerAntigravityMcp() runs and getMcpServerAbsolutePath() returns null because plugin/scripts/mcp-server.cjs does not exist at the expected marketplace install location (~/.claude/plugins/marketplaces/thedotmack/).","commonSituations":"Running the hook installer before or after an incomplete plugin install; the marketplace directory was deleted or moved; a custom CLAUDE_PLUGIN/marketplace root points somewhere without the built plugin; the plugin was never built/synced (npm run build-and-sync not run).","solutions":["Run the full install from the package or repo root: npx claude-mem@latest install (or npm run build-and-sync in the repo) so plugin/scripts/mcp-server.cjs lands in ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/.","Verify the file exists: ls ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs; if missing, reinstall the marketplace plugin.","If using a custom install location, make sure the path resolution (getMcpServerAbsolutePath) points at the directory that actually contains the built plugin."],"exampleFix":"// before: running the hook installer on a machine without the plugin installed\nnpx some-repo/scripts/install-antigravity-hooks.ts\n// Error: MCP server script not found\n\n// after: install the plugin first so the script exists\nnpx claude-mem@latest install\nnpx some-repo/scripts/install-antigravity-hooks.ts","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs';\nimport path from 'path';\nconst mcpServerPath = path.join(process.env.HOME!, '.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs');\nif (!existsSync(mcpServerPath)) {\n  throw new Error(`Run npx claude-mem@latest install first; missing ${mcpServerPath}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run the full plugin install (npx claude-mem@latest install) before installing CLI hooks.","Add a startup check for plugin/scripts/mcp-server.cjs in install scripts.","After plugin upgrades, verify the marketplace directory still contains the built script."],"tags":["mcp","filesystem","install","file-not-found"],"backgroundTag":"file-not-found","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}