feat(mcp-servers): Allow configurable directories for filesystem server - #14
Merged
Merged
Conversation
morgnza
reviewed
Jul 16, 2026
|
|
||
| # Build filesystem server args: script path + allowed directories | ||
| IFS=',' read -ra DIRS_ARRAY <<< "$ALLOWED_DIRS" | ||
| FS_ARGS="[\"C:\\\\\\\\McpServers\\\\\\\\filesystem_server.py\"" |
Contributor
There was a problem hiding this comment.
Update to forward slashes for a cleaner view - "C:/McpServers/filesystem_server.py"
Contributor
Author
|
Addressed in 1d13b34 — switched all manifest paths to forward slashes (Python handles them natively on Windows). Also converts any backslashes in user-supplied |
The filesystem MCP server now accepts allowed directories as CLI
arguments instead of a hardcoded path. Multiple directories are
supported — pass each as a separate arg:
python filesystem_server.py C:/Users/Public/Documents D:/Data
If no arguments are provided, defaults to C:\Users\Public\Documents
(backward-compatible).
setup_mcp_redirection.sh gains a --allowed-dirs flag (comma-separated)
that plumbs the configured directories into the manifest args array.
Uses forward slashes in the manifest JSON for readability (Python
handles them natively on Windows). The list_directory tool defaults to
the first allowed dir rather than a hardcoded path.
yikunliu-aws
force-pushed
the
feat/configurable-filesystem-allowed-dirs
branch
from
July 16, 2026 17:42
1d13b34 to
32a34c7
Compare
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
Makes the forwarded filesystem MCP server's allowed directories configurable instead of hardcoded.
Changes
mcp_servers/filesystem_server.py:sys.argv[1:]at startupC:\Users\Public\Documentsif no args provided (backward-compatible)list_directory()defaults to the first allowed dir instead of a hardcoded pathscripts/setup_mcp_redirection.sh:--allowed-dirs "C:\Users\Public\Documents,D:\Data"(comma-separated)argsarray dynamically from the configured dirsC:\Users\Public\DocumentsHow it works
The MCP server manifest on the image controls what args are passed to the server at launch:
{"mcpServers": {"filesystem": { "command": "C:\\Program Files\\Python312\\python.exe", "args": ["C:\\McpServers\\filesystem_server.py", "C:\\Users\\Public\\Documents", "D:\\Data"] }}}Users who build their own images can also edit
C:\ProgramData\NICE\dcv\mcp_server_redirection_config.jsondirectly — no setup script required.Testing
python -m py_compilepassesbash -non setup script passes./scripts/ci_local.shpasses