You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This MCP server provides secure access to the local filesystem via the Model Context Protocol (MCP).
4
4
5
-
Go server implementing Model Context Protocol (MCP) for filesystem operations.
5
+
## Components
6
6
7
-
## Features
8
-
9
-
- Read/write files
10
-
- Create/list/delete directories
11
-
- Move files/directories
12
-
- Search files
13
-
- Get file metadata
14
-
- Generate directory tree structures
15
-
16
-
**Note**: The server will only allow operations within directories specified via `args`.
17
-
18
-
## API
7
+
### Tools
19
8
20
-
###Resources
9
+
#### File Operations
21
10
22
-
-`file://system`: File system operations interface
11
+
-**read_file**
12
+
- Read the complete contents of a file from the file system
13
+
- Parameters: `path` (required): Path to the file to read
23
14
24
-
### Tools
15
+
-**write_file**
16
+
- Create a new file or overwrite an existing file with new content
17
+
- Parameters: `path` (required): Path where to write the file, `content` (required): Content to write to the file
25
18
26
-
-**read_file**
27
-
- Read complete contents of a file
28
-
- Input: `path` (string)
29
-
- Reads complete file contents with UTF-8 encoding
19
+
-**move_file**
20
+
- Move or rename files and directories
21
+
- Parameters: `source` (required): Source path of the file or directory, `destination` (required): Destination path
30
22
31
-
-**read_multiple_files**
32
-
- Read multiple files simultaneously
33
-
- Input: `paths` (string[])
34
-
- Failed reads won't stop the entire operation
23
+
#### Directory Operations
35
24
36
-
-**write_file**
37
-
- Create new file or overwrite existing (exercise caution with this)
38
-
- Inputs:
39
-
-`path` (string): File location
40
-
-`content` (string): File content
25
+
-**list_directory**
26
+
- Get a detailed listing of all files and directories in a specified path
27
+
- Parameters: `path` (required): Path of the directory to list
41
28
42
29
-**create_directory**
43
-
- Create new directory or ensure it exists
44
-
- Input: `path` (string)
45
-
- Creates parent directories if needed
46
-
- Succeeds silently if directory exists
30
+
- Create a new directory or ensure a directory exists
31
+
- Parameters: `path` (required): Path of the directory to create
47
32
48
-
-**list_directory**
49
-
-List directory contents with [FILE] or [DIR] prefixes
50
-
-Input: `path` (string)
33
+
-**tree**
34
+
-Returns a hierarchical JSON representation of a directory structure
35
+
-Parameters: `path` (required): Path of the directory to traverse, `depth` (optional): Maximum depth to traverse (default: 3), `follow_symlinks` (optional): Whether to follow symbolic links (default: false)
51
36
52
-
-**move_file**
53
-
- Move or rename files and directories
54
-
- Inputs:
55
-
-`source` (string)
56
-
-`destination` (string)
57
-
- Fails if destination exists
37
+
#### Search and Information
58
38
59
39
-**search_files**
60
-
- Recursively search for files/directories
61
-
- Inputs:
62
-
-`path` (string): Starting directory
63
-
-`pattern` (string): Search pattern
64
-
- Case-insensitive matching
65
-
- Returns full paths to matches
40
+
- Recursively search for files and directories matching a pattern
41
+
- Parameters: `path` (required): Starting path for the search, `pattern` (required): Search pattern to match against file names
66
42
67
43
-**get_file_info**
68
-
- Get detailed file/directory metadata
69
-
- Input: `path` (string)
70
-
- Returns:
71
-
- Size
72
-
- Creation time
73
-
- Modified time
74
-
- Access time
75
-
- Type (file/directory)
76
-
- Permissions
77
-
78
-
-**tree**
79
-
- Returns a hierarchical JSON representation of a directory structure
80
-
- Inputs:
81
-
-`path` (string): Directory to traverse (required)
82
-
-`depth` (number): Maximum depth to traverse (default: 3)
83
-
-`follow_symlinks` (boolean): Whether to follow symbolic links (default: false)
84
-
- Returns formatted JSON with file/directory hierarchy
85
-
- Includes file metadata (name, path, size, modified time)
44
+
- Retrieve detailed metadata about a file or directory
45
+
- Parameters: `path` (required): Path to the file or directory
86
46
87
47
-**list_allowed_directories**
88
-
- List all directories the server is allowed to access
89
-
- No input required
90
-
- Returns:
91
-
- Directories that this server can read/write from
48
+
- Returns the list of directories that this server is allowed to access
49
+
- Parameters: None
50
+
51
+
## Features
52
+
53
+
- Secure access to specified directories
54
+
- Path validation to prevent directory traversal attacks
55
+
- Symlink resolution with security checks
56
+
- MIME type detection
57
+
- Support for text, binary, and image files
58
+
- Size limits for inline content and base64 encoding
59
+
60
+
## Getting Started
61
+
62
+
### Installation
63
+
64
+
#### Using Go Install
65
+
66
+
```bash
67
+
go install github.com/mark3labs/mcp-filesystem-server@latest
68
+
```
69
+
70
+
### Usage
71
+
72
+
#### As a standalone server
73
+
74
+
Start the MCP server with allowed directories:
92
75
93
-
## Usage with Claude Desktop
94
-
Install the server
95
76
```bash
96
-
go install github.com/mark3labs/mcp-filesystem-server
You can run the Filesystem MCP server using Docker:
127
+
128
+
```bash
129
+
docker run -i --rm ghcr.io/mark3labs/mcp-filesystem-server:latest /path/to/allowed/directory
130
+
```
131
+
132
+
#### Docker Configuration with MCP
133
+
134
+
To integrate the Docker image with apps that support MCP:
135
+
136
+
```json
137
+
{
138
+
"mcpServers": {
139
+
"filesystem": {
140
+
"command": "docker",
105
141
"args": [
106
-
"/Users/username/Desktop",
107
-
"/path/to/other/allowed/dir"
142
+
"run",
143
+
"-i",
144
+
"--rm",
145
+
"ghcr.io/mark3labs/mcp-filesystem-server:latest",
146
+
"/path/to/allowed/directory"
108
147
]
109
148
}
110
149
}
@@ -113,4 +152,4 @@ Add this to your `claude_desktop_config.json`:
113
152
114
153
## License
115
154
116
-
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
0 commit comments