Filesystem MCP Server
local-only server
The server can only run on the client’s local machine because it depends on local resources.
Filesystem MCP Server
A Model Context Protocol (MCP) server implementation providing file system operations, analysis, and manipulation capabilities through a standardized tool interface.
Architecture
The server is built on the MCP SDK and organized into distinct layers:
Components
- Server Layer: Handles MCP protocol communication and tool dispatch
- Tool Registry: Manages tool registration and execution
- Operations Layer: Implements core functionality
- File System Interface: Provides safe file system access
Installation
- Clone the repository:
- Install dependencies:
- Build the server:
- Configure MCP settings (cline_mcp_settings.json):
Tool Reference
Directory Operations
list_directory
Lists directory contents with metadata.
create_directory
Creates a new directory.
File Operations
read_file
Reads file content with encoding support.
write_file
Writes content to a file.
append_file
Appends content to a file.
Analysis Operations
analyze_text
Analyzes text file properties.
calculate_hash
Calculates file hash using specified algorithm.
find_duplicates
Identifies duplicate files in a directory.
Compression Operations
create_zip
Creates a ZIP archive.
extract_zip
Extracts a ZIP archive.
Error Handling
The server uses standard MCP error codes:
Error responses include:
- Error code
- Human-readable message
- Additional context when available
Example error:
Development
Project Structure
Running Tests
Run the test suite:
Run with coverage:
Development Mode
Run in watch mode:
Code Quality
Lint the codebase:
Type check:
Dependencies
Core dependencies:
- @modelcontextprotocol/sdk: MCP server implementation
- file-type: File type detection
- mime-types: MIME type lookup
- crypto-js: File hashing
- archiver: ZIP creation
- extract-zip: ZIP extraction
- iconv-lite: Text encoding
- chardet: Encoding detection
Development dependencies:
- typescript: Type system
- jest: Testing
- eslint: Linting
- prettier: Formatting
- ts-node: TypeScript execution
- nodemon: Development server
Contributing
- Fork the repository
- Create your feature branch
- Write tests for new features
- Ensure all tests pass
- Submit a pull request
License
MIT
This server cannot be installed
A Model Context Protocol server that provides file system operations, analysis, and manipulation capabilities through a standardized tool interface.