mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-22 13:55:15 +02:00
feat(filesystem): ignore dot directories by default to reduce token usage
- Add environment variable MCP_FILESYSTEM_INCLUDE_HIDDEN (default: false) - Filter dot-prefixed files/directories in list_directory, directory_tree, search_files - Reduces token usage from large directories like .git, .terraform, etc. - Enhances security by avoiding exposure of potentially sensitive hidden files - Includes comprehensive tests for the new filtering functionality - Update documentation to explain the new behavior and environment variable Fixes #2219 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Ola Hungerford <olaservo@users.noreply.github.com>
This commit is contained in:
@@ -15,6 +15,20 @@ Node.js server implementing Model Context Protocol (MCP) for filesystem operatio
|
||||
|
||||
The server uses a flexible directory access control system. Directories can be specified via command-line arguments or dynamically via [Roots](https://modelcontextprotocol.io/docs/learn/client-concepts#roots).
|
||||
|
||||
### Hidden Files and Directories
|
||||
|
||||
By default, the filesystem server **ignores dot-prefixed files and directories** (like `.git`, `.env`, `.terraform`, etc.) to:
|
||||
- Reduce token usage (especially from large directories like `.git`)
|
||||
- Enhance security by avoiding exposure of potentially sensitive hidden files
|
||||
- Follow the convention that dot-prefixed items are typically "hidden" for good reason
|
||||
|
||||
To include hidden files and directories, set the environment variable:
|
||||
```bash
|
||||
export MCP_FILESYSTEM_INCLUDE_HIDDEN=true
|
||||
```
|
||||
|
||||
This affects the following operations: `list_directory`, `list_directory_with_sizes`, `directory_tree`, and `search_files`.
|
||||
|
||||
### Method 1: Command-line Arguments
|
||||
Specify Allowed directories when starting the server:
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user