fix(mcp): remove delete_memory tool to close authorization-bypass gap - #1228
Merged
Conversation
MemoryEngine.delete_memory_unit never called validate_bank_write, so any authenticated MCP client could delete memories in any bank regardless of the configured OperationValidatorExtension policy (issue #1218). No REST endpoint exposes single-memory deletion, and the CLI already errors out on it. Drop the matching MCP tool and remove delete_memory_unit from the public MemoryEngineInterface. The engine method stays so internal observation-invalidation tests still cover the stale-observation sweep. Also updates the control plane bank-config UI, MCP docs, and skill mirrors to drop references to the tool.
3 tasks
12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1218.
MemoryEngine.delete_memory_unitnever calledvalidate_bank_write, so any authenticated MCP client could delete memories in any bank regardless of the configuredOperationValidatorExtensionpolicy. Every sibling delete method (delete_document,delete_bank,delete_mental_model,delete_directive) follows the validator pattern —delete_memory_unitwas the lone exception.The MCP
delete_memorytool was the only external caller:http.pyhas noDELETE /v1/default/banks/{bank_id}/memories/{memory_id}route).delete_memorywithanyhow::bail!("Individual memory deletion is no longer supported")(hindsight-cli/src/api.rs:383).The product direction was already "no single-memory delete via public API." This PR finishes the removal for MCP rather than papering the validator gap.
Changes
delete_memoryMCP tool registrations and_register_delete_memoryinhindsight-api-slim/hindsight_api/mcp_tools.py; drop"delete_memory"from_ALL_TOOLS,_AUDITABLE_MCP_TOOLS, and the default tool set."delete_memory"from_SINGLE_BANK_TOOLSinhindsight-api-slim/hindsight_api/api/mcp.py.delete_memory_unitfrom theMemoryEngineInterfaceabstract class (it's no longer part of the documented public surface). The concrete method stays onMemoryEnginesotests/test_observation_invalidation.pycan still cover the stale-observation sweep through a single-unit entry point.delete_memoryintests/test_mcp_tools.pyand adjust the default-tool-count assertion (30 → 29).delete_memoryfrom the Memories group in the Control Plane bank-config UI.hindsight-docs/docs/developer/mcp-server.md,configuration.md,api/memory-banks.mdx,docs-integrations/local-mcp.md, and theskills/hindsight-docsmirrors. Versioned docs for 0.4/0.5 left untouched.Test plan
./scripts/hooks/lint.sh— all lints passuv run pytest tests/test_mcp_tools.py— 168 passedpython -c "from hindsight_api.api import mcp; from hindsight_api import mcp_tools"— imports fine;_ALL_TOOLSis now 29 entries