Skip to main content
Glama
filesystem-mcp

filesystem-mcp

by kujirahand

filesystem-mcp

An MCP server (Python) that can only read and write files inside folders you explicitly allow.

→日本語版はこちら (README-ja.md)

  • Uses the Python MCP SDK (mcp v2), following the latest MCP specification

  • Communicates over stdio

  • Every tool supports outputSchema / structuredContent (structured output)

Tools

Tool

Description

Arguments

list_allowed_directories

Returns the list of allowed directories

none

list_directory

Lists files and folders inside a directory

path

read_file

Reads a text file

path, encoding (default utf-8)

write_file

Writes or appends to a file

path, content, append, encoding

Related MCP server: LocalFS MCP Server

Usage

Pass one or more allowed directories as startup arguments.

uvx filesystem-mcp ~/Documents/work ~/tmp

To run from source, uv sync first, then:

uv run filesystem-mcp ~/Documents/work ~/tmp
uv run python -m filesystem_mcp ~/Documents/work

Any access outside the specified directories (and their subdirectories) fails with an error. Escaping via .. or a symlink is blocked too, since paths are checked against their resolved (real) location.

Registering with clients

uvx lets you run the server without installing it up front (it's fetched automatically on first use).

Run it from PyPI:

uvx filesystem-mcp ~/Documents/work

You can also install it with pip:

pip install filesystem-mcp
filesystem-mcp ~/Documents/work

Run it from a local checkout during development:

uvx --from /path/to/mcp_server-filesystem filesystem-mcp ~/Documents/work

Or run it directly from GitHub:

uvx --from git+https://github.com/kujirahand/mcp_server-filesystem filesystem-mcp ~/Documents/work

The trailing arguments (one or more) are the allowed directories.

Claude Code

claude mcp add filesystem -- uvx filesystem-mcp ~/Documents/work

Check the registration with claude mcp list, remove it with claude mcp remove filesystem.

Codex CLI

codex mcp add filesystem -- uvx filesystem-mcp ~/Documents/work

Or configure it directly in ~/.codex/config.toml:

[mcp_servers.filesystem]
command = "uvx"
args = ["filesystem-mcp", "~/Documents/work"]

List servers with codex mcp list, remove with codex mcp remove filesystem.

Claude Desktop

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "filesystem": {
      "command": "uvx",
      "args": ["filesystem-mcp", "~/Documents/work"]
    }
  }
}

Testing with MCP Inspector

MCP Inspector lets you try out the tools without registering the server with a client (requires Node.js).

Using the GUI

npx -y @modelcontextprotocol/inspector uv run filesystem-mcp ~/Documents/work

When the browser opens, click Connect on the left to connect, then go to the Tools tab and click List Tools to see the available tools. Select a tool, fill in its arguments, and click Run Tool to see the result (including structured output).

To test against the published PyPI version instead, swap out the uv run part:

npx -y @modelcontextprotocol/inspector uvx filesystem-mcp ~/Documents/work

Using the CLI

Adding --cli returns the result as JSON without opening a browser, which is handy for quick checks and automation.

List tools:

npx -y @modelcontextprotocol/inspector --cli uv run filesystem-mcp ~/Documents/work \
  --method tools/list

Check the allowed directories:

npx -y @modelcontextprotocol/inspector --cli uv run filesystem-mcp ~/Documents/work \
  --method tools/call --tool-name list_allowed_directories

List a directory:

npx -y @modelcontextprotocol/inspector --cli uv run filesystem-mcp ~/Documents/work \
  --method tools/call --tool-name list_directory --tool-arg path=$HOME/Documents/work

Write and read a file (add one --tool-arg per argument):

npx -y @modelcontextprotocol/inspector --cli uv run filesystem-mcp ~/Documents/work \
  --method tools/call --tool-name write_file \
  --tool-arg path=$HOME/Documents/work/memo.txt --tool-arg content=hello

npx -y @modelcontextprotocol/inspector --cli uv run filesystem-mcp ~/Documents/work \
  --method tools/call --tool-name read_file --tool-arg path=$HOME/Documents/work/memo.txt

Pointing at a path outside the allowed directories returns "isError": true with a message like Path not allowed.

Tests

uv run pytest

License

MIT

Available Tools

4 tools
list_allowed_directories許可フォルダの一覧A
Read-onlyIdempotent

このサーバーが読み書きを許可されているフォルダの一覧を返します。

Inputs: no named parameters. Returns: 許可フォルダの一覧。

list_directoryフォルダのファイル一覧A
Read-onlyIdempotent

許可フォルダ内にあるフォルダの、ファイル・フォルダの一覧を返します。

Inputs: path (required). Returns: フォルダの一覧。

read_fileファイルの読み込みA
Read-onlyIdempotent

許可フォルダ内にあるテキストファイルの内容を読み込んで返します。

Inputs: path (required), encoding. Returns: 読み込んだファイルの内容。

write_fileファイルの書き込みA
Destructive

許可フォルダ内のファイルにテキストを書き込みます。既存のファイルは上書きされます(append を True にすると末尾に追記します)。

Inputs: path (required), content (required), append, encoding. Returns: 書き込みの結果。

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a distinctly different purpose: listing allowed roots, listing directory contents, reading a file, and writing a file. The only potentially similar pair is list_allowed_directories and list_directory, but the descriptions clearly separate them.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun snake_case pattern: list_*, list_*, read_file, write_file. The naming is predictable and easy to extend.

    Tool Count5/5

    Four tools is a reasonable, focused count for a minimal filesystem access server. Each tool covers a distinct core operation and none feel redundant.

    Completeness2/5

    The set covers listing and file read/write, but lacks essential filesystem operations like creating or deleting directories, deleting or renaming files, and checking file metadata. Common workflows will hit dead ends.

    Maintenance

    ActivityStale
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      D
      maintenance
      Enables secure filesystem operations with directory sandboxing and optional read-only mode. Supports file reading/writing, directory management, file searching, and text operations while restricting access to specified directories.
      12
      -
    • 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.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides a hardened filesystem interface that lets a local model read and write files only within user-specified directories, with symlink protection and atomic operations.
      2
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables AI assistants to list directories, read, write, and search files within a locked root directory, using resolve-then-validate path checks, size caps, and binary detection to prevent sandbox escapes.
      4
      MIT