feat(mcp): add AGENTMEMORY_TOOLS_DISABLE env to trim the MCP tool surface#955
feat(mcp): add AGENTMEMORY_TOOLS_DISABLE env to trim the MCP tool surface#955shgew wants to merge 1 commit into
Conversation
…face
Add a comma- or whitespace-separated denylist read from the
AGENTMEMORY_TOOLS_DISABLE env. Applied after the existing
AGENTMEMORY_TOOLS=all|core mode filter so it composes cleanly with both
modes:
- getVisibleTools() - server-side, src/mcp/tools-registry.ts
- handleToolsList() - bridge proxy + fallback paths in src/mcp/standalone.ts
The bridge filters the remote response inline, so the env is useful
without redeploying the server. Unknown tool names are silently
ignored to keep the value forward-compatible.
Use cases: drop tools whose handlers are gated by feature flags
(memory_vision_search, memory_team_share, memory_team_feed,
memory_claude_bridge_sync, memory_snapshot_create), peer fan-out
features no host actually configures (memory_mesh_sync), sandboxed
exports (memory_obsidian_export), and the markdown-compress utility
(memory_compress_file). Each tool can be dropped per-deployment
without touching the registry source.
Tests:
- test/tool-disable-env.test.ts: parseToolDisableList +
getVisibleTools under all/core modes and unknown names.
- test/standalone-tools-disable.test.ts: bridge filter on the
standalone shim (proxy + local fallback paths).
- Existing test/tool-count-consistency.test.ts and
test/mcp-standalone.test.ts pass unchanged.
Signed-off-by: Hleb Shauchenka <me@marleb.org>
|
@shgew is attempting to deploy a commit to the rohitg00's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds ChangesAGENTMEMORY_TOOLS_DISABLE env-var filtering
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
What
Add a comma- or whitespace-separated denylist read from the
AGENTMEMORY_TOOLS_DISABLEenv. Applied after the existingAGENTMEMORY_TOOLS=all|coremode filter so it composes cleanly with both modes, in two places:getVisibleTools()- server-side,src/mcp/tools-registry.tshandleToolsList()- bridge proxy + fallback paths insrc/mcp/standalone.tsWhy
Deployments often want to drop tools whose handlers are gated by feature flags (
memory_vision_search,memory_team_share,memory_team_feed,memory_claude_bridge_sync,memory_snapshot_create), peer fan-out features no host actually configures (memory_mesh_sync), sandboxed exports (memory_obsidian_export), or the markdown-compress utility (memory_compress_file). Today the only path is a fork. This adds a single env knob.How
The bridge filters the remote response inline, so the env is useful without redeploying the server. Unknown tool names are silently ignored to keep the value forward-compatible.
Tests
test/tool-disable-env.test.ts(8 cases):parseToolDisableList+getVisibleToolsunder all/core modes and unknown names.test/standalone-tools-disable.test.ts(6 cases): bridge filter on the standalone shim (proxy + local fallback paths).test/tool-count-consistency.test.tsandtest/mcp-standalone.test.tspass unchanged.Compatibility
Unset env = no behavior change. No new dependencies.
How to verify
Summary by CodeRabbit
New Features
Tests