Skip to content

Project scoping not honored by MCP search tools (memory_smart_search / memory_recall) or /smart-search #787

Closed

Description

@azilko

Summary

Project scoping (added in v0.9.23, #662) is wired into mem::search, but the MCP search tools and the /smart-search HTTP route do not honor project, so MCP-based clients (e.g. Claude Code via the memory_smart_search / memory_recall tools) get unscoped reads even after correctly writing project-tagged memories. Writes are scoped; reads via MCP are not.

Environment

  • @agentmemory/agentmemory 0.9.24 (deployed via the deploy/railway Dockerfile, iii-engine 0.11.2)
  • Verified empirically against a live deployment.

What works (writes + HTTP /search)

  • memory_save (and POST /agentmemory/remember) accept and store project — confirmed, the returned memory object now includes "project": "...".
  • POST /agentmemory/search filters correctly: a query with project: "A" does not return a memory stored under project: "B". ✅

The gap (MCP search tools + /smart-search)

  1. memory_smart_search (src/mcp/tools-registry.ts) exposes only query, expandIds, limit — no project param. The dispatch in src/mcp/server.ts forwards only those three, so a project can't reach the search layer.
  2. Even internally, mem::smart-search (src/functions/smart-search.ts) passes project only to lesson-recall, not to the observation/memory hybrid search — so /smart-search is unscoped for memories/observations regardless of caller.
  3. memory_recall internally calls the project-capable mem::search, but its MCP schema exposes no project param, so the filter can't be set.

Impact

Any agent that retrieves via the MCP tools (the documented Claude Code integration path) cannot get project-isolated reads — memories from every project are returned. The only project-isolated read surface today is the raw POST /agentmemory/search HTTP route.

Requested

  • Add a project parameter to the memory_smart_search and memory_recall MCP tool schemas, forwarded through src/mcp/server.ts.
  • Thread project into the observation/memory hybrid search inside mem::smart-search (not just lesson-recall), reusing the existing wildcard-compatible guard (!project || !m.project || m.project === project).

Happy to test a patch against a live deployment. Thanks for the recent scoping work!

Activity

  1. jwfaye commented on Jun 9, 2026

    @jwfaye

    PR #869 addresses this for the /smart-search path (and the MCP memory_smart_search / memory_recall tools that route through it). mem::smart-search accepted project but never applied it to its observation results; it now resolves each hit's project the same way mem::search already does (session → memory fallback). Verified live: a project-scoped smart-search returns only that project's observations.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions