Skip to content

fix(mcp): full 51-tool surface by default + env defaults in plugin manifest - #650

Merged
rohitg00 merged 2 commits into
mainfrom
fix/tier2-mcp-surface
May 25, 2026
Merged

fix(mcp): full 51-tool surface by default + env defaults in plugin manifest#650
rohitg00 merged 2 commits into
mainfrom
fix/tier2-mcp-surface

Conversation

@rohitg00

@rohitg00 rohitg00 commented May 25, 2026

Copy link
Copy Markdown
Owner

Summary

Two MCP plugin issues, single source.

Issue Root cause Fix
#510 Claude Code drops the agentmemory MCP server silently when AGENTMEMORY_URL is unset plugin/.mcp.json uses ${VAR:-default} form for all three env entries
#553 OpenCode (and CC, and Codex) saw 8 tools instead of 51 the README advertises getVisibleTools() default flipped from core (8) to all (51)

#510 — Claude Code drops the server silently

From the Claude Code MCP docs:

If a required environment variable is not set and has no default value, Claude Code will fail to parse the config.

Old plugin/.mcp.json:

"env": {
  "AGENTMEMORY_URL": "${AGENTMEMORY_URL}",       // unset → parse fails
  "AGENTMEMORY_SECRET": "${AGENTMEMORY_SECRET}"  // unset → parse fails
}

Claude Code then drops the server from /reload-plugins with no surfaced error. Issue #510 reporter saw 1 plugin MCP server in /reload-plugins output but zero tools available, confirming silent parse failure.

New:

"env": {
  "AGENTMEMORY_URL": "${AGENTMEMORY_URL:-http://localhost:3111}",
  "AGENTMEMORY_SECRET": "${AGENTMEMORY_SECRET:-}",
  "AGENTMEMORY_TOOLS": "${AGENTMEMORY_TOOLS:-all}"
}

Defaults match the documented server runtime (localhost:3111, no auth, all tools). Users who export the vars still override.

#553 — 8 tools instead of 51

getVisibleTools() defaulted to AGENTMEMORY_TOOLS=core which returned 8 ESSENTIAL_TOOLS. Plugin manifests, README, and the npm description all advertise 51. Default flipped:

const mode = process.env["AGENTMEMORY_TOOLS"] || "all";  // was "core"
if (mode === "core") return getAllTools().filter((t) => ESSENTIAL_TOOLS.has(t.name));
return getAllTools();

AGENTMEMORY_TOOLS=core still gives the lean 8-tool set for users who want it.

Tested

  • npm test — 1141/1141 pass (105 files), +4 new regression cases in test/mcp-surface-default.test.ts
  • Updated test/codex-plugin.test.ts assertion to the new env-default form
  • npm run build — 21 files, 2448 KB
  • Verified plugin manifest still valid JSON, env keys still readable by the shim

Docs verified against

Summary by CodeRabbit

  • Configuration

    • Memory service env vars now have sensible defaults, reducing required manual setup
    • Default tool visibility changed to show all tools (can be restricted to essential tools via config)
  • Documentation

    • CLI help updated to reflect the new default tool counts
  • Tests

    • Added/updated tests validating default env interpolation and tool-surface defaults

Review Change Stack

…nifest

Two user-blocking MCP issues, single root surface.

#510 Claude Code drops the agentmemory MCP server silently when
AGENTMEMORY_URL is unset. Per Claude Code MCP docs: 'If a required
environment variable is not set and has no default value, Claude Code
will fail to parse the config' — and a parse failure removes the server
from /reload-plugins output with no warning. plugin/.mcp.json now uses
${VAR:-default} form for AGENTMEMORY_URL, AGENTMEMORY_SECRET, and
AGENTMEMORY_TOOLS so fresh installs Just Work without exporting envs.

#553 OpenCode (and Claude Code, and Codex) saw 8 tools instead of the
51 every plugin manifest advertises. getVisibleTools() defaulted to
AGENTMEMORY_TOOLS=core which capped at 8 ESSENTIAL_TOOLS. README has
always said '51 MCP tools' — the default now matches the advertising.
AGENTMEMORY_TOOLS=core still available for users who want the lean set.

CLI help text and existing codex-plugin test updated to the new
contract. New test/mcp-surface-default.test.ts adds 4 regression cases
covering default, all, core, and the env-default form in the plugin
manifest.

1141/1141 vitest pass.
@vercel

vercel Bot commented May 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agentmemory Ready Ready Preview, Comment May 25, 2026 7:22pm

