Cerebra Legal MCP Server

Mcp Filesystem

Created By
Cerebra Legal MCP Servergabrielmaialva33
Content


MCP Filesystem
Secure MCP Filesystem Server

A secure Model Context Protocol (MCP) server providing filesystem access within predefined directories

License GitHub top language GitHub language count Repository size GitHub last commit Maia


About   |    Technologies   |    Tools   |    Installation   |    Usage   |    License


:bookmark: About

MCP Filesystem Server provides secure filesystem access for AI models through the Model Context Protocol. It enforces strict path validation and only allows access to predefined directories.


:computer: Technologies


:wrench: Tools


:package: Installation

:heavy_check_mark: Prerequisites

The following software must be installed:


:arrow_down: Cloning the repository

  $ git clone https://github.com/gabrielmaialva33/mcp-filesystem.git
  $ cd mcp-filesystem

:arrow_forward: Running the application

Local Development

  # Install dependencies
  $ pnpm install

  # Build the application
  $ pnpm build

  # Run the server (specify directory to allow access to)
  $ pnpm start /path/to/allowed/directory

Using NPM Package

  # Install globally
  $ npm install -g @gabrielmaialva33/mcp-filesystem

  # Run the server
  $ mcp-filesystem /path/to/allowed/directory

  # Or use with npx (no installation needed)
  $ npx @gabrielmaialva33/mcp-filesystem /path/to/allowed/directory

Using Docker

  # Build the Docker image
  $ docker build -t gabrielmaialva33/mcp-filesystem .

  # Run using Docker
  $ docker run -i --rm -v /path/to/data:/data:ro gabrielmaialva33/mcp-filesystem /data

Using Docker Compose

  # Create a data directory
  $ mkdir -p data

  # Start the server
  $ docker-compose up -d

:gear: Usage

Using with Claude Desktop

Claude Desktop can be configured to use this MCP server for filesystem access. Add the following to your claude_desktop_config.json:

Using NPX

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@gabrielmaialva33/mcp-filesystem",
        "/Users/username/Desktop",
        "/path/to/other/allowed/dir"
      ]
    }
  }
}

Using Docker

Note: When using Docker, all directories must be mounted to /projects by default. Adding the ro flag will make the directory read-only.

{
  "mcpServers": {
    "filesystem": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--mount",
        "type=bind,src=/Users/username/Desktop,dst=/projects/Desktop",
        "--mount",
        "type=bind,src=/path/to/other/allowed/dir,dst=/projects/other/allowed/dir,ro",
        "--mount",
        "type=bind,src=/path/to/file.txt,dst=/projects/path/to/file.txt",
        "gabrielmaialva33/mcp-filesystem",
        "/projects"
      ]
    }
  }
}

Available Tools

The MCP Filesystem Server provides these tools:

  • read_file: Read a file's content
  • read_multiple_files: Read multiple files at once
  • write_file: Create or overwrite a file
  • edit_file: Make precise edits with diff preview
  • create_directory: Create directories recursively
  • list_directory: List directory contents
  • directory_tree: Get a recursive tree view
  • move_file: Move or rename files
  • search_files: Find files matching patterns
  • get_file_info: Get file metadata
  • list_allowed_directories: See accessible directories

:sparkles: Features

  • Secure Access: Strict path validation prevents unauthorized access
  • File Operations: Read, write, edit, and move files
  • Directory Operations: Create, list, get tree views, and search directories
  • Metadata Access: View file and directory information
  • Docker Support: Easy deployment with Docker and Docker Compose

:writing_hand: Author

Gabriel Maia
Gabriel Maia

License

MIT License

© 2024-present Maia