Skip to content

feat(mcp): add all_projects flag to mem_search for cross-project search#332

Open
egdev6 wants to merge 11 commits intoGentleman-Programming:mainfrom
egdev6:feat/mcp-search-all-projects
Open

feat(mcp): add all_projects flag to mem_search for cross-project search#332
egdev6 wants to merge 11 commits intoGentleman-Programming:mainfrom
egdev6:feat/mcp-search-all-projects

Conversation

@egdev6
Copy link
Copy Markdown
Contributor

@egdev6 egdev6 commented May 5, 2026

🔗 Linked Issue

Closes #303


🏷️ PR Type

  • type:bug — Bug fix
  • type:feature — New feature
  • type:docs — Documentation only
  • type:refactor — Code refactoring (no behavior change)
  • type:chore — Maintenance, dependencies, tooling
  • type:breaking-change — Breaking change

📝 Summary

  • Add optional all_projects boolean parameter to mem_search for cross-project lookup.
  • Preserve existing default behavior when the flag is omitted or set to false.
  • Cover the new behavior with MCP tests and document the parameter in agent setup docs.

📂 Changes

File Change
internal/mcp/mcp.go Added all_projects to the mem_search schema and updated handleSearch to bypass project resolution for global search
internal/mcp/mcp_test.go Added TestHandleSearch_AllProjects covering global and project-scoped behavior
docs/AGENT-SETUP.md Documented cross-project search usage for mem_search

🧪 Test Plan

  • Unit tests pass locally: go test ./...
  • E2E tests pass locally: go test -tags e2e ./internal/server/...
  • Manually tested the affected functionality

Manual verification:

  • Confirmed all_projects: true returns matches from multiple projects.
  • Confirmed explicit project filtering still returns only that project.
  • Confirmed all_projects: false behaves like existing single-project search.

🤖 Automated Checks

These run automatically and all must pass before merge:

Check What it verifies Status
Check Issue Reference PR body contains Closes #N / Fixes #N / Resolves #N
Check Issue Has status:approved Linked issue has status:approved label
Check PR Has type: Label* PR has exactly one type:* label
Unit Tests go test ./... passes
E2E Tests go test -tags e2e ./internal/server/... passes

✅ Contributor Checklist

  • I linked an approved issue above (Closes #N)
  • I added exactly one type:* label to this PR
  • I ran unit tests locally: go test ./...
  • I ran e2e tests locally: go test -tags e2e ./internal/server/...
  • Docs updated (if behavior changed)
  • Commits follow conventional commits format
  • No Co-Authored-By trailers in commits

💬 Notes for Reviewers

This change intentionally keeps the store layer untouched because global search already works when SearchOptions.Project is empty. The fix is isolated to the MCP layer, which previously always resolved an empty project to the current/default project.

Add optional all_projects boolean parameter to mem_search tool.
When true, searches across all projects instead of restricting
to current/default project. When false or omitted, maintains
existing single-project behavior.

Enables agents to recall architectural decisions, patterns, or
context from related projects without explicit project switching.

Closes Gentleman-Programming#303
Copilot AI review requested due to automatic review settings May 5, 2026 11:22
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an all_projects flag to the MCP mem_search tool to enable cross-project (global) search behavior while preserving the existing project-scoped search behavior by default. This fits into the MCP layer’s responsibility of mapping tool arguments into store queries and returning consistent tool envelopes.

Changes:

  • Extended the mem_search tool schema with an all_projects boolean argument.
  • Updated handleSearch to bypass project auto-detection/override validation when all_projects=true so Store.Search() runs globally (empty project filter).
  • Added an MCP test covering global vs project-scoped behavior, and documented the new parameter.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
internal/mcp/mcp.go Adds all_projects parameter and branches search behavior to support global search.
internal/mcp/mcp_test.go Adds a unit test validating cross-project results vs project-filtered results.
docs/AGENT-SETUP.md Documents how to use all_projects with mem_search.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/mcp/mcp.go Outdated
Comment thread internal/mcp/mcp.go
Comment thread internal/mcp/mcp.go Outdated
Comment thread docs/AGENT-SETUP.md Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/mcp/mcp.go
Comment thread internal/mcp/mcp.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/mcp/mcp.go Outdated
Comment thread internal/mcp/mcp.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/mcp/mcp.go
Comment thread internal/mcp/mcp_test.go
Comment thread internal/mcp/mcp_test.go
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/mcp/mcp.go Outdated
Comment thread internal/mcp/mcp_test.go
@egdev6
Copy link
Copy Markdown
Contributor Author

egdev6 commented May 5, 2026

Ready for review!

Copilot AI review requested due to automatic review settings May 7, 2026 06:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread internal/mcp/mcp.go Outdated
Comment thread internal/mcp/mcp_test.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread internal/mcp/mcp.go Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 7, 2026 08:10
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

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.

feat(mcp): add all_projects flag to mem_search for cross-project search

2 participants