File system MCP

File system MCP

这是一个文件系统MCP服务器,它可以让LLM从您本地机器上的指定目录读取和列出文件。

简介

filesys 是一个轻量级 MCP 服务器,安全地暴露指定目录中的文件内容和元数据,允许您列出文件并读取其内容。

示例预览

快速安装

git clone https://github.com/iBz-04/Filesys.git
cd Filesys
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt

配置

编辑 config/config.json 指定文件目录:

{
  "directory": "./safe_folder"
}

使用方法

  1. 启动服务器

    python run.py
    
  2. 与服务器交互

    运行示例客户端:

    python example_client.py
    

    或使用 MCP 协议访问端点:

    • 列出文件:files://list
    • 读取文件:files://read/{filename}

功能

  • 列出文件:获取配置目录中所有文件的列表
  • 读取文件:获取指定文件的内容和元数据(大小和修改时间)

测试

python -m unittest discover tests

详细文档和源代码可在 GitHub 仓库中找到:https://github.com/iBz-04/Filesys.git