Sign inSign up

portertech/filesystem-mcp-server

By portertech

•Updated 8 months ago

A secure, high-performance MCP server that gives AI agents safe access to your local filesystem.

Image
1

940

portertech/filesystem-mcp-server repository overview

⁠Filesystem MCP Server

A secure, high-performance Model Context Protocol⁠ (MCP) server that gives AI coding agents safe access to your local filesystem. Built in Go with directory sandboxing, symlink attack prevention, and atomic writes.

⁠Features

  • 17 filesystem tools for comprehensive file operations
  • Secure by default: Only operates within explicitly allowed directories
  • Symlink attack prevention: Resolves symlinks and validates targets
  • Streaming support: Memory-efficient handling of large files
  • Atomic writes: Uses temp files with rename for safe file operations
  • Cross-platform: Works on Linux, macOS, and Windows
  • AI agent optimized: Line range support and dynamic formatting for efficient code navigation

⁠Quick Start

docker run -i \
  -v /path/to/dir:/path/to/dir \
  portertech/filesystem-mcp-server /path/to/dir
⁠Multiple Directories
docker run -i \
  -v /home/user/projects:/home/user/projects \
  -v /home/user/documents:/home/user/documents \
  portertech/filesystem-mcp-server /home/user/projects /home/user/documents

⁠Claude Desktop Configuration

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "filesystem": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-v", "/Users/username/Documents:/Users/username/Documents",
        "-v", "/Users/username/Projects:/Users/username/Projects",
        "portertech/filesystem-mcp-server",
        "/Users/username/Documents", "/Users/username/Projects"
      ]
    }
  }
}

⁠Available Tools

ToolDescription
read_text_fileRead text files with optional line ranges
read_multiple_filesRead multiple files concurrently
read_media_fileRead media files as base64
write_fileCreate or overwrite files (atomic)
edit_fileFind/replace edits with diff output
copy_fileCopy files with streaming
move_fileMove or rename files/directories
delete_fileDelete files
delete_directoryDelete directories
create_directoryCreate directories
list_directoryList directory contents
list_directory_with_sizesList with sizes and sorting
directory_treeRecursive tree view (JSON)
search_filesSearch files by glob pattern
get_file_infoGet file metadata
list_allowed_directoriesList allowed directories

⁠Security

  • Path validation: All paths validated against allowed directories
  • Symlink resolution: Symlinks resolved and validated before access
  • Null byte rejection: Paths with null bytes rejected
  • Parent traversal prevention: .. cannot escape allowed directories
  • Atomic writes: Temp file + rename pattern prevents corruption
  • Delete protection: Cannot delete allowed root directories

⁠License

MIT

Tag summary

Content type

Image

Digest

sha256:f7a9fdd80…

Size

2 MB

Last updated

8 months ago

docker pull portertech/filesystem-mcp-server