mcp-secure-filesystem

NewportRiver/mcp-secure-filesystem

3.1

If you are the rightful owner of mcp-secure-filesystem and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The mcp-secure-filesystem is a secure, extended fork of the Model Context Protocol Filesystem server, designed for LM Studio and the open-source openai/gpt-oss-20b model.

Tools
14
Resources
0
Prompts
0

🚀 mcp-secure-filesystem for LM Studio

This is a secure, extended fork of the Model Context Protocol Filesystem server, tailored for LM Studio and the open-source openai/gpt-oss-20b model. We’ve squashed countless bugs and added new features so that local LLM agents can safely read, write, and manage files in whitelisted directories. Notably, we fixed numerous TypeScript issues, improved core file tools, and even added a fun Baby Yoda (Grogu) ASCII on startup. In short: this is a fully-tested, production-ready MCP server for local development (with a bit of flair). Man… What a day! 🛠️


🛠️ Major Modifications

  • TypeScript Fixes: Resolved many TS compiler errors by adding type guards & defaults. No more args is possibly undefined errors. After patching, pnpm build runs cleanly. 🎉
  • File Tools Patched: Fixed readFileContent, writeFileContent, and applyFileEdits. The read_text_file tool now reliably supports head/tail line limits. ✅
  • Notification Handling: Updated to use server.notification(RootsListChangedNotificationSchema, {...}) instead of the old sendNotification.
  • 🗑️ New delete_file Tool: Soft delete (moves to .trash) or permanent delete with "permanent": true.
  • Validation & Security: Only whitelisted root directories are accessible. Symlinks are checked to prevent escape. 🚫
  • ASCII Grogu on Startup: Because debugging needs a Jedi boost! This is the Way.
⡴⠶⠦⠤⣤⣄⣀⡀⢀⣠⡴⠖⠚⠋⠛⠛⠲⢦⣄⡀⠀⠀⠀⠀⠀⠀⠀⢀⠀
⠙⢦⡀⠉⠒⠤⣍⡉⠉⠁⠀⠐⢤⠐⠀⡰⠀⠀⠈⠙⠉⢉⣉⣉⣉⠍⠉⣩⠇
⠀⠀⠻⣄⠀⠀⠀⢻⢤⣞⣿⣿⡆⢀⡀⢠⣟⣿⣷⠄⡾⠉⠀⠀⠀⣠⡾⠃⠀
⠀⠀⠀⠙⠳⣤⣀⣈⣀⠙⠿⠟⠃⢓⡊⠙⠻⠛⠋⣠⣃⣀⣀⣤⠞⠋⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠈⢻⡝⠓⠒⢺⠷⠒⠒⠒⠛⠛⢉⣩⠿⣿⡁⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣼⡟⢲⢤⣸⡄⠀⢀⣠⠴⣺⡏⣏⣤⡾⠇⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣿⢞⣺⣠⠋⠹⠉⡏⢁⡴⣹⣧⣤⠾⠁⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠙⢻⡟⢁⠄⡇⢠⠈⠉⠀⠋⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢸⠋⠁⠀⡇⢸⠀⠀⠀⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠉⠉⠙⠛⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

~ This is the Way ~

⚙️ Available Tools

  • read_text_file – Read text with head/tail options
  • read_media_file – Read image/audio as base64
  • read_multiple_files – Batch read
  • write_file – Create or overwrite files
  • edit_file – Apply edits (diff-based)
  • create_directory – Create new directories
  • list_directory – List files
  • list_directory_with_sizes – List files + sizes
  • directory_tree – Recursive view
  • move_file – Move or rename
  • search_files – Recursive glob search
  • get_file_info – Metadata
  • list_allowed_directories – Whitelisted roots
  • delete_file – NEW: soft & permanent delete

🚀 Quick Start

# Install dependencies
pnpm install

# Build
pnpm build

# Run
npx mcp-secure-filesystem "/path/to/allowed/workspace"

When it runs, you’ll see Grogu’s ASCII + ✅ checkmark in your console. Hook it into LM Studio’s MCP configuration and your agent can now securely use file tools.


🛑 Common Errors & Fixes

  • Method not found (-32601): Tool name mismatch. Use exact names.
  • TS18048 (args undefined): Fix with Zod schemas/defaults.
  • TS2345/TS2559: Ensure SDK types match.
  • Roots notifications: Use server.notification() not sendNotification().
  • Permission denied: Directory not in whitelist.

📚 Examples

// List root
{"tool": "list_directory", "args": {"path": "/"}}

// Create dir
{"tool": "create_directory", "args": {"path": "/new_folder"}}

// Move file
{"tool": "move_file", "args": {"source": "/foo.txt", "destination": "/sub/foo.txt"}}

// Soft delete
{"tool": "delete_file", "args": {"path": "/foo.txt"}}

// Permanent delete
{"tool": "delete_file", "args": {"path": "/foo.txt", "permanent": true}}

🎉 Testing & Outcome

✅ Fully tested with LM Studio v0.3.x + openai/gpt-oss-20b. All file operations (read/write/edit/move/delete/search/info) work securely. Grogu approves. 🍼✨


😎 Credits

Built by Bart with OpenAI ChatGPT 5 as co-pilot. Based on the original MCP Filesystem Server by Anthropic & the MCP community. Licensed under MIT.

This is the Way.