Skip to content

Commit b9a71e2

Browse files
committed
Initial commit
0 parents  commit b9a71e2

File tree

5 files changed

+898
-0
lines changed

5 files changed

+898
-0
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Anthropic, PBC
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Filesystem MCP Server
2+
3+
Go server implementing Model Context Protocol (MCP) for filesystem operations.
4+
5+
## Features
6+
7+
- Read/write files
8+
- Create/list/delete directories
9+
- Move files/directories
10+
- Search files
11+
- Get file metadata
12+
13+
**Note**: The server will only allow operations within directories specified via `args`.
14+
15+
## API
16+
17+
### Resources
18+
19+
- `file://system`: File system operations interface
20+
21+
### Tools
22+
23+
- **read_file**
24+
- Read complete contents of a file
25+
- Input: `path` (string)
26+
- Reads complete file contents with UTF-8 encoding
27+
28+
- **read_multiple_files**
29+
- Read multiple files simultaneously
30+
- Input: `paths` (string[])
31+
- Failed reads won't stop the entire operation
32+
33+
- **write_file**
34+
- Create new file or overwrite existing (exercise caution with this)
35+
- Inputs:
36+
- `path` (string): File location
37+
- `content` (string): File content
38+
39+
- **create_directory**
40+
- Create new directory or ensure it exists
41+
- Input: `path` (string)
42+
- Creates parent directories if needed
43+
- Succeeds silently if directory exists
44+
45+
- **list_directory**
46+
- List directory contents with [FILE] or [DIR] prefixes
47+
- Input: `path` (string)
48+
49+
- **move_file**
50+
- Move or rename files and directories
51+
- Inputs:
52+
- `source` (string)
53+
- `destination` (string)
54+
- Fails if destination exists
55+
56+
- **search_files**
57+
- Recursively search for files/directories
58+
- Inputs:
59+
- `path` (string): Starting directory
60+
- `pattern` (string): Search pattern
61+
- Case-insensitive matching
62+
- Returns full paths to matches
63+
64+
- **get_file_info**
65+
- Get detailed file/directory metadata
66+
- Input: `path` (string)
67+
- Returns:
68+
- Size
69+
- Creation time
70+
- Modified time
71+
- Access time
72+
- Type (file/directory)
73+
- Permissions
74+
75+
- **list_allowed_directories**
76+
- List all directories the server is allowed to access
77+
- No input required
78+
- Returns:
79+
- Directories that this server can read/write from
80+
81+
## Usage with Claude Desktop
82+
Install the server
83+
```bash
84+
go install github.com/mark3labs/mcp-filesystem-server
85+
```
86+
87+
Add this to your `claude_desktop_config.json`:
88+
```json
89+
{
90+
"mcpServers": {
91+
"filesystem": {
92+
"command": "mcp-filesystem-server",
93+
"args": [
94+
"/Users/username/Desktop",
95+
"/path/to/other/allowed/dir"
96+
]
97+
}
98+
}
99+
}
100+
```
101+
102+
## License
103+
104+
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.

go.mod

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module github.com/mark3labs/mcp-filesystem-server
2+
3+
go 1.23.2
4+
5+
require github.com/mark3labs/mcp-go v0.2.0
6+
7+
require (
8+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
9+
github.com/charmbracelet/lipgloss v0.10.0 // indirect
10+
github.com/charmbracelet/log v0.4.0 // indirect
11+
github.com/go-logfmt/logfmt v0.6.0 // indirect
12+
github.com/google/uuid v1.6.0 // indirect
13+
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
14+
github.com/mattn/go-isatty v0.0.18 // indirect
15+
github.com/mattn/go-runewidth v0.0.15 // indirect
16+
github.com/muesli/reflow v0.3.0 // indirect
17+
github.com/muesli/termenv v0.15.2 // indirect
18+
github.com/rivo/uniseg v0.4.7 // indirect
19+
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
20+
golang.org/x/sys v0.13.0 // indirect
21+
)

go.sum

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
2+
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
3+
github.com/charmbracelet/lipgloss v0.10.0 h1:KWeXFSexGcfahHX+54URiZGkBFazf70JNMtwg/AFW3s=
4+
github.com/charmbracelet/lipgloss v0.10.0/go.mod h1:Wig9DSfvANsxqkRsqj6x87irdy123SR4dOXlKa91ciE=
5+
github.com/charmbracelet/log v0.4.0 h1:G9bQAcx8rWA2T3pWvx7YtPTPwgqpk7D68BX21IRW8ZM=
6+
github.com/charmbracelet/log v0.4.0/go.mod h1:63bXt/djrizTec0l11H20t8FDSvA4CRZJ1KH22MdptM=
7+
github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
8+
github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
9+
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
10+
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
11+
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
12+
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
13+
github.com/mark3labs/mcp-go v0.1.6 h1:kQysCoJ+YEJT1LlTPslpjlKexsBeRXcTfpXaOxdguHw=
14+
github.com/mark3labs/mcp-go v0.1.6/go.mod h1:xWMnxgMARGtpclNygj0Tmp9fWST8JnN/ifZdhDiU9Ic=
15+
github.com/mark3labs/mcp-go v0.2.0 h1:ac0EfxqAnMpgQfsFOPsfGbjIP4r/iUZIaSDu5aMxnVU=
16+
github.com/mark3labs/mcp-go v0.2.0/go.mod h1:ePkDSyplFbA306xRgyp587+q/vpdgxuswwjZqTQ+I8Q=
17+
github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
18+
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
19+
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
20+
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
21+
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
22+
github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
23+
github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
24+
github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo=
25+
github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8=
26+
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
27+
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
28+
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
29+
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
30+
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
31+
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
32+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
33+
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
34+
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

0 commit comments

Comments
 (0)