Skip to content

feat(mcp-server/filesystem): add exclude pattern support across all filesystem tools#317

Merged
butschster merged 7 commits intomainfrom
issue-316
Jan 19, 2026
Merged

feat(mcp-server/filesystem): add exclude pattern support across all filesystem tools#317
butschster merged 7 commits intomainfrom
issue-316

Conversation

@cto-new
Copy link
Copy Markdown
Contributor

@cto-new cto-new bot commented Jan 19, 2026

Scope

  • Enforce exclude patterns from project config across MCP filesystem tools, including file-read, file-write, file-replace-content, file-insert-content, and file-delete-content.
  • Ensure directory listing and file search already respected excludes remain unchanged.

Implementation details

  • Introduced and wired ExcludeRegistryInterface into all filesystem handlers and added early exclusion checks.
  • Refactored file-write tool to use a dedicated FileWriteHandler and added FileWriteResult.
  • Added exclusion checks to FileRead, FileReplaceContent, FileInsertContent, and FileDeleteContent handlers.
  • Standardized error messaging: Path '{path}' is excluded by project configuration.

Testing

  • Added unit tests covering exclusion behavior across all filesystem tools (read, write, replace, insert, delete).
  • Added MCP Inspector integration tests to verify excludes across tools (FilesystemExcludesTest).
  • All tests pass, code style and static analysis checks completed.

Notes

  • No breaking changes; existing behavior preserved with enhanced security and consistency.

…ystem tools

Add and enforce exclude pattern checks across all filesystem tools to respect project configuration and improve security.

- Introduced ExcludeRegistryInterface usage in all filesystem handlers and added early exclusion checks
- Refactored file-write tool to use a dedicated FileWriteHandler following the Action/Handler pattern
- Added exclusion checks to FileRead, FileReplaceContent, FileInsertContent, and FileDeleteContent handlers
- Added unit tests for exclude behavior across all filesystem tools
- Ensured consistent error messaging: Path '{path}' is excluded by project configuration
- No breaking changes; existing behavior preserved with enhanced security
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 19, 2026

@butschster butschster linked an issue Jan 19, 2026 that may be closed by this pull request
5 tasks
@butschster butschster added this to the 1.34 milestone Jan 19, 2026
@butschster butschster self-assigned this Jan 19, 2026
@butschster butschster added mcp MCP server components mcp:tools MCP server tools labels Jan 19, 2026
@butschster butschster moved this to In review in Context Generator Jan 19, 2026
@butschster butschster merged commit dbe02bc into main Jan 19, 2026
9 of 11 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Context Generator Jan 19, 2026
@butschster butschster deleted the issue-316 branch January 19, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mcp:tools MCP server tools mcp MCP server components

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add exclude pattern support to all filesystem MCP tools

1 participant