Repository navigation
Conversation
|
|
Thank you for this pull request, and apologies for the long wait for a response. These servers are reference implementations: they exist to show how each part of MCP is used, not to be general-purpose products, so new features are taken selectively, and this change isn't one the maintainers plan to take. This repository also now accepts issues, not pull requests, from anyone but its maintainers; the policy is in This is not a judgment on the idea or on you. A server in the MCP Registry may well offer it, and anyone is welcome to build on these servers to do so. If you think we've misread it, please open an issue describing the problem and the expected behavior. This is part of the backlog triage in #4875. |
Fixes #2219
Description
This PR addresses issue #2219 by ensuring that the
filesystemserver ignores dot-prefixed hidden files and directories (such as.git,.terraform,.env) by default. This significantly reduces unnecessary token consumption and mitigates potential security risks associated with exposing hidden environment variables or repository histories to the LLM.Introduced a new environment variable
MCP_FILESYSTEM_INCLUDE_HIDDEN. By default, this is evaluated asfalse. Users can opt-in to the legacy behavior by settingMCP_FILESYSTEM_INCLUDE_HIDDEN=true.Publishing Your Server
(Not applicable, modifying existing server)
Server Details
filesystemtools(list_directory,list_directory_with_sizes,search_files) and general directory tree parsing logic (buildTree).Motivation and Context
Dot-prefixed directories (especially
.gitand.terraform) can grow enormous. When an LLM agent uses the filesystem search tools on a project root, returning these hidden directories massively inflates token usage without adding much value for project analysis. It also introduces a security risk by potentially exposing sensitive local environment variables.How Has This Been Tested?
__tests__/hidden-files.test.tsto validate theincludeHiddenboolean flag logic viavi.mock.__tests__/hidden-tree.test.tsto validate thebuildTreerecursive exclusion using a real temporary directory.Breaking Changes
There are no breaking changes to the protocol schema itself. However, clients relying on reading hidden files via this server will now need to explicitly set the
MCP_FILESYSTEM_INCLUDE_HIDDEN=trueenvironment variable.Types of changes
Checklist
Additional context
Added a
console.errorinitialization log to inform the user of the current hidden-file visibility state, ensuring it does not disrupt the MCP stdout protocol communication.