Filesystem MCP Server

Filesystem MCP Server

fs-mcp-server-colinrozzi•bycolinrozzi

A secure Model Context Protocol server for filesystem operations, offering tools for listing, reading, writing, searching, and editing files within configurable allowed directories.

License: MIT•Runtime: Awaiting documentation review•Category: file systems-docs

WHAT IT DOES

  • •Provides MCP tools including list, read, write, mkdir, delete, copy, move, info, search, list_allowed_dirs, and edit.
  • •Constrains all filesystem operations to configurable allowed directories and validates paths to prevent directory traversal.
  • •Supports searching file contents with regex and glob filtering, recursive search, case sensitivity options, and context lines.
  • •Performs partial edits on files as an alternative to rewriting entire content.

BEST FOR

  • •Agents that need safe, restricted access to local files within predefined directories.
  • •Tasks that require grep-like searching across file contents.

ABOUT FS-MCP-SERVER-COLINROZZI

Filesystem MCP Server is cataloged as an MCP server attributed to colinrozzi. A secure Model Context Protocol server for filesystem operations, offering tools for listing, reading, writing, searching, and editing files within configurable allowed directories. It is categorized under file systems-docs. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Filesystem MCP Server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Can the server be restricted to specific directories?

Yes; allowed directories can be set at startup or through environment variables and configuration files.

What paths can be given to the server?

All file and directory paths must be full absolute paths located within a configured allowed directory.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 1d60d882c097 · 采集于 2026-11-13 12:08:54 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

Filesystem MCP Server

A secure Model Context Protocol (MCP) server implementation for filesystem operations.

Overview

The Filesystem MCP Server provides a standardized interface for interacting with the local filesystem through the Model Context Protocol. It allows clients to perform common file operations such as listing directories, reading files, and searching file contents in a secure and controlled manner.

Features

The server provides the following MCP tools:

  1. list: List files and directories with metadata
  2. read: Read file contents with various encoding options
  3. write: Create or update files with content
  4. mkdir: Create directories
  5. delete: Delete files or directories
  6. copy: Copy files or directories
  7. move: Move or rename files or directories
  8. info: Get detailed file/directory information
  9. search: Search file contents (grep-like functionality)
  10. list_allowed_dirs: List all allowed directories configured on the server
  11. edit: Perform partial edits on a file without rewriting the entire content

All operations are constrained to configurable allowed directories for security.

Security

All filesystem operations are constrained to a set of configurable allowed directories. The server validates paths to prevent directory traversal attacks and other security issues. Operations that would access files outside the allowed directories are rejected with appropriate error messages.

Path Requirements

All file and directory paths provided to the server must be specified as full absolute paths. These paths must be located within one of the configured allowed directories to be accessible.

Installation

Prerequisites:

  • Rust toolchain (1.70.0 or later)
  • Cargo package manager

To build the server:

cargo build --release

Usage

Running the Server

# Run with current directory as the allowed directory
./target/release/fs-mcp-server

# Specify allowed directories (comma-separated)
./target/release/fs-mcp-server --allowed-dirs /path/to/dir1,/path/to/dir2

# Use a configuration file listing allowed directories
./target/release/fs-mcp-server --config-file /path/to/config.txt

# Set maximum file size
./target/release/fs-mcp-server --max-file-size 5242880  # 5MB

Configuration File

You can specify allowed directories in a configuration file with one directory per line:

# This is a comment
/path/to/directory1
/path/to/directory2
/another/path

Environment Variables

The server can be configured using the following environment variables:

  • FS_ALLOWED_DIRS: Comma-separated list of allowed directories for filesystem operations
  • FS_CONFIG_FILE: Path to a configuration file listing allowed directories
  • FS_MAX_FILE_SIZE: Maximum file size for read operations (in bytes)
  • FS_REQUEST_TIMEOUT: Request timeout in seconds
  • FS_LOG_LEVEL: Log level (error, warn, info, debug, trace)
  • FS_LOG_FILE: Log file path

Example:

FS_ALLOWED_DIRS=/data,/home/user/docs FS_LOG_LEVEL=debug ./target/release/fs-mcp-server

Protocol Tools

The server provides the following MCP tools:

list

Lists files and directories at a specified path.

Parameters:

  • path: Full path to the directory to list files from
  • pattern: Optional glob pattern to filter files (default: "*")
  • recursive: Whether to list files recursively (default: false)
  • include_hidden: Whether to include hidden files (default: false)
  • metadata: Whether to include file metadata (default: true)

read

Reads file contents with support for different encodings and partial reads.

Parameters:

  • path: Full path to the file to read
  • encoding: File encoding (utf8, base64, binary) (default: utf8)
  • start_line: Start line for partial read (0-indexed)
  • end_line: End line for partial read (inclusive)
  • max_size: Maximum number of bytes to read (default: 1MB)

Searches file contents for matching patterns (grep-like functionality).

Parameters:

  • root_path: Full path to the root directory to start the search from
  • pattern: Text pattern to search for in files
  • regex: Whether to treat pattern as regex (default: false)
  • file_pattern: Optional glob pattern to filter which files to search (default: "*")
  • recursive: Whether to search directories recursively (default: true)
  • case_sensitive: Whether the search should be case-sensitive (default: false)
  • max_results: Maximum number of results to return (default: 100)
  • max_file_size: Maximum file size to search (default: 10MB)
  • context_lines: Number of context lines to include (default: 0)
  • timeout_secs: Maximum time to spend searching (default: 30s)

edit

Performs partial edits on a file without having to rewrite the entire content.

Parameters:

  • path: Full path to the file to edit
  • operations: List of edit operations to perform (in order)
    • Replace operation:
      • type: "replace"
      • find: Text to find (exact match)
      • replace: Text to insert as replacement
      • occurrence: Which occurrence to replace (0-based, -1 for all) (default: 0)
      • case_sensitive: Whether the search is case-sensitive (default: true)
    • Insert operation:
      • type: "insert"
      • position: Character position to insert at (0-based)
      • content: Text to insert
    • Delete operation:
      • type: "delete"
      • start: Start character position (0-based, inclusive)
      • end: End character position (0-based, exclusive)
    • Replace lines operation:
      • type: "replace_lines"
      • start_line: Start line number (0-based, inclusive)
      • end_line: End line number (0-based, inclusive)
      • content: Text to insert as replacement
  • create_if_missing: Create the file if it doesn't exist (default: false)
  • backup: Create a backup of the original file before editing (default: false)

Example:

{
  "path": "/path/to/file.txt",
  "operations": [
    {
      "type": "replace",
      "find": "hello",
      "replace": "hello world",
      "occurrence": 0,
      "case_sensitive": true
    },
    {
      "type": "insert",
      "position": 100,
      "content": "new text at position 100"
    },
    {
      "type": "replace_lines",
      "start_line": 5,
      "end_line": 7,
      "content": "new line 6\nnew line 7\nnew line 8"
    }
  ],
  "backup": true
}

list_allowed_dirs

Lists all directories that the server has been configured to allow access to.

Parameters:

  • None

Client Integration

To use this server with an MCP client:

  1. Import the MCP client library for your language
  2. Connect to the server using stdio transport
  3. Call the available tools using the MCP protocol

Example client code (using the Rust MCP client):

use mcp_client::{ClientBuilder, transport::StdioTransport};
use serde_json::json;

#[tokio::main]
async fn main() -> Result<()> {
    // Path to the server executable
    let server_path = "path/to/fs-mcp-server";
    
    // Create and connect to server
    let (transport, mut receiver) = StdioTransport::new(server_path, vec![]);
    
    let client = ClientBuilder::new("fs-client", "0.1.0")
        .with_transport(transport)
        .build()?;
    
    // Start message handling
    let client_for_handler = client.clone();
    tokio::spawn(async move {
        while let Some(message) = receiver.recv().await {
            if let Err(e) = client_for_handler.handle_message(message).await {
                eprintln!("Error handling message: {}", e);
            }
        }
    });
    
    // Initialize the client
    let init_result = client.initialize().await?;
    println!("Connected to: {} v{}", init_result.server_info.name, init_result.server_info.version);
    
    // List all allowed directories
    let allowed_dirs_result = client.call_tool("list_allowed_dirs", &json!({})).await?;
    println!("Allowed directories: {:?}", allowed_dirs_result);
    
    // List files in a directory
    let list_result = client.call_tool("list", &json!({
        "path": "/path/to/directory"
    })).await?;
    
    // Process result
    println!("List result: {:?}", list_result);
    
    // Edit a file by replacing text
    let edit_result = client.call_tool("edit", &json!({
        "path": "/path/to/file.txt",
        "operations": [
            {
                "type": "replace",
                "find": "TODO",
                "replace": "DONE",
                "occurrence": -1
            }
        ],
        "backup": true
    })).await?;
    
    // Process result
    println!("Edit result: {:?}", edit_result);
    
    // Shutdown
    client.shutdown().await?;
    
    Ok(())
}

Development

Project Structure

  • src/main.rs: Server entry point and initialization
  • src/tools/: Tool implementations (list, read, search, edit, etc.)
  • src/utils/: Utility functions (path validation, etc.)

Adding New Tools

To add a new filesystem tool:

  1. Create a new file in src/tools/ for your tool
  2. Implement the tool's schema and execute functions
  3. Add the tool to the server builder in build_server() in main.rs

Building for Different Platforms

# Build for Linux
cargo build --release --target x86_64-unknown-linux-gnu

# Build for macOS
cargo build --release --target x86_64-apple-darwin

# Build for Windows
cargo build --release --target x86_64-pc-windows-msvc

License

MIT

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Filesystem MCP Server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/fs-mcp-server-colinrozzi)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related file systems-docs MCP Servers

Alternative and complementary servers in the same category

View all in file systems-docs →

A Model Context Protocol server for global law with read-only tools to find and read provisions by date, trace the law behind each word, search text and changes, and check cases or briefs against law in force.

Repository stats unavailable
Files & Documentation
LoreKeeper MCP server
lorekeeper-rpg-lorekeeper-com•lore-keeper

Hosted MCP server for tabletop RPG worlds that organizes messy notes and documents into a private store and lets MCP apps search lore, read documents, find characters, and optionally generate character or world pictures.

Repository stats unavailable
Files & Documentation

An MCP server that gives AI assistants scoped file system operations inside a project directory, with read-only reference projects plus git and GitHub tools.

Repository stats unavailable
Files & Documentation