maic-server-fs-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@maic-server-fs-mcp List files in the current directory"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Local Filesystem MCP Server (maic-server-fs-mcp)
一个基于 Model Context Protocol (MCP) 构建的自定义本地文件系统与命令行执行服务。此工具已被发布至 NPM,支持通过 npx 直接在 LLM 客户端(如 Cursor、Claude Desktop 等)中无缝运行。
🛠️ 核心工具 (Tools)
本 MCP 服务端向 LLM 提供了以下接口能力:
工具名称 | 作用描述 | 输入参数 |
| 读取指定本地文件内容 |
|
| 写入或更新本地文件(若父级目录不存在会自动创建) |
|
| 列出目标文件夹内容(已自动忽略 |
|
| 在终端中运行命令(同步执行,最长 30 秒超时) |
|
| 派发特定任务给下属专家( |
|
| 人工审核插桩,用于人工确认 |
|
| 扫描并为代码库构建本地向量索引(支持 JS/TS/JSX/TSX) |
|
| 语义化检索整个代码库,寻找匹配的代码片段 |
|
Related MCP server: ai-distiller-mcp
🧠 本地代码 RAG 功能说明
为了使用 buildCodebaseIndex 和 searchCodebase(基于 text-embedding-004 模型),您需要在使用前配置 GEMINI_API_KEY 环境变量:
命令行启动时设置:
export GEMINI_API_KEY="your-gemini-api-key" npx -y --package maic-server-fs-mcp mcp-server-fsCursor 编辑器配置: 在 Cursor 设置 MCP 时,您也可以在 Shell 配置文件(如
~/.zshrc或~/.bashrc)中全局导出GEMINI_API_KEY,这样 Cursor 启动的进程可以读取到该变量。Claude Desktop 配置文件配置 (
claude_desktop_config.json):"maic-local-filesystem-mcp": { "command": "npx", "args": [ "-y", "--package", "maic-server-fs-mcp", "mcp-server-fs" ], "env": { "GEMINI_API_KEY": "your-gemini-api-key" } }
工作机制:
构建索引:调用
buildCodebaseIndex时,系统将扫描目录内的所有代码文件并按最长 40 行的窗口进行滑动切片,再通过 Gemini Embeddings API 向量化并保存在项目根目录的.rag_cache.json中。语义化检索:调用
searchCodebase时,系统向量化您的查询,计算其与本地缓存中所有代码片段的余弦相似度(Cosine Similarity),并返回相似度最高的topK个真实代码片段。
🔌 接入与集成当前 MCP 服务
您可以通过 NPM 方式直接运行(推荐),或者使用本地克隆源码开发模式。
方式 1: 通过 NPM 接入(最简便,推荐)
A. 接入 Cursor 编辑器
打开 Cursor 设置:进入 Settings ➡️ Features ➡️ MCP。
点击 + Add New MCP Server:
Name:
maic-local-filesystem-mcpType:
commandCommand:
npx -y --package maic-server-fs-mcp mcp-server-fs
点击 Save。等待状态指示灯亮起绿色 🟢。
B. 接入 Claude Desktop
打开并编辑 Claude Desktop 的配置文件:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
在
mcpServers节点内,追加如下配置:{ "mcpServers": { "maic-local-filesystem-mcp": { "command": "npx", "args": [ "-y", "--package", "maic-server-fs-mcp", "mcp-server-fs" ] } } }保存文件并重启 Claude Desktop。
方式 2: 使用本地克隆源码运行(适合贡献者/二次开发)
1. 安装与构建
git clone https://github.com/maicFir/server-fs-mcp.git
cd server-fs-mcp
npm install
npm run build # 编译生成 dist/server.js2. 在客户端中配置本地路径
Cursor (Command):
node /absolute/path/to/server-fs-mcp/dist/server.jsClaude Desktop (
claude_desktop_config.json):"maic-local-filesystem-mcp": { "command": "node", "args": [ "/absolute/path/to/server-fs-mcp/dist/server.js" ] }
⚠️ 开发者必看避坑指南 (Gotchas)
标准输出占用:MCP 的 stdio 传输机制完全独占了标准输出流 (
stdout) 用于 JSON-RPC 通信。因此在开发调试时,绝对不能在工具执行或初始化逻辑中使用console.log()或process.stdout.write()。调试日志:所有打印日志、调试信息请全部使用
console.error()输出,客户端会自动捕获并展示在控制台或日志文件中。
Available Tools
7 toolsbuildCodebaseIndexA
扫描整个本地代码库(js/ts/jsx/tsx文件),调用 Gemini Embedding API 构建/重构本地向量索引。当项目代码发生重大变化后,或者首次使用 searchCodebase 前,必须调用此工具构建索引。
Inputs: dirPath.
dispatchTaskA
当需要安排下属专家执行具体工作时调用此工具。每次只能派发一个任务,等下属汇报结果后,再派发下一个。
Inputs: worker (required), taskInstruction (required).
executeCommandA
在本地终端安全运行 shell 命令(如 npm test, git status, npm run build)。当修改代码后需要验证是否报错,或者需要安装依赖、运行构建时使用此工具。
Inputs: command (required), timeoutMs.
readDirectoryA
列出指定目录下的所有文件和文件夹名称(已自动忽略 node_modules 等大文件夹)。当你不确定项目结构、找不到某个文件在哪里时,必须先调用此工具,辅助 AI 了解项目结构。
Inputs: filePath (required).
readFileB
读取指定路径的本地文件内容,允许 AI 查看文件代码或文本。
Inputs: filePath (required).
searchCodebaseA
语义化检索整个本地代码库。当不知道某段功能、组件、路由在哪里时,调用此工具通过关键词或功能描述找出最相关的真实代码片段。
Inputs: query (required), topK.
writeFileA
向指定路径写入或覆盖文件内容,常用于生成/修改代码,允许 AI 修改文件代码或文本。
Inputs: content (required), filePath (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool has a clearly distinct purpose: indexing, task dispatch, command execution, directory listing, file reading, semantic search, and file writing. No overlapping functionality.
All tool names follow a consistent camelCase verb_noun pattern (e.g., readFile, searchCodebase, writeFile). No mixed conventions or irregularities.
With 7 tools, the server covers its core file system and codebase functionality without being too sparse or bloated. The count feels well-scoped for its purpose.
While the tools cover reading, writing, and searching, they lack file deletion, renaming, and directory creation, which are common file system operations. The inclusion of dispatchTask seems out of place for an FS server.
Maintenance
Related MCP Connectors
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Persistent file storage for AI agents via MCP and curl. Upload, download, and version files.
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides file system operations (list, read, write, search) via MCP, enabling an AI agent to manage files through natural language.2,105 npmMIT
- FlicenseNot gradedqualityDmaintenanceProvides filesystem access to Claude via the MCP protocol, enabling local file operations through natural language.-
- FlicenseBqualityDmaintenanceEnables file IO operations and terminal commands via agentic actions using the MCP protocol.9-
- FlicenseNot gradedqualityCmaintenanceEnables LLM agents and MCP clients to read, list, write, search, watch, and batch-process files within configured allowed directories, while exposing discoverable file resources and structured error codes.-