文件系统MCP服务器

一个基于Python MCP SDK构建的轻量级但功能齐全的文件操作服务器,适用于需要集中管理文件操作的后端服务。

  • by paskalex1
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 paskalex1/filesystem-mcp-server

使用说明

文件系统MCP

用于文件操作的最小但功能齐全的MCP服务器。它基于Python MCP SDK(FastMCP,Streamable HTTP),为Command Center和其他MCP客户端提供单一的后端文件。

机会

  • 安全的fs_root具有防火墙外的保护功能(_safe_join).
  • 全套工具:
    • 读/写文本和二进制文件(Base64);
    • 创建/删除/移动/复制文件和目录;
    • 高级搜索(glob/substring/regex),stat,touch,chmod,set_mtime;
    • 符号链接、压缩/解压缩、JSON/YAML、resolve_path;
    • 用于存档的快速路径和JSON/YAML,现在直接从Command Center UI访问。
  • 每个命令返回结构化数据(structuredContent.result)并且有一个详细的docstring(RUS/ENG)+I/O方案。
  • 烟雾测试 tests/test_smoke.py 检查结束到结束的基本脚本(initialize→tools.list→mkdir→write/read→zip/unzip→JSON I/O)。

局部起动

git clone https://github.com/paskalex1/filesystem-mcp-server.git
cd filesystem-mcp-server
python3 -m venv .venv && source .venv/bin/activate  # опционально
pip install -r requirements.txt  # пока зависимости тянутся из pyproject через pip install .

通过Docker(在Command Center中使用):

docker-compose up -d --build
docker-compose logs -f filesystem-mcp

集装箱听 0.0.0.0:8000在网上 command_center_mcp-net 像 filesystem-mcp:8000 外面 localhost:8020.

烟雾测试

在抽出来之前,最好先开始吸烟:

MCP_BASE_URL=http://localhost:8020/mcp python3 -m unittest tests.test_smoke

测试创建临时目录/文件,存档并删除它们-所有痕迹都被清除 tearDown().

出口工具

改变后不要忘记:

  1. docker-compose up -d --build
  2. docker-compose exec web curl -X POST http://localhost:8000/api/mcp/servers/<id>/sync-tools/
  3. 在Command Center UI中验证代理访问和快速操作。