Python (MCP) Filesystem Server
@hypercat
About Python (MCP) Filesystem Server
This is a robust Python-based MCP Filesystem Server. It enables AI models and applications to securely interact with the host system's file directories through a defined set of tools, allowing for operations like reading, writing, moving, and listing files and directories.
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"PyMCP-FS": {
"command": "uv",
"args": [
"pip",
"install",
"-r",
"pyproject.toml"
]
}
}
}Tools
No tools detected
We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.
Overview
What is Python (MCP) Filesystem Server?
Python (MCP) Filesystem Server is a Python-based Model Context Protocol (MCP) server that enables AI models and applications to securely interact with host file directories via a defined set of tools. It uses the fastmcp library and confines all file operations to a configurable list of allowed directories.
How to use Python (MCP) Filesystem Server?
Clone the repository and initialize with uv pip install -r pyproject.toml. Run python3 main.py -d /path/to/allowed/dir1 /path/to/another/allowed/dir2 [--log-level LEVEL] [--log-file PATH]. The server listens for MCP messages on stdin and responds on stdout. A test script (test_mcp_server.py) is provided to verify functionality.
Key features of Python (MCP) Filesystem Server
- Strict confinement to predefined allowed directories.
- Tools for reading, writing, editing, moving, and listing files.
- Recursive directory tree generation.
- Configurable logging with file rotation.
- Symlink validation to prevent path escape.
Use cases of Python (MCP) Filesystem Server
- Allowing an AI assistant to read and edit source code in a project directory.
- Enabling a chatbot to manage user-uploaded files (e.g., drafts, notes).
- Providing controlled filesystem access for automated reporting or data processing tools.
- Letting an AI model safely list and inspect files within a sandboxed workspace.
FAQ from Python (MCP) Filesystem Server
What directories can the server access?
Directories are specified at startup via the -d or --directories argument. The server will only operate within those paths.
What Python version and dependencies are required?
Python 3.8 or higher is required, along with the fastmcp library.
How does the server handle symlinks?
Symlink targets are validated to ensure they do not point outside the configured allowed directories, preventing path escape.
What transport protocol does the server use?
The server uses standard input/output (stdin/stdout) for MCP communication, adhering to JSON‑RPC 2.0 messages.
What logging options are available?
Log level can be set via --log-level (DEBUG, INFO, WARNING, ERROR; default INFO). An optional --log-file writes logs to a rotating file.
Frequently asked questions
What directories can the server access?
Directories are specified at startup via the `-d` or `--directories` argument. The server will only operate within those paths.
What Python version and dependencies are required?
Python 3.8 or higher is required, along with the `fastmcp` library.
How does the server handle symlinks?
Symlink targets are validated to ensure they do not point outside the configured allowed directories, preventing path escape.
What transport protocol does the server use?
The server uses standard input/output (stdin/stdout) for MCP communication, adhering to JSON‑RPC 2.0 messages.
What logging options are available?
Log level can be set via `--log-level` (DEBUG, INFO, WARNING, ERROR; default INFO). An optional `--log-file` writes logs to a rotating file.
Basic information
More Files & Storage MCP servers
box-mcp-server
hmkA Box model context protocol server to search, read and access files
md-pdf-mcp (Markdown to PDF MCP Server)
seanivoreMarkdown To PDF Conversion MCP
MCP Filesystem Server
mark3labsGo server implementing Model Context Protocol (MCP) for filesystem operations.
PDF Tools MCP
danielkennedy1Claude Document MCP Server
alejandroBallesterosCA lightweight MCP server for processing, editing, and interacting with PDF, Word, Excel, and CSV documents.
Comments