agentmemory icon indicating copy to clipboard operation
agentmemory copied to clipboard

OpenCode plugin exposes only 8 agentmemory tools instead of advertised 51 MCP surface (server running, proxy mode not activating)

Open nickdesi opened this issue 6 months ago • 2 comments

Description

On OpenCode with the agentmemory plugin installed and the agentmemory server running (health endpoint returns {"status":"healthy"} on the default port), the available memory tools are limited to 8 instead of the advertised 51:

Tools available:

  • memory_consolidate
  • memory_diagnose
  • memory_lesson_save
  • memory_recall
  • memory_reflect
  • memory_save
  • memory_sessions
  • memory_smart_search

Tools from the documented 7-tool fallback that are MISSING:

  • memory_export
  • memory_audit
  • memory_governance_delete

Tools from the 51-tool set that should be available in proxy mode but are absent:

  • memory_graph_query
  • memory_relations
  • memory_timeline
  • memory_file_history
  • memory_patterns
  • memory_profile
  • etc.

The README states: "The published @agentmemory/mcp package is a thin shim. It exposes the full 51-tool surface only when it can reach a running agentmemory server via AGENTMEMORY_URL (proxy mode). With no server reachable, the shim falls back to a 7-tool local set."

The server IS reachable, but the tool set doesn't match either the 7-tool fallback OR the 51-tool full set — it's a third, undocumented intermediate state (8 tools, 4 match the fallback, 4 are different).

Related existing issues:

  • #400 (open) Codex plugin install does not expose advertised full MCP tool surface
  • #510 (open) Bug: MCP tools not loaded by Claude Code despite healthy server and working plugin
  • #431 (open) Feature Request: Native Hooks / Auto-Context Injection for OpenCode
  • #464 (open) docs: refresh integration capability counts

Impact

Users following "22 hooks + MCP + plugin" expectations from the README get only 8 tools with no indication that 43 are missing. Critical tools like memory_export, memory_audit, memory_governance_delete, and all knowledge graph tools are absent without explanation.

To Reproduce

  1. Install agentmemory globally
  2. Start the server (agentmemory or npx @agentmemory/agentmemory)
  3. Verify server is healthy: curl http://localhost:3111/agentmemory/health
  4. Use OpenCode with the agentmemory plugin installed
  5. List available agentmemory tools — only 8 appear

Expected

Either:

  • The shim detects the running server and proxies all 51 tools (as documented), or
  • The OpenCode plugin documents its actual tool set and explains why some are missing

Environment

  • Agent: OpenCode with agentmemory plugin
  • Server responds at localhost:3111
  • Default configuration

Notes

This may share a root cause with #400 and #510: the MCP shim's server-probe failing to detect a running server on the default port when launched through certain plugin/hook systems. An OpenCode-specific diagnostic would help narrow down whether it's a shim issue or a plugin registration issue.

nickdesi avatar May 19 '26 19:05 nickdesi

Tracked this down — the "8 tools, not 51" state isn't proxy mode failing to activate. It's the opposite: the proxy is reaching the server, and the server is returning its core set.

The tell is the exact 8-tool list (memory_save/recall/consolidate/smart_search/sessions/diagnose/lesson_save/reflect). That's ESSENTIAL_TOOLS in src/mcp/tools-registry.ts — the server-side core surface. The shim's local fallback is a different 7-tool set (IMPLEMENTED_TOOLS: adds memory_export/audit/governance_delete). So seeing the 8-tool core list proves the shim reached the server; the server just answered in core mode.

Root cause: getVisibleTools() reads process.env["AGENTMEMORY_TOOLS"] directly:

const mode = process.env["AGENTMEMORY_TOOLS"] || "core";

Every other config reader goes through getEnvVar() → getMergedEnv() ({ ...fileEnv, ...process.env }), which merges ~/.agentmemory/.env. This one call doesn't, so AGENTMEMORY_TOOLS=all set in .env is silently ignored — you only get the full surface if it's exported in the server process's environment (or passed via --tools all). .env.example advertises it as a .env knob, hence the surprise.

Workaround today: export it in the shell that launches the server, e.g. AGENTMEMORY_TOOLS=all agentmemory, or agentmemory --tools all.

Proper fix is up as a PR: https://github.com/rohitg00/agentmemory/pull/616 — it routes the lookup through getEnvVar() so the documented .env value works (with process.env still taking precedence). This likely also covers #400 (Codex), where a healthy server serves the reduced surface.

Correction to my earlier note: this is a separate bug from #510. #510 is the "literal ${AGENTMEMORY_URL} placeholder defeats the shim's localhost fallback" connection issue, which is already handled on main by the resolveEnvOrEmpty guard in #588 (ships in 0.9.22). #616 only fixes the server-side core-vs-all surface selection.

ccf avatar May 23 '26 14:05 ccf

Fixed in v0.9.22 — https://github.com/rohitg00/agentmemory/releases/tag/v0.9.22. Thanks for the report.

rohitg00 avatar May 26 '26 10:05 rohitg00