Skip to content

src/mcp/mod.rs ignores AI_MEMORY_LLM_BACKEND — MCP stdio mode hardcoded to Ollama (post-#1067 surface gap) #1142

Description

@alphaonedev

Severity: HIGH (post-#1067 surface gap — documented v0.7.0 feature unreachable from MCP)

Affected code: src/mcp/mod.rs:2139-2164 (the let llm: Option<Arc<OllamaClient>> init block)

Symptom: running ai-memory mcp --tier autonomous with AI_MEMORY_LLM_BACKEND=xai, AI_MEMORY_LLM_MODEL=grok-4.3 in env produces this boot banner:

ai-memory: connecting to Ollama for Gemma 4 Effective 4B (Q4) ...
ai-memory: Ollama connected, ensuring model gemma4:e4b is available...
ai-memory: LLM ready (Gemma 4 Effective 4B (Q4))

The env vars are IGNORED. The MCP daemon connects to local Ollama for Gemma 4 every time regardless of the operator's selector.

Root cause: #1067 (v0.7.0 LLM-vendor-agnostic backend selector) landed the env-aware OllamaClient::from_env resolver into src/daemon_runtime.rs:1746-1798 (the serve HTTP daemon path). The MCP stdio path in src/mcp/mod.rs:2139 was NOT updated — it still does the legacy OllamaClient::new_with_url(ollama_url, model_id) with model_id = llm_model.ollama_model_id().

CLAUDE.md §"Feature tiers" claims: "Post-#1067 (v0.7.0): tier no longer dictates LLM vendor. Any tier can speak to any provider — local Ollama, xAI Grok, OpenAI, Anthropic, Google Gemini, DeepSeek, ..." — but for the MCP surface this claim is false until this gap is closed.

Proposed fix: mirror the daemon_runtime.rs:1756-1799 env-aware path into the MCP init: check AI_MEMORY_LLM_BACKEND first; if set, use OllamaClient::from_env; else fall through to the legacy tier-default Ollama path.

Operator impact: Codex CLI configured to use ai-memory MCP with AI_MEMORY_LLM_BACKEND=xai cannot access xAI Grok. Same gap for any client that wires ai-memory through ai-memory mcp stdio (Claude Code, Cursor, ChatGPT Desktop fallback, Continue.dev, etc.) — the entire MCP integration surface is locked to Ollama.

Release-gate impact: v0.7.0 documents provider-agnostic LLM dispatch but the MCP surface (where most clients consume the substrate) hardcodes Ollama. Fix required before ship.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-filed-by-agentIssue was filed autonomously by an AI agent per the track-and-fix global rule

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions