This MCP server provides filesystem operations for Claude AI, allowing it to read, write, create directories, search files and more within specified directories on your system.
To install the Filesystem MCP Server, follow these steps:
npm install
npm run build
The server requires one or more allowed directories to be specified as command-line arguments:
node build/index.js /path/to/allowed/dir1 /path/to/allowed/dir2
Note: For security reasons, the server will only allow operations within the directories you specify when starting it.
To use the filesystem server with Claude, add it to your MCP configuration file:
{
"mcpServers": {
"filesystem-server": {
"command": "node",
"args": [
"/path/to/filesystem-server/build/index.js",
"/path/to/allowed/dir1",
"/path/to/allowed/dir2"
],
"disabled": false,
"autoApprove": []
}
}
}
Read the complete contents of a file:
read_file
Input: path (string)
Read multiple files simultaneously:
read_multiple_files
Input: paths (string[])
When reading multiple files, failed reads won't stop the entire operation.
Create a new file or overwrite an existing one:
write_file
Inputs:
- path (string): File location
- content (string): File content
Create a new directory or ensure it exists:
create_directory
Input: path (string)
This operation creates parent directories if needed and succeeds silently if the directory already exists.
List all items in a directory with [FILE] or [DIR] prefixes:
list_directory
Input: path (string)
Move or rename files and directories:
move_file
Inputs:
- source (string)
- destination (string)
This operation fails if the destination already exists.
Recursively search for files or directories:
search_files
Inputs:
- path (string): Starting directory
- pattern (string): Search pattern
This performs case-insensitive matching and returns full paths to matches.
Get detailed metadata about a file or directory:
get_file_info
Input: path (string)
Returns size, creation time, modified time, access time, type (file/directory), and permissions.
List all directories the server is allowed to access:
list_allowed_directories
No input required
Returns a list of directories that this server can read from and write to.
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.
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"
]
}
}
}
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.
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.