From 963351200c12bc5c91408e3fdbd8d4d86f784c4d Mon Sep 17 00:00:00 2001 From: m3tam3re Date: Sun, 25 Oct 2026 13:35:41 +0100 Subject: [PATCH] fix(ai-memory): register Claude Code MCP as session-aware bridge A plain HTTP entry carries no bearer; Claude Code then attempts OAuth dynamic client registration against ai-memory and fails. The stdio bridge reads [auth].bearer_token_file from the client config. Co-Authored-By: Claude Fable 5.1 --- profiles/sets/coding/agents/ai-memory.nix | 5 ++++- profiles/sets/coding/agents/ai-memory.test.sh | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/profiles/sets/coding/agents/ai-memory.nix b/profiles/sets/coding/agents/ai-memory.nix index f2c88a5..fc5161e 100644 --- a/profiles/sets/coding/agents/ai-memory.nix +++ b/profiles/sets/coding/agents/ai-memory.nix @@ -131,7 +131,10 @@ in { ${optionalString (elem "claude-code" cfg.agents) '' export PATH="${pkgs.llm-agents.claude-code}/bin:$PATH" run claude mcp remove ai-memory -s user >/dev/null 2>&1 || true - run ${exe} install-mcp --client claude-code --apply \ + # --session-aware: stdio bridge that reads the token file itself. A + # plain HTTP entry carries no credentials, and Claude Code then tries + # OAuth client registration, which ai-memory does not offer. + run ${exe} install-mcp --client claude-code --apply --session-aware \ --server-url ${escapeShellArg "${cfg.serverUrl}/mcp"} ''} # Into ~/.agents/skills; claude-skills-sync mirrors them to Claude. diff --git a/profiles/sets/coding/agents/ai-memory.test.sh b/profiles/sets/coding/agents/ai-memory.test.sh index 8dde62f..3bbf81c 100755 --- a/profiles/sets/coding/agents/ai-memory.test.sh +++ b/profiles/sets/coding/agents/ai-memory.test.sh @@ -51,6 +51,7 @@ check "hooks opencode2" "$act" "install-hooks --agent opencode2 --apply" check "auth-token symlink" "$act" "ln -sfn /run/agenix/ai-memory-token " refute "no token on command lines" "$act" "--auth-token" refute "activation must not write opencode.json (home-manager symlink)" "$act" "install-mcp --client opencode" +check "claude mcp is the session-aware bridge" "$act" "install-mcp --client claude-code --apply --session-aware" # Missing token file: skip with a warning, exit 0, never call ai-memory. script="$(printf '%s\n' "$act" | sed 's|/run/agenix/ai-memory-token|/nonexistent/ai-memory-token|g')"