Filesystem MCP server

Implements an extensive list of filesystem operations for navigating, reading, writing, and analyzing files, enabling efficient file management and content generation tasks.
Back to servers
Provider
kvas-it
Release date
Feb 01, 2025
Language
Python
Stats
4 stars

This MCP server provides file system operations for navigating directories, reading and writing files, analyzing content, and executing commands. It offers a comprehensive set of tools to interact with the file system programmatically.

Installation

The MCP File System Server can be installed and run as part of an MCP-enabled environment. No separate installation is needed if you're already working with an MCP setup.

Usage

The server provides various tools organized by functionality. Here's how to use each category of operations:

File and Directory Operations

Navigate and manipulate files and directories:

# List directory contents
ls("/path/to/directory")

# Change working directory
cd("/path/to/directory")
# Use tilde for home directory
cd("~/projects")

# Read file contents
content = read_file("/path/to/file.txt")

# Write content to a file
write_file("/path/to/file.txt", "This is the new content")

# Create directory
mkdir("/path/to/new_directory")

# Remove file or empty directory
rm("/path/to/file.txt")

# Remove directory and contents recursively
rmdir("/path/to/directory")

# Copy file or directory
cp("/path/to/source", "/path/to/destination")

# Move file or directory
mv("/path/to/source", "/path/to/destination")

Editing and Searching

Modify files and search for content:

# Apply multiple search/replace operations to a file
edit_file("/path/to/file.txt", [
    ("old text", "new text"),
    ("another old text", "another new text")
])

# Search for regex pattern in file(s)
results = grep("pattern", "/path/to/file.txt")

File Analysis

Analyze file contents:

# Generate summary of Python or Markdown files
summary = summary("/path/to/file.py")  # Lists functions and classes
summary = summary("/path/to/file.md")  # Lists headers

Batch Operations

Process multiple files simultaneously:

# Read multiple files
files_content = read_files(["/path/to/file1.txt", "/path/to/file2.txt"])

# Generate summaries for multiple files
summaries = summarize(["/path/to/file1.py", "/path/to/file2.md"])

Project Navigation

Quickly explore project directories:

# Change to directory, list contents, and get notes
work_on("/path/to/project")

Code Quality

Check and format code:

# Run ruff linter on specified files
lint_results = ruff_check(["/path/to/file.py"])

# Format files using ruff
ruff_format(["/path/to/file.py"])

Command Execution

Execute shell commands:

# Run a shell command with arguments
result = shell_command("ls", ["-la"])

# Run a shell command with complete command line
result = shell_command(cmdline="ls -la | grep 'file'", timeout=60)

⚠️ Security Warning: The shell_command tool allows arbitrary command execution on the host system. Always inspect and validate commands before allowing them to run, especially if the input source is untrusted.

Examples

Here's a complete workflow example:

# Navigate to a project directory
cd("~/projects/my_python_app")

# List the directory contents
files = ls(".")

# Read a Python file
code = read_file("main.py")

# Get a summary of the Python file
main_summary = summary("main.py")

# Run the linter on all Python files
lint_results = ruff_check(["*.py"])

# Execute the application
output = shell_command("python", ["main.py", "--verbose"])

# Edit a configuration file
edit_file("config.json", [
    ('"debug": false', '"debug": true'),
    ('"log_level": "info"', '"log_level": "debug"')
])

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later