thedotmack/claude-mem · error

MCP server script not found

Error message

MCP server script not found

What it means

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.

Solutions

  1. 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/.
  2. Verify the file exists: ls ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs; if missing, reinstall the marketplace plugin.
  3. If using a custom install location, make sure the path resolution (getMcpServerAbsolutePath) points at the directory that actually contains the built plugin.

Example fix

// before: running the hook installer on a machine without the plugin installed
npx some-repo/scripts/install-antigravity-hooks.ts
// Error: MCP server script not found

// after: install the plugin first so the script exists
npx claude-mem@latest install
npx some-repo/scripts/install-antigravity-hooks.ts
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'fs';
import path from 'path';
const mcpServerPath = path.join(process.env.HOME!, '.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs');
if (!existsSync(mcpServerPath)) {
  throw new Error(`Run npx claude-mem@latest install first; missing ${mcpServerPath}`);
}

Prevention

When it happens

Trigger: 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/).

Common situations: 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).

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17). Data as JSON: /api/errors/da948d4b86d42a63. Report an issue: GitHub.

Appendix: source

Thrown at src/services/integrations/AntigravityCliHooksInstaller.ts:293

// B0 found `~/.gemini/config/mcp_config.json` existing but genuinely empty (0
// bytes) on a live machine — a fresh placeholder created alongside the CLI's
// app-data dir, not corrupt data. readJsonSafe (reused by writeMcpJsonConfig)
// intentionally throws on empty files to prevent data loss on real corruption
// elsewhere — that contract must stay intact for every other caller. Here we
// only pre-seed a *zero-byte* file with `{}` immediately before delegating to
// the shared writer, so an empty placeholder doesn't get misread as corrupt.
function seedEmptyMcpConfigFile(mcpConfigPath: string): void {
  if (existsSync(mcpConfigPath) && readFileSync(mcpConfigPath, 'utf-8').trim() === '') {
    writeFileSync(mcpConfigPath, '{}\n');
  }
}

function registerAntigravityMcp(): void {
  const mcpServerPath = getMcpServerAbsolutePath();
  if (!mcpServerPath) {
    console.error('Could not find MCP server script');
    console.error('   Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs');
    throw new Error('MCP server script not found');
  }

  for (const mcpConfigPath of ANTIGRAVITY_MCP_CONFIG_PATHS) {
    seedEmptyMcpConfigFile(mcpConfigPath);
    writeMcpJsonConfig(mcpConfigPath, mcpServerPath);
    console.log(`  MCP config written to: ${mcpConfigPath}`);
  }
}

function setupRulesContextFile(): void {
  injectContextIntoMarkdownFile(RULES_CONTEXT_PATH, PLACEHOLDER_CONTEXT);
  console.log(`  Context placeholder written to: ${RULES_CONTEXT_PATH}`);
}

export async function installAntigravityCliHooks(): Promise<number> {
  console.log('\nInstalling Claude-Mem Antigravity CLI hooks + MCP...\n');

  const workerServicePath = findWorkerServicePath();

View on GitHub (pinned to d8bc9755e7)