Cross-Platform Filesystem MCP Server

Cross-Platform Filesystem MCP Server

Enables comprehensive filesystem operations across Linux, macOS, and Windows with platform-aware command execution, secure path restrictions, and intelligent adaptations for file search, directory management, and shell commands specific to each operating system.

Category
访问服务器

README

Cross-Platform Filesystem MCP Server

A comprehensive filesystem MCP server that works across Linux, macOS, and Windows platforms with intelligent platform-specific adaptations.

🌍 Platform Support

✅ Supported Platforms

  • Linux - Full support with Unix-style commands
  • macOS - Full support with Unix-style commands
  • Windows - Full support with Windows-specific commands
  • FreeBSD/OpenBSD - Basic support

🔧 Platform-Specific Features

Linux (/home/, /tmp/, /opt/, /usr/local/, /etc/)

  • Uses find for file search
  • Unix-style permissions and ownership
  • Standard shell commands via /bin/bash
  • Package manager paths included

macOS (/Users/, /tmp/, /opt/homebrew/, /usr/local/)

  • Uses find for file search
  • Unix-style permissions and ownership
  • Homebrew paths for both Intel and Apple Silicon
  • Standard shell commands via /bin/bash

Windows (C:\Users\, C:\temp\, C:\tmp\, D:\)

  • Uses dir for file search with recursion
  • Windows-style paths and permissions
  • Commands via cmd.exe
  • Multiple drive support

🛠️ Available Tools

Core Filesystem Operations

  • get_platform_info - Show current platform and allowed paths
  • list_directory - List directory contents with platform-aware hidden file filtering
  • read_file / write_file - File content operations
  • create_directory / delete_directory - Directory management
  • delete_file - File removal
  • move_item / copy_item - File/directory manipulation
  • get_file_info - Detailed file metadata (platform-specific)

Search & Navigation

  • search_files - Platform-aware file search (find/dir)
  • get_current_directory - Current working directory info
  • execute_command - Platform-aware shell command execution

🚀 Quick Setup

1. Install Dependencies

cd mcp-filesystem-cross-platform
npm install

2. Build (Optional)

npm run build

3. Run Development Mode

npm run dev

4. Install to a Runtime Directory (Optional)

./scripts/install-runtime.sh

By default the script installs the server into /opt/mcp-servers/mcp-filesystem-cross-platform. Use --prefix to change the parent directory or --name to customize the folder name.

📋 Platform-Specific Allowed Paths

The MCP automatically detects the platform and restricts access to safe directories:

Linux

/home/          # User directories
/tmp/           # Temporary files  
/var/tmp/       # System temporary
/opt/           # Optional software
/usr/local/     # Local installations
/etc/           # Configuration files (read access)

macOS

/Users/         # User directories
/tmp/           # Temporary files
/var/tmp/       # System temporary  
/opt/homebrew/  # Homebrew (Apple Silicon)
/usr/local/     # Homebrew (Intel) + local installations

Windows

C:\Users\       # User directories
C:\temp\        # Temporary files
C:\tmp\         # Alternative temp
D:\             # Additional drives

🔒 Security Features

  • Path validation prevents directory traversal attacks
  • Platform-aware restrictions to system-appropriate safe directories
  • Sandboxed execution environment
  • No access to system-critical directories outside allowed paths

⚙️ Claude Desktop Configuration

Linux/macOS

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["tsx", "/path/to/mcp-filesystem-cross-platform/src/index.ts"]
    }
  }
}

Windows

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["tsx", "C:\\path\\to\\mcp-filesystem-cross-platform\\src\\index.ts"]
    }
  }
}

🎯 Usage Examples

Once configured, you can ask Claude:

Platform Detection

  • "What platform am I running on?"
  • "Show me the allowed filesystem paths"

File Operations

  • "List the contents of my home directory"
  • "Create a new directory called 'projects'"
  • "Read the contents of my .bashrc file" (Linux/macOS)
  • "Search for all .js files in my projects folder"

Cross-Platform Commands

  • "Run 'ls -la'" (Linux/macOS) or "Run 'dir'" (Windows)
  • "Execute 'npm install' in my project directory"

🔄 Differences from macOS-Only Version

Improvements:

  • Cross-platform compatibility (Linux, macOS, Windows)
  • Platform-aware command execution (find vs dir)
  • Intelligent path restrictions based on OS
  • Better error handling for platform differences
  • Platform detection and reporting

Key Changes:

  • Uses os.platform() for platform detection
  • Platform-specific allowed paths arrays
  • Different search commands per platform (find vs dir)
  • Platform-aware shell selection (bash vs cmd.exe)
  • Windows drive letter support
  • Enhanced hidden file filtering (includes $ files on Windows)

🐧 Linux-Specific Notes

The filesystem MCP works excellently on Linux with these considerations:

  • Package Management: Can access /opt/ and /usr/local/ for installed software
  • Configuration: Read access to /etc/ for system configs
  • Permissions: Full Unix permissions and ownership support
  • Shell: Uses /bin/bash for command execution
  • Temporary Files: Supports both /tmp/ and /var/tmp/

💻 Windows-Specific Notes

Full Windows support with these adaptations:

  • Drive Letters: Supports multiple drives (C:, D:, etc.)
  • Path Separators: Handles Windows backslashes correctly
  • Commands: Uses cmd.exe and Windows-native commands
  • Hidden Files: Filters both . and $ prefixed files
  • Permissions: Windows-style file attributes

🚀 Migration from macOS-Only Version

If you're currently using the macOS-only version, here's how to migrate:

1. Update your Claude Desktop config:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["tsx", "/path/to/mcp-filesystem-cross-platform/src/index.ts"]
    }
  }
}

2. Test platform detection:

Ask Claude: "What platform am I running on?" to verify it's working.

3. Benefits you'll gain:

  • Future-proof for Linux servers/containers
  • Better Windows compatibility if needed
  • More robust error handling
  • Platform-aware command suggestions

🐛 Troubleshooting

Common Issues:

  1. Permission Denied

    • Check that the path is within allowed directories
    • Use "get platform info" to see allowed paths
  2. Command Not Found

    • Commands are platform-specific (use ls on Unix, dir on Windows)
    • MCP will suggest appropriate commands for your platform
  3. Path Not Found

    • Use forward slashes / on all platforms (Node.js handles conversion)
    • Check path exists with "list directory" first

This cross-platform version provides excellent Linux support with full compatibility for Linux-specific paths, permissions, and shell commands. The original macOS version would have failed on Linux due to hardcoded /Users/ paths and macOS-specific assumptions.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选