thedotmack/claude-mem · error · Error

MCP server script not found

Error message

MCP server script not found

What it means

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.

Source

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

// 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 d768ba3643)

Solutions

  1. 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.
  2. Verify the expected file exists: ls ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs.
  3. If you set CLAUDE_PLUGIN_ROOT / PLUGIN_ROOT, make sure it points at a tree that contains plugin/scripts/mcp-server.cjs.
  4. Re-run the Antigravity installer step once the file is present.

Example fix

# before — file missing
ls ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs
# -> No such file

# after
npx claude-mem@latest install   # materializes the marketplace
ls ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs
# -> .../mcp-server.cjs
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'fs';
import path from 'path';
import { homedir } from 'os';

function mcpServerPresent(): boolean {
  return existsSync(path.join(homedir(), '.claude', 'plugins', 'marketplaces', 'thedotmack', 'plugin', 'scripts', 'mcp-server.cjs'));
}

Type guard

function isMcpServerMissing(e: unknown): boolean {
  return e instanceof Error && /MCP server script not found/i.test(e.message);
}

Try / catch

try {
  await installAntigravityCliHooks();
} catch (e) {
  if (e instanceof Error && /MCP server script not found/i.test(e.message)) {
    console.error('Run `npx claude-mem@latest install` first to materialize the plugin marketplace.');
    return 1;
  }
  throw e;
}

Prevention

When it happens

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

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

Related errors


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