Request Review

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 62a48cba-9404-4f76-b176-3fbfd118f2e8

📥 Commits

Reviewing files that changed from the base of the PR and between d1422c0 and a890ce4.

📒 Files selected for processing (2)
  • src/cli/connect/util.ts
  • test/cli-connect.test.ts

📝 Walkthrough

Walkthrough

This PR makes the MCP default tool surface "all" by adding ${VAR:-...} fallbacks for AGENTMEMORY_* in config/wiring, changing getVisibleTools() to default to "all" (filter only if core), and adding/adjusting tests and CLI help to validate the behavior.

Changes

Default MCP Tool Surface Visibility

Layer / File(s) Summary
MCP environment variable defaults
plugin/.mcp.json, src/cli/connect/util.ts
Switches env interpolation to ${VAR:-default} for AGENTMEMORY_URL (http://localhost:3111), AGENTMEMORY_SECRET (""), and AGENTMEMORY_TOOLS (all).
Tool visibility filtering logic
src/mcp/tools-registry.ts
getVisibleTools() now treats AGENTMEMORY_TOOLS default as "all" and only filters to ESSENTIAL_TOOLS when explicitly "core".
MCP tool surface default tests
test/mcp-surface-default.test.ts
New test suite verifies default visible tools match full tool set, AGENTMEMORY_TOOLS=all parity, AGENTMEMORY_TOOLS=core yields 8 essential tools, and .mcp.json uses ${VAR:-...} patterns.
Config validation and help text updates
test/codex-plugin.test.ts, test/cli-connect.test.ts, src/cli.ts
Adjust tests to expect defaulted env interpolation and update CLI help to document 8 core tools.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

  • rohitg00/agentmemory#386: Related edits to plugin/.mcp.json and test expectations for MCP env interpolation and passthrough.

Poem

🐰 I nibble defaults in configs small,
From core of eight to one-and-all.
With ${VAR:-all} the tools now sing,
Tests hop round to check the spring.
Joyful bytes — a rabbit's tiny call.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: enabling the full 51-tool MCP surface by default and adding environment variable defaults to the plugin manifest.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/tier2-mcp-surface

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
test/mcp-surface-default.test.ts (2)

23-28: ⚡ Quick win

Consider using exact equality for the full tool count.

Line 27 uses toBeGreaterThanOrEqual(48) instead of checking for the exact expected count. The PR description advertises "51 tools" and getAllTools() should return a stable count. Using >=48 could silently pass if tools are removed, masking regressions.

♻️ Proposed fix
   it("default returns the full 51-tool surface, matching plugin advertising", () => {
     const visible = getVisibleTools();
     const all = getAllTools();
     expect(visible.length).toBe(all.length);
-    expect(visible.length).toBeGreaterThanOrEqual(48);
+    expect(visible.length).toBe(51);
   });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/mcp-surface-default.test.ts` around lines 23 - 28, The test "default
returns the full 51-tool surface, matching plugin advertising" uses a weak
assertion; replace the leniency with an exact check by asserting the total tool
count equals 51. Update the second expectation to assert either
expect(visible.length).toBe(51) or expect(getAllTools().length).toBe(51)
(referencing getVisibleTools and getAllTools) so the test fails if tools are
removed or added unexpectedly.

35-51: ⚡ Quick win

Avoid duplicating the ESSENTIAL_TOOLS definition.

Lines 39-50 hardcode the exact list of 8 tool names, duplicating the ESSENTIAL_TOOLS set defined in src/mcp/tools-registry.ts:920-929. If ESSENTIAL_TOOLS changes, both locations must be updated, creating a maintenance burden and risk of inconsistency.

♻️ Proposed refactor to import and reuse the canonical set

Update the import on line 3 to include ESSENTIAL_TOOLS (note: you'll need to export it in tools-registry.ts first):

 import {
   getAllTools,
   getVisibleTools,
+  ESSENTIAL_TOOLS,
 } from "../src/mcp/tools-registry.js";

Then replace lines 37-50 with:

   it("AGENTMEMORY_TOOLS=core returns the 8 essential tools", () => {
     process.env["AGENTMEMORY_TOOLS"] = "core";
     const names = new Set(getVisibleTools().map((t) => t.name));
     expect(names.size).toBe(8);
-    for (const t of [
-      "memory_save",
-      "memory_recall",
-      "memory_consolidate",
-      "memory_smart_search",
-      "memory_sessions",
-      "memory_diagnose",
-      "memory_lesson_save",
-      "memory_reflect",
-    ]) {
-      expect(names.has(t)).toBe(true);
-    }
+    expect(names).toEqual(ESSENTIAL_TOOLS);
   });

Note: ESSENTIAL_TOOLS is currently not exported from tools-registry.ts. If you prefer not to export internal constants, an alternative is to check that names is a subset of getAllTools() tool names and has exactly 8 members, accepting the hardcoded list as documentation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/mcp-surface-default.test.ts` around lines 35 - 51, The test hardcodes
the 8-tool list duplicating ESSENTIAL_TOOLS; either export ESSENTIAL_TOOLS from
tools-registry.ts and import it into the test and replace the hardcoded array
with ESSENTIAL_TOOLS, or (if you prefer not to export the constant) assert that
getVisibleTools() returns exactly 8 names and that those names are a subset of
getAllTools().map(t => t.name); update the test to reference ESSENTIAL_TOOLS or
use getAllTools()/getVisibleTools() comparisons instead of the inline array to
avoid duplication.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@test/mcp-surface-default.test.ts`:
- Around line 23-28: The test "default returns the full 51-tool surface,
matching plugin advertising" uses a weak assertion; replace the leniency with an
exact check by asserting the total tool count equals 51. Update the second
expectation to assert either expect(visible.length).toBe(51) or
expect(getAllTools().length).toBe(51) (referencing getVisibleTools and
getAllTools) so the test fails if tools are removed or added unexpectedly.
- Around line 35-51: The test hardcodes the 8-tool list duplicating
ESSENTIAL_TOOLS; either export ESSENTIAL_TOOLS from tools-registry.ts and import
it into the test and replace the hardcoded array with ESSENTIAL_TOOLS, or (if
you prefer not to export the constant) assert that getVisibleTools() returns
exactly 8 names and that those names are a subset of getAllTools().map(t =>
t.name); update the test to reference ESSENTIAL_TOOLS or use
getAllTools()/getVisibleTools() comparisons instead of the inline array to avoid
duplication.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3621c373-c5fd-429c-8f27-40c1b9bb8433

📥 Commits

Reviewing files that changed from the base of the PR and between f027c20 and d1422c0.

📒 Files selected for processing (5)
  • plugin/.mcp.json
  • src/cli.ts
  • src/mcp/tools-registry.ts
  • test/codex-plugin.test.ts
  • test/mcp-surface-default.test.ts

PR #650 fixed plugin/.mcp.json but not src/cli/connect/util.ts —
`npx @agentmemory/agentmemory connect` (Cursor, Gemini CLI, Windsurf,
all JSON-MCP agents) was still writing ${VAR} form into user configs,
keeping #510 unfixed on every non-Claude-Code-plugin path. util.ts now
ships the same ${VAR:-default} form with AGENTMEMORY_TOOLS=all.
Codex TOML adapter already used a literal URL — unaffected. Hermes
connect just prints YAML guidance — unaffected.

test/cli-connect.test.ts: updated existing assertion to the new
contract.
@rohitg00
rohitg00 merged commit 426bbdd into main May 25, 2026
7 checks passed
@rohitg00
rohitg00 deleted the fix/tier2-mcp-surface branch May 25, 2026 19:27
rohitg00 added a commit that referenced this pull request May 25, 2026
…651)

Three new connect adapters and a Port Mapping section in README.

#647 Qwen Code (~/.qwen/settings.json) — standard mcpServers shape.
Qwen's 16-event hook system reuses Claude Code's payload field names
(session_id, cwd, tool_name, tool_input, tool_response), so the
existing compiled hook scripts run against Qwen without modification.
Plugin extension support (qwen-extension.json) is a separate follow-up.

#614 Antigravity (mcp_config.json under platform-specific User dir)
— standard mcpServers shape. Gemini CLI is scheduled to stop serving
Pro/Ultra/Code-Assist requests 2026-06-18 per Google's announcement;
Antigravity is the GA replacement.

#618 Kiro (~/.kiro/settings/mcp.json) — standard mcpServers shape.
Workspace-level overrides live in .kiro/settings/mcp.json next to the
code; we wire user-level by default.

All three use the shared json-mcp-adapter, so they inherit the
${VAR:-default} env block from PR #650.

#629 Port docs — README now has a Ports table under Configuration:
3111 REST, 3112 streams, 3113 viewer, 49134 engine WS. Env overrides
called out. Stale-process cleanup recipe for macOS/Linux/Windows.

Test coverage:
  - test/connect-new-agents.test.ts: 6 cases (detect + install +
    env-default form for each agent, plus a registry-membership check)
  - test/cli-connect.test.ts: bumped agent count 8 → 11
  - 1156/1156 vitest pass

Docs fetched first via context7:
  - Qwen Code docs (qwenlm.github.io/qwen-code-docs)
  - Kiro CLI docs (kiro.dev/docs/cli/mcp)
  - Antigravity docs (settings file layout)
@coderabbitai coderabbitai Bot mentioned this pull request May 26, 2026
3 tasks
healdigital pushed a commit to healdigital/agentmemory that referenced this pull request Jul 27, 2026
…nifest (rohitg00#650)

* fix(mcp): full 51-tool surface by default + env defaults in plugin manifest

Two user-blocking MCP issues, single root surface.

rohitg00#510 Claude Code drops the agentmemory MCP server silently when
AGENTMEMORY_URL is unset. Per Claude Code MCP docs: 'If a required
environment variable is not set and has no default value, Claude Code
will fail to parse the config' — and a parse failure removes the server
from /reload-plugins output with no warning. plugin/.mcp.json now uses
${VAR:-default} form for AGENTMEMORY_URL, AGENTMEMORY_SECRET, and
AGENTMEMORY_TOOLS so fresh installs Just Work without exporting envs.

rohitg00#553 OpenCode (and Claude Code, and Codex) saw 8 tools instead of the
51 every plugin manifest advertises. getVisibleTools() defaulted to
AGENTMEMORY_TOOLS=core which capped at 8 ESSENTIAL_TOOLS. README has
always said '51 MCP tools' — the default now matches the advertising.
AGENTMEMORY_TOOLS=core still available for users who want the lean set.

CLI help text and existing codex-plugin test updated to the new
contract. New test/mcp-surface-default.test.ts adds 4 regression cases
covering default, all, core, and the env-default form in the plugin
manifest.

1141/1141 vitest pass.

* fix(connect): apply same env defaults to wired-in MCP block

PR rohitg00#650 fixed plugin/.mcp.json but not src/cli/connect/util.ts —
`npx @agentmemory/agentmemory connect` (Cursor, Gemini CLI, Windsurf,
all JSON-MCP agents) was still writing ${VAR} form into user configs,
keeping rohitg00#510 unfixed on every non-Claude-Code-plugin path. util.ts now
ships the same ${VAR:-default} form with AGENTMEMORY_TOOLS=all.
Codex TOML adapter already used a literal URL — unaffected. Hermes
connect just prints YAML guidance — unaffected.

test/cli-connect.test.ts: updated existing assertion to the new
contract.
healdigital pushed a commit to healdigital/agentmemory that referenced this pull request Jul 27, 2026
…ohitg00#651)

Three new connect adapters and a Port Mapping section in README.

rohitg00#647 Qwen Code (~/.qwen/settings.json) — standard mcpServers shape.
Qwen's 16-event hook system reuses Claude Code's payload field names
(session_id, cwd, tool_name, tool_input, tool_response), so the
existing compiled hook scripts run against Qwen without modification.
Plugin extension support (qwen-extension.json) is a separate follow-up.

rohitg00#614 Antigravity (mcp_config.json under platform-specific User dir)
— standard mcpServers shape. Gemini CLI is scheduled to stop serving
Pro/Ultra/Code-Assist requests 2026-06-18 per Google's announcement;
Antigravity is the GA replacement.

rohitg00#618 Kiro (~/.kiro/settings/mcp.json) — standard mcpServers shape.
Workspace-level overrides live in .kiro/settings/mcp.json next to the
code; we wire user-level by default.

All three use the shared json-mcp-adapter, so they inherit the
${VAR:-default} env block from PR rohitg00#650.

rohitg00#629 Port docs — README now has a Ports table under Configuration:
3111 REST, 3112 streams, 3113 viewer, 49134 engine WS. Env overrides
called out. Stale-process cleanup recipe for macOS/Linux/Windows.

Test coverage:
  - test/connect-new-agents.test.ts: 6 cases (detect + install +
    env-default form for each agent, plus a registry-membership check)
  - test/cli-connect.test.ts: bumped agent count 8 → 11
  - 1156/1156 vitest pass

Docs fetched first via context7:
  - Qwen Code docs (qwenlm.github.io/qwen-code-docs)
  - Kiro CLI docs (kiro.dev/docs/cli/mcp)
  - Antigravity docs (settings file layout)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant