Filesystem MCP server for directory and file operations

Filesystem MCP server for directory and file operations

fs-mcp•bylealre

A Go-based MCP server that exposes filesystem tools within a specified base directory, runnable via stdio or HTTP/SSE transport.

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

WHAT IT DOES

  • •Lists entries at a given path with an optional directory tree depth.
  • •Reads file contents and writes or overwrites files with given content.
  • •Retrieves file information including size, last modified time, MIME type, and permissions.
  • •Renames and copies files or directories within the served base directory.

BEST FOR

  • •Restricting filesystem operations to a single base directory for use by AI agents.
  • •Integrating filesystem access into Python agents via PydanticAI using SSE or stdio.

ABOUT FS-MCP

Filesystem MCP server for directory and file operations is cataloged as an MCP server attributed to lealre. A Go-based MCP server that exposes filesystem tools within a specified base directory, runnable via stdio or HTTP/SSE transport. 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: Not specified. 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 for directory and file operations 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

Which transports can the server use?

It can run over stdio or an HTTP/SSE server; the transport is chosen with the -t flag.

Can the server be run with Docker?

Yes, but only using the SSE option, with a volume mapped to the exposed directory.

How many paths can the server serve?

Only one base directory path is accepted.

上游原版 README

在 GitHub 查看同一版本原文

README.md · c2e7bde099b1 · 采集于 2026-11-13 12:38:03 UTC

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

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

Filesystem MCP

This repository provides an implementation of the MCP to offer a suite of tools for interacting with the file system, such as listing directory entries, reading and writing files, retrieving file information, and renaming and copying files or directories.

It allows users to run using stdio or SSE server on a local machine.

Table of Contents

Installation

  1. Ensure that you have Go installed on your system. Use Go version 1.24.
  2. Run the following command to install the package using go install:
go install github.com/lealre/fs-mcp@latest
  1. Run the help command:
fs-mcp -h
  • The -dir flag specifies the base directory that the server will serve. It is required.
  • The -port flag specifies the port on which the server will listen. It is optional, with the default being 8080.
  • The -t flag specifies the transport type. It can be either stdio or http (default is stdio).

Installing Locally by Cloning the Repository

  1. Clone the repository to your local machine:
git clone https://github.com/lealre/fs-mcp.git
  1. Navigate into the cloned directory:
cd fs-mcp
  1. Build the project:
go build
  1. Run the executable:
./fs-mcp -t http -dir /your/directory/path
  • This will run the server at http://localhost:8080.

Using Docker

This MCP can only be run in Docker using the SSE option. To do so, create a volume pointing to the directory you want to expose for file system operations.

You can pull the image from Docker Hub and run it as follows:

docker pull lealre/fs-mcp:latest

Or build the image from the cloned repository:

docker build -t fs-mcp .

Run the container, mapping your desired directory and port:

docker run -p 8080:8080 -v /your/directory/path:/baseDir lealre/fs-mcp -volume "/your/directory/path:/baseDir"
  • Replace /your/directory/path with the actual path you want to serve.
  • The -p flag maps your local machine's port to the Docker container's port.
  • The -v flag specifies the path to the base directory similarly in the --volume flag to ensure Docker has access to your files.

This setup will start the server at http://localhost:8080, serving the specified directory.

[!IMPORTANT] For this to work properly, ensure the paths in -v and -volume match exactly.

The container’s base folder volume name (/baseDir) can be customized, and the port can be changed using the -port flag (along with adjusting -p in Docker). Example:

docker run -p 8081:8081 -v /your/directory/path:/baseDir lealre/fs-mcp -volume "/your/directory/path:/baseDir" -port 8081

How to Use

Once the installation is complete, you can use the server by running:

fs-mcp -t http -dir /your/directory/path

This will start the MCP server at http://localhost:8080, restricting the file system operations to be under this specific path.

For now, it only accepts one path to the server.

To change the server port, you can pass it as a flag:

fs-mcp -dir /your/directory/path -port 3000

To run it using stdio, just omit the flag -t.

Example of usage with PydanticAI in Python

Using SSE server

  • Run the MCP server:
fs-mcp -dir /your/directory/path
  • Create the Python client (using OpenAI in this case):
# script.py

import asyncio
import sys
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerSSE

server = MCPServerSSE('http://localhost:8080/sse')
agent = Agent('openai:gpt-4o', mcp_servers=[server])

async def main():
    if len(sys.argv) < 2:
        print("Usage: python script.py 'your prompt/query here'")
        sys.exit(1)

    query = sys.argv[1]

    async with agent.run_mcp_servers():
        result = await agent.run(query)

    print(result.output)

if __name__ == '__main__':
    asyncio.run(main())
  • Then you can run:
python script.py "List all the entries for the path in /your/directory/path/somesubpath"

Using stdio

  • Create the Python client (using OpenAI in this case):
# script.py

import asyncio
import sys
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerStdio

base_path = "/your/directory/path"
server = MCPServerStdio(
    'fs-mcp',
    args=['-dir', base_path]
)
agent = Agent('openai:gpt-4o', mcp_servers=[server])

async def main():
    if len(sys.argv) < 2:
        print("Usage: python script.py 'your prompt/query here'")
        sys.exit(1)

    query = sys.argv[1]

    async with agent.run_mcp_servers():
        result = await agent.run(query)

    print(result.output)

if __name__ == '__main__':
    asyncio.run(main())
  • Then you can run:
python script.py "List all the entries for the path in /your/directory/path/somesubpath"

Tool Descriptions

This project provides various tools to interact with the file system. Below are the descriptions of each tool:

  • listEntries: List entries at a given path. Parameters:

    • path (string, required): Path for which to list all entries.
    • depth (number, optional): Depth of the directory tree (default is 3).
  • readFromFile: Read the contents of a file at a given path. Parameters:

    • path (string, required): Path to the file to be read.
  • writeToFile: Create or overwrite a file with the given content. Parameters:

    • path (string, required): Path to the file to write to.
    • content (string, required): Content to write to the file.
  • getFileInfo: Retrieve file information including size, last modified time, detected MIME type, and file permissions. Parameters:

    • path (string, required): Path to the file to retrieve information from.
  • renamePath: Renames a file or directory to a new name. Parameters:

    • path (string, required): Path to the file or directory to be renamed.
    • newPathFinalName (string, required): New name for the file or directory (just the name, not the full path).
  • copyFileOrDir: Copies a file or directory to a new location. Parameters:

    • path (string, required): Path to the file or directory to be copied.
    • destination (string, required): Destination path where the file or directory will be copied.

This project uses the mcp-go library to implement core functionality.

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 for directory and file operations 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)

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