Go server implementing Model Context Protocol (MCP) for filesystem operations.
This MCP server provides secure access to the local filesystem via the Model Context Protocol (MCP).
read_file
path
(required): Path to the file to readread_multiple_files
paths
(required): List of file paths to readwrite_file
path
(required): Path where to write the file, content
(required): Content to write to the filecopy_file
source
(required): Source path of the file or directory, destination
(required): Destination pathmove_file
source
(required): Source path of the file or directory, destination
(required): Destination pathdelete_file
path
(required): Path to the file or directory to delete, recursive
(optional): Whether to recursively delete directories (default: false)list_directory
path
(required): Path of the directory to listcreate_directory
path
(required): Path of the directory to createtree
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)search_files
path
(required): Starting path for the search, pattern
(required): Search pattern to match against file namesget_file_info
path
(required): Path to the file or directorylist_allowed_directories
go install github.com/mark3labs/mcp-filesystem-server@latest
Start the MCP server with allowed directories:
mcp-filesystem-server /path/to/allowed/directory [/another/allowed/directory ...]
package main import ( "log" "os" "github.com/mark3labs/mcp-filesystem-server/filesystemserver" ) func main() { // Create a new filesystem server with allowed directories allowedDirs := []string{"/path/to/allowed/directory", "/another/allowed/directory"} fs, err := filesystemserver.NewFilesystemServer(allowedDirs) if err != nil { log.Fatalf("Failed to create server: %v", err) } // Serve requests if err := fs.Serve(); err != nil { log.Fatalf("Server error: %v", err) } }
To integrate this server with apps that support MCP:
{ "mcpServers": { "filesystem": { "command": "mcp-filesystem-server", "args": ["/path/to/allowed/directory", "/another/allowed/directory"] } } }
You can run the Filesystem MCP server using Docker:
docker run -i --rm ghcr.io/mark3labs/mcp-filesystem-server:latest /path/to/allowed/directory
To integrate the Docker image with apps that support MCP:
{ "mcpServers": { "filesystem": { "command": "docker", "args": [ "run", "-i", "--rm", "ghcr.io/mark3labs/mcp-filesystem-server:latest", "/path/to/allowed/directory" ] } } }
See the LICENSE file for details.
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!