This example demonstrates a simple read-only file system. It allows you to list the contents of a directory and read the contents of a file.
similar to the Typescript Example example, but with a read-only file system.
-
read_file
- Read complete contents of a file
- Input:
path
(string) - Reads complete file contents with UTF-8 encoding
-
list_directory
- List directory contents with [FILE] or [DIR] prefixes
- Input:
path
(string)
-
search_files
- Recursively search for files/directories
- Inputs:
path
(string): Starting directorypattern
(string): Search pattern
- Case-insensitive matching
- Returns full paths to matches
-
get_file_info
- Get detailed file/directory metadata
- Input:
path
(string) - Returns: metadata of the file or directory
- macOS (will handle Windows in the future)
- The latest version of Claude Desktop installed
- Install Rust
cd async-mcp/examples/file_system
cargo install --path .
This will build the binary and install it to your local cargo bin directory. Later you will need to configure Claude Desktop to use this binary.
If you are using macOS, open the claude_desktop_config.json
file in a text editor:
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
Modify the claude_desktop_config.json
file to include the following configuration:
(replace YOUR_USERNAME with your actual username):
{
"mcpServers": {
"mcp_example_file_system": {
"command": "/Users/YOUR_USERNAME/.cargo/bin/file_system"
}
}
}
Save the file, and restart Claude Desktop.

cat << 'EOF' | cargo run --bin file_system
{"jsonrpc": "2.0", "method": "tools/call", "params": {"name": "list_directory", "arguments": {"path": "."}}, "id": 1}
EOF