Skip to main content
Glama
Polarts

fs-mcp

by Polarts

fs-mcp

一个微型的 MCP 服务器,提供六个工具:

  1. explore_filesystem(subpath?, glob?) — 列出根目录下的文件/文件夹,可选地按 glob 过滤(如 **/*.js)。

  2. edit_file(path, edits[], createIfMissing?) — 对根目录下的文件应用 git 风格的行编辑(替换/插入/删除行范围)。

  3. create_file(path, content?, overwrite?) — 创建新文件,可选内容,必要时创建父目录。

  4. delete_file(path, recursive?) — 删除根目录下的文件或目录(对非空目录可选递归删除)。

  5. read_file(path, startLine?, endLine?) — 读取文件内容,可选地限定行范围,并带行号前缀。

  6. grep(pattern, glob?, useRegex?, caseInsensitive?) — 在文件中搜索文本模式,可选正则支持与 glob 过滤。

根目录 = 进程启动时的工作目录。

作为全局 CLI 安装

npm install
npm link          # or: npm install -g .

这会给你一个全局的 fs-mcp 命令(通过 package.json 中的 bin 字段配置)。

Related MCP server: LocalFS MCP Server

运行

fs-mcp                 # stdio mode (default) — for Claude Desktop/Code,
                        # which spawn the process themselves
fs-mcp --http          # HTTP mode on http://localhost:4823/mcp — for
                        # curl, the MCP Inspector, or the on-demand
                        # Claude Desktop setup below
fs-mcp --http -p 5000   # custom port
fs-mcp --help

你运行它时所在的文件夹即为暴露的根目录。

连接到 Claude Desktop

Claude Desktop 会自行启动 MCP 服务器并通过 stdio 通信——它不会继承你终端的当前目录。这给了你两种配置方式,取决于你的使用习惯:

方式 A — 从任意文件夹按需启动(如果你喜欢 CLI 的感觉,推荐此方式)

只需配置 Desktop 一次,指向一个固定的本地端口,而不是固定的文件夹。参见 claude_desktop_config.example.json——将其中的 "fs-mcp" 条目合并到你现有的 mcpServers 对象中,位置在:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

  • Linux: ~/.config/Claude/claude_desktop_config.json

重启 Claude Desktop 一次。之后:

cd ~/whatever/project
fs-mcp --http

那个文件夹就是 Claude 能看到的内容,只要服务器在运行。按 Ctrl+C 停止,然后在不同文件夹中重新启动即可切换上下文——无需再修改 Desktop 配置。

注意:需要 --allow-http,因为 mcp-remote(stdio↔HTTP 桥接)默认期望真实远程服务器使用 HTTPS + OAuth;此标志告诉它普通的未认证 localhost 流量也是可以的。

方式 B — 一个固定文件夹,始终可用

如果你希望 Desktop 始终暴露同一个项目,而不必手动启动任何东西:

{
  "mcpServers": {
    "fs-mcp": {
      "command": "fs-mcp",
      "cwd": "/absolute/path/to/the/folder/you/want/exposed"
    }
  }
}

重启 Desktop。这直接使用 stdio 模式——无需代理,无需手动执行 fs-mcp --http 步骤——但更改暴露的文件夹需要编辑此配置并再次重启 Desktop。

安全说明

  • 每个路径都会相对于根目录解析,如果试图越界(如 ../../etc/passwd)则会被拒绝——已通过路径穿越测试验证。

  • 没有认证机制。任何能访问到服务器(在 --http 模式下为任何本地进程)的东西都可以读写根目录下的任何文件。仅适用于可信的本地开发环境;不要在敏感环境中运行,也不要绑定到 localhost 之外。

编辑语义(edit_file)

编辑操作是 {startLine, endLine, newLines},从 1 开始计数,包含两端:

  • 替换第 3–5 行:{startLine: 3, endLine: 5, newLines: ["new content"]}

  • 删除第 3–5 行:{startLine: 3, endLine: 5, newLines: []}

  • 在第 6 行之前插入(无删除):{startLine: 6, endLine: 5, newLines: ["inserted"]}

一次调用中的多个编辑会从底部向上依次应用,因此编辑列表中的行号不会因先前的编辑而偏移。

Available Tools

6 tools
create_fileCreate fileA

Create a new file under the root, with the given text content. Creates any missing parent directories. Fails if the file already exists unless overwrite is set to true.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesFile path relative to root
contentNoText content for the new file
overwriteNoIf true, replace the file if it already exists

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It clearly discloses key behaviors: creates a new file under root, creates missing directories, fails if file exists unless overwrite is true. This is strong transparency, though it omits details like permissions or error handling.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence that front-loads the main purpose, followed by two short sentences for key details (directory creation and overwrite). No fluff; every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple CRUD create operation with 3 params and no output schema, the description covers the essential behavior. It explains path resolution, directory creation, and overwrite, which are key for correct invocation. It could include a note about what happens on success (e.g., returns nothing), but that is minor given the simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% (all parameters described in schema), so baseline is 3. The description adds value by clarifying that 'path' is relative to root (schema says relative, but description emphasizes it) and that content is for text. It also explains overwrite default behavior in context, which goes beyond schema's default value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create a new file'), the target resource ('under the root'), and the content parameter ('with the given text content'). It also distinguishes from siblings by specifying the creation action and outlining key behaviors like creating missing directories and overwrite semantics.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use: to create a new file, and it differentiates from edit_file and delete_file by focusing on creation. It also explains the overwrite behavior, which is a common decision point. However, it does not explicitly state when not to use (e.g., use edit_file for existing files unless overwriting).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

delete_fileDelete fileA

Delete a file, or a directory, under the root. Deleting a non-empty directory requires recursive: true. Refuses to delete the root itself.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesFile or directory path relative to root
recursiveNoRequired to delete a non-empty directory

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of disclosing behavior. It covers destructive edge cases: non-empty directory handling and protection against deleting the root. However, it omits whether deletion is permanent or any permission requirements, leaving some transparency gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise: two sentences, no fluff, and directly addresses key aspects. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (2 params, no output schema), the description covers all essential behaviors: what can be deleted (file or directory), the recursive nuance, and root safety. No critical information is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters well. The description adds value by clarifying the root-relative scope and root-deletion refusal, but these are complementary details rather than extensive new semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Delete a file, or a directory, under the root' with a specific verb and object, and distinguishes itself from sibling tools like read_file and edit_file by its delete action. The root-scoping detail further refines its purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides important context such as 'Deleting a non-empty directory requires recursive: true' and that it refuses to delete the root, but it does not explicitly contrast with alternative tools or state when not to use it. Usage is implied rather than directly compared to siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

edit_fileEdit fileA

Apply git-style line edits to a file under the root. Each edit replaces lines [startLine, endLine] (1-indexed, inclusive) with newLines. To delete lines, pass an empty newLines array. To insert without deleting anything, set endLine = startLine - 1. Multiple edits in one call are applied bottom-to-top so line numbers stay valid.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesFile path relative to root
editsYes
createIfMissingNo

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It thoroughly explains the edit semantics (inclusive line ranges), the bottom-to-top application order for multiple edits, and the empty array for deletion. It also covers the insert case via endLine = startLine - 1, and mentions the createIfMissing flag implicitly through schema, but the description's core behaviors are well-disclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact, front-loaded with the verb and object, and every sentence adds essential operational detail (line indexing, insert/delete patterns, ordering). No filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 3 params, no output schema, and no annotations, it covers all necessary behavior: line ranges, deletion, insertion, ordering, and path restriction. The createIfMissing param is in schema but not described, but its default false and the tool's purpose make it low-risk. The description is complete for an agent to use correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is only 33%, so the description must compensate. It does: it explains each parameter's role (startLine, endLine, newLines) and the special values for insert/delete. It also clarifies the semantics of multiple edits.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it applies git-style line edits to a file, distinguishing it from create/delete operations. It specifies the file must be under the root, and the exact semantics of line replacement.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for editing existing files, and explicitly explains deletion and insertion patterns. It does not explicitly state when not to use it (e.g., for creating new files, use create_file), but the contrast with sibling tools is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

explore_filesystemExplore filesystemA

List files and folders under the server's root directory (the folder the server process was started in). Optionally scope to a subpath and/or filter with a glob pattern (supports *, ** and ?).

ParametersJSON Schema
NameRequiredDescriptionDefault
globNoOptional glob to filter results, e.g. '**/*.js' or 'src/*.ts'
subpathNoSubdirectory to list, relative to root. Defaults to root ('.')

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It usefully clarifies that root means the server's start directory and that globs support *, **, and ?. However, it omits traversal behavior (recursive vs. shallow), whether results include metadata like paths or sizes, and how directories are distinguished from files—gaps the agent must guess at.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two tightly packed sentences: the first states the core action and location scope, the second covers both optional parameters in one clause. Every word contributes—no filler, no restating of the tool name.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a low-complexity listing tool with no output schema and no annotations, the description covers the essential aspects: what is listed, the base directory semantics, and the scoping/filter options. The main gap is the absence of return-value shape (absolute vs. relative paths, ordering), which the agent must infer. Minor but real, keeping it below a 5.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. The description adds genuine value by specifying the root base for subpath resolution ('relative to root') and documenting the supported glob syntax (*, **, ?), which goes beyond the schema's brief examples. This enrichment justifies the 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

"List files and folders under the server's root directory" uses a specific verb (list) plus a precise resource scope (files/folders under the server's start directory). This clearly distinguishes it from content-focused siblings like read_file, grep, and edit_file, which all operate on the contents of individual files.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description conveys when to use it as a discovery tool ('List files and folders') and offers optional scoping ('scope to a subpath and/or filter with a glob pattern'). However, it never explicitly states what it is NOT for (e.g., reading file contents, searching inside files) or names alternatives, leaving the contrast with grep/read_file implicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

grepSearch files with grepA

Search for text patterns in files under the root. Supports regex patterns and optional glob filtering to limit which files are searched. Returns matching lines with file paths and line numbers.

ParametersJSON Schema
NameRequiredDescriptionDefault
globNoOptional glob pattern to filter files, e.g. '**/*.js' or 'src/**/*.ts'
patternYesSearch pattern (regex if useRegex is true, otherwise literal string match)
useRegexNoIf true, treat pattern as a regex. If false, search for literal string
caseInsensitiveNoIf true, perform case-insensitive search

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses the return format ('matching lines with file paths and line numbers') but does not explicitly state read-only behavior or other safety traits. The verb 'Search' implies read-only, but it could be more explicit.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the core purpose, then covering filters and return format. No wasted words, clear and efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple with 4 parameters all documented. The description covers the main function, filtering options, and return format. It doesn't mention edge cases or performance, but for a search tool it is sufficiently complete given the schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, and each parameter has a thorough description. The tool description adds 'Supports regex patterns and optional glob filtering,' which reiterates schema fields without adding new semantics. Baseline 3 applies for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Search for text patterns in files under the root' – a specific verb and resource. It distinguishes from siblings like read_file (reading a specific file) and explore_filesystem (browsing structure) by focusing on content search.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions 'Supports regex patterns and optional glob filtering to limit which files are searched,' providing clear usage context. However, it does not explicitly contrast with alternatives or state when not to use it, though the context is sufficient for most cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

read_fileRead fileA

Read the text content of a file under the root. Optionally scope to a 1-indexed, inclusive line range via startLine/endLine. Returns the content with 1-indexed line numbers prefixed, plus the file's total line count.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesFile path relative to root
endLineNo1-indexed end line, inclusive. Defaults to end of file
startLineNo1-indexed start line, inclusive. Defaults to 1

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses the output format (line numbers prefixed, total line count), the inclusive nature of the line range, and the scoping to 'under the root.' This exceeds a minimal disclosure, though it omits details like encoding or error handling, which are not critical for this simple read operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the core purpose and then the optional scoping and return format. Zero fluff, every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read tool with no output schema, the description covers purpose, parameters, and return format (line numbers and total count), which is sufficient for an agent to invoke it correctly. It also notes the root constraint, covering the main operational context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. The description restates that startLine/endLine are 1-indexed and inclusive and mentions defaults, but these are already fully described in the schema. No additional meaning is added beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states 'Read the text content of a file under the root' with a specific verb and resource, and clearly distinguishes from siblings like edit_file (modify), grep (search), and explore_filesystem (browse). It also specifies the optional line-range feature, making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied: it's for reading a file, and the line-range option is explained. However, there's no explicit guidance on when not to use it (e.g., for large files or searching) or any mention of alternatives like grep for content search or explore_filesystem for directory listing, leaving the distinction to the sibling list.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 6 tool updatesv1.0.0
    • First observedcreate_file
    • First observeddelete_file
    • First observededit_file
    • First observedexplore_filesystem
    • First observedgrep
    • First observedread_file

TDQS

A4.3/5.0

Scored across 6 tools

Disambiguation5/5

Each tool targets a distinct filesystem operation: listing, reading, creating, editing, deleting, and searching. There is no meaningful overlap between grep and read_file, or between create_file and edit_file, so an agent can reliably select the right tool.

Naming Consistency4/5

Most tools follow a consistent verb_noun snake_case pattern: explore_filesystem, edit_file, create_file, delete_file, read_file. The one exception is 'grep', which is a conventional command name but slightly breaks the verb_noun pattern.

Tool Count5/5

Six tools is a well-scoped set for a filesystem server. Each tool covers a distinct core operation without redundancy or bloat, fitting comfortably within the ideal 3-15 tool range.

Completeness4/5

The server covers the full basic lifecycle: list, read, create, edit, delete, and search. Minor gaps exist such as rename/move and file metadata/stat operations, but these can be worked around with existing tools.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables reading, creating, and editing files on the local filesystem through operations like view, create, string replacement, and line insertion.
    109 npm
    3
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides sandboxed access to local filesystem operations including directory and file management, content search with glob and regex patterns, and binary file support with configurable safety limits.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables file system operations such as listing, reading, and creating files within a scoped local project directory. It provides a secure way to manage local files through standardized MCP tools built with FastMCP.
    -