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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

filesystem_mcp-1.0.2.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

filesystem_mcp-1.0.2-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file filesystem_mcp-1.0.2.tar.gz.

File metadata

  • Download URL: filesystem_mcp-1.0.2.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.8

File hashes

Hashes for filesystem_mcp-1.0.2.tar.gz
Algorithm Hash digest
SHA256 d28a819079c7b5b95ec27e35da368eabed55371d7432264e60b9273b26aead23
MD5 a177c5e23a8bd20e46cf4cfd34115f7a
BLAKE2b-256 7417cc8bdd36233a73c462dc03cc21fd924d7fd8c5cfaf4c73e5052b17d17b94

See more details on using hashes here.

File details

Details for the file filesystem_mcp-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for filesystem_mcp-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 94610f0b73df1d3ada4ef0353353eb93695645c7b82f71ca80ed13dc1022c235
MD5 18d2edf2a343f2f7e8d3843f4400a90e
BLAKE2b-256 89b93fc76822dabba96f035402b5e590b12e88f19c5a960813ac4c062a07184b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 files

1.0.1

2 files

1.0.0

2 files

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