fix(mcp-filesystem): add default search exclusions - #1959
Open
dvd233 wants to merge 1 commit into
Open
Conversation
✅ Deploy Preview for tarko canceled.
|
✅ Deploy Preview for agent-tars-docs canceled.
|
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
Closes #1258
search_filespreviously traversed every allowed subdirectory unless each caller supplied exclusions. That made it easy to scan dependency and build trees accidentally, producing slow searches and noisy agent context even though Agent TARS's safedirectory_treealready filters those paths.This change:
directory_tree(node_modules,.git, build/cache/log paths, and common metadata files);excludePatternswith those defaults instead of replacing them;*.tmp,?, and brace expansion;The in-memory MCP tests exercise the public
search_filestool against a temporary directory tree. They verify default directory/file pruning, no traversal into excluded directories, additive custom exclusions, nested globs, existing non-asterisk glob forms, and exact path-segment matching without hiding partial-name search results.Verification
origin/main: 4 failures / 5 passes (expected red baseline).pnpm --filter @agent-infra/mcp-server-filesystem test: 1 suite, 9 tests pass.pnpm --filter @agent-infra/mcp-server-filesystem build: ESM, CJS, and declarations build successfully.tests/server-in-memory.test.ts: passes.merge-treewith the current head of fix: harden agent security checks #1906 completes without conflicts.Checklist