Skip to main content

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

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

Metadata

Release files for filesystem-mcp 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for filesystem-mcp 1.0.2
File Size Uploaded Provenance
filesystem_mcp-1.0.2.tar.gz 8.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for filesystem-mcp 1.0.2
File Interpreter ABI Platform
filesystem_mcp-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 15.2 kB

Release files / filesystem_mcp-1.0.2.tar.gz

Download URL filesystem_mcp-1.0.2.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d28a819079c7b5b95ec27e35da368eabed55371d7432264e60b9273b26aead23
BLAKE2b-256 checksum
How to use checksums
7417cc8bdd36233a73c462dc03cc21fd924d7fd8c5cfaf4c73e5052b17d17b94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.8

Release files / filesystem_mcp-1.0.2-py3-none-any.whl

Download URL filesystem_mcp-1.0.2-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94610f0b73df1d3ada4ef0353353eb93695645c7b82f71ca80ed13dc1022c235
BLAKE2b-256 checksum
How to use checksums
89b93fc76822dabba96f035402b5e590b12e88f19c5a960813ac4c062a07184b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.8

Security for filesystem-mcp 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page