ad4m_config_check
Verifies that mcp-ad4m is registered in the correct config file to prevent silent connection failures caused by misconfiguration.
Instructions
Check whether mcp-ad4m is registered in the correct config file. Detects the wrong-file misconfiguration that causes silent connection failures.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:88-123 (handler)Core handler function for ad4m_config_check. Checks ~/.claude.json for correct ad4m MCP registration, detects wrong-file misconfiguration (settings.json), and returns status/fix command.
function configCheck(): { status: string; detail: string; fix_command?: string } { let claude: ClaudeJson | null = null; try { claude = JSON.parse(readFileSync(join(HOME, ".claude.json"), "utf8")); } catch { /* missing */ } if (!claude) { return { status: "missing", detail: "~/.claude.json not found.", fix_command: `claude mcp add -e AD4M_GQL_URL=${AD4M_GQL} ad4m -- ${HOME}/bin/mcp-ad4m`, }; } if (claude.projects?.[HOME]?.mcpServers?.["ad4m"]) { return { status: "ok", detail: "ad4m is registered in the correct project-scoped location." }; } if (claude.mcpServers?.["ad4m"]) { return { status: "ok", detail: "ad4m is registered at user scope (top-level)." }; } let inSettingsJson = false; try { const s = JSON.parse(readFileSync(join(HOME, ".claude", "settings.json"), "utf8")); inSettingsJson = !!(s?.mcpServers?.["ad4m"]); } catch { /* ignore */ } if (inSettingsJson) { return { status: "wrong_file", detail: "ad4m is in ~/.claude/settings.json which Claude Code IGNORES for MCP registration.", fix_command: `claude mcp add -e AD4M_GQL_URL=${AD4M_GQL} ad4m -- ${HOME}/bin/mcp-ad4m`, }; } return { status: "missing", detail: "ad4m is not registered anywhere Claude Code can find it.", fix_command: `claude mcp add -e AD4M_GQL_URL=${AD4M_GQL} ad4m -- ${HOME}/bin/mcp-ad4m`, }; } - src/index.ts:377-381 (registration)Tool registration on the MCP server using server.tool() with no input schema and delegating to configCheck() handler.
server.tool("ad4m_config_check", "Check whether mcp-ad4m is registered in the correct config file. Detects the wrong-file misconfiguration that causes silent connection failures.", {}, async () => ok(configCheck()) ); - src/index.ts:379-379 (schema)No input parameters (empty object schema) — ad4m_config_check requires no arguments.
{}, - src/index.ts:154-156 (helper)Helper function that wraps the result into MCP content format.
function ok(data: unknown) { return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; }