Fire in da houseTop Tip:Most people pay up to $340 per month for Perplexity, MidJourney, Runway, ChatGPT, and more - but you can get them all your AI tools for $15 with Galaxy. It's free to test!Fire in da houseCheck it out

mcp-filesystem-python

MCP.Pizza Chef: punkpeye

mcp-filesystem-python is a Model Context Protocol (MCP) server implemented in Python that provides secure, read-only access to files within a specified directory. It exposes files as MCP resources using the file:// URI scheme and supports file search capabilities through MCP tools. The server respects .gitignore patterns to exclude files and includes security features such as path traversal protection to ensure safe file access. Additionally, it detects MIME types for files, enhancing context awareness. It integrates easily with Claude Desktop and can be installed and run using UV commands, making it a robust solution for exposing filesystem data to LLMs like Claude, GPT-4, and Gemini.

Use This MCP server To

Expose local files as MCP resources for LLM access Perform secure, read-only file searches within directories Integrate filesystem data into AI workflows Respect .gitignore patterns to exclude files Detect MIME types for enhanced file context Protect against path traversal attacks in file access Enable Claude Desktop integration for file context Serve files over MCP for multi-LLM environments

README

MCP Filesystem Python

A Model Context Protocol (MCP) server that provides secure, read-only access to files in a specified directory.

Features

  • Exposes files as MCP resources using `file://` URI scheme
  • Provides file search capabilities through MCP tools
  • Respects .gitignore patterns
  • Security features including path traversal protection
  • MIME type detection

Installation

Using UV:

uv add mcp-filesystem-python

Usage

Run the server:

uv run src/filesystem/server.py /path/to/directory

Claude Desktop Integration

Configuration Examples

Example configurations for Claude Desktop can be found in the `examples` directory:

  • `examples/claude_desktop_config.json`: Example for macOS/Linux
  • `examples/claude_desktop_config_windows.json`: Example for Windows

These files should be placed at:

  • macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
  • Windows: `%AppData%\Claude\claude_desktop_config.json`

Make sure to:

  1. Replace the paths with your actual paths
  2. Use forward slashes (`/`) for macOS/Linux and backslashes (`\\`) for Windows
  3. Use absolute paths (not relative paths)

Development

  1. Clone the repository
  2. Create virtual environment and sync requirements, uv sync

License

MIT

mcp-filesystem-python FAQ

How do I install mcp-filesystem-python?
Install it easily using UV with the command `uv add mcp-filesystem-python`.
How do I run the mcp-filesystem-python server?
Run the server by executing `uv run src/filesystem/server.py /path/to/directory` specifying the directory to expose.
Does mcp-filesystem-python support file exclusion?
Yes, it respects .gitignore patterns to exclude files from being exposed.
How does mcp-filesystem-python ensure security?
It includes path traversal protection to prevent unauthorized file access outside the specified directory.
Can mcp-filesystem-python detect file types?
Yes, it performs MIME type detection to provide context about file contents.
Is mcp-filesystem-python compatible with Claude Desktop?
Yes, it includes example configuration files for easy integration with Claude Desktop on macOS, Linux, and Windows.
What URI scheme does mcp-filesystem-python use to expose files?
It uses the `file://` URI scheme to expose files as MCP resources.
Can mcp-filesystem-python be used with multiple LLM providers?
Yes, it is designed to work with various LLMs including Claude, GPT-4, and Gemini.