thedotmack/claude-mem · error
mcp-server.cjs not found in plugin/scripts
Error message
mcp-server.cjs not found in plugin/scripts
What it means
Thrown by callMcpToolOnce when resolveMcpServerScriptPath() returns null — neither <MARKETPLACE_ROOT>/plugin/scripts/mcp-server.cjs nor <cwd>/plugin/scripts/mcp-server.cjs exists. The MCP server script is a build artifact of the plugin; its absence means the plugin wasn't built/installed where the client looks.
Source
Thrown at src/shared/mcp-client.ts:100
&& typeof (item as { text?: unknown }).text === 'string'
))
.map(item => item.text)
.join('\n');
return {
text,
...(maybeResult.isError === true ? { isError: true } : {}),
};
}
export async function callMcpToolOnce(
name: string,
args: Record<string, unknown>,
options: { timeoutMs?: number } = {},
): Promise<McpToolCallResult> {
const scriptPath = resolveMcpServerScriptPath();
if (!scriptPath) {
throw new Error('mcp-server.cjs not found in plugin/scripts');
}
const transport = new StdioClientTransport({
command: resolveNodeCommand(),
args: [scriptPath],
env: buildMcpSpawnEnv(),
cwd: process.cwd(),
stderr: 'pipe',
});
const client = new Client(
{ name: MCP_CLIENT_NAME, version: MCP_CLIENT_VERSION },
{ capabilities: {} },
);
const timeoutMs = options.timeoutMs ?? MCP_CALL_TIMEOUT_MS;
let timeout: ReturnType<typeof setTimeout> | null = null;
const timeoutPromise = new Promise<never>((_, reject) => {
timeout = setTimeout(View on GitHub (pinned to d768ba3643)
Solutions
- Run the plugin build/sync (npm run build-and-sync) so mcp-server.cjs is generated and placed under plugin/scripts.
- Verify <MARKETPLACE_ROOT>/plugin/scripts/mcp-server.cjs exists; check MARKETPLACE_ROOT resolution.
- Run the process from the project root so the cwd-relative candidate also matches.
- Reinstall the marketplace plugin if the file was deleted.
Defensive patterns
Strategy: validation
Validate before calling
import { resolveMcpServerScriptPath } from './mcp-client';
const scriptPath = resolveMcpServerScriptPath();
if (!scriptPath) {
throw new Error('mcp-server.cjs missing — run npm run build-and-sync');
} Try / catch
try {
return await callMcpToolOnce(name, args, options);
} catch (err) {
if (err instanceof Error && /mcp-server.cjs not found/.test(err.message)) {
logger.error('MCP', err.message);
// run build-and-sync before retrying
}
throw err;
} Prevention
- Run the plugin build before any code path that calls callMcpToolOnce.
- Verify plugin/scripts/mcp-server.cjs exists in CI.
- Run from the project root so the cwd-relative candidate resolves.
When it happens
Trigger: callMcpToolOnce invoked before/without the plugin built; MARKETPLACE_ROOT resolves somewhere without plugin/scripts; running from a cwd that has no plugin/scripts and the marketplace copy is missing.
Common situations: Fresh checkout without running build-and-sync; plugin installed to a marketplace dir that lacks the compiled mcp-server.cjs; package was partially installed; cwd changed so the cwd-relative candidate misses too.
Related errors
- Missing required distribution file: ${filePath}
- plugin/.mcp.json mcp-search launcher must include Codex cach
- plugin/.mcp.json mcp-search launcher must include Claude cac
- installPluginDependencies: no package.json at ${targetDir}
- "${key}" is required
AI-assisted analysis of thedotmack/claude-mem@d768ba3643 (2026-08-12).
Data as JSON: /api/errors/dd0e2badfaf15c33.
Report an issue: GitHub.