A Model Context Protocol server that provides file system operations, analysis, and manipulation capabilities through a standardized tool interface.
A Model Context Protocol (MCP) server implementation providing file system operations, analysis, and manipulation capabilities through a standardized tool interface.
The server is built on the MCP SDK and organized into distinct layers:
graph TD A[MCP Server Layer] --> B[Tool Registry] B --> C[Operations Layer] C --> D[File System Operations] C --> E[Analysis Operations] C --> F[Stream Operations]
git clone cd filesystem-server
npm install
npm run build
{ "mcpServers": { "filesystem": { "command": "node", "args": ["path/to/filesystem-server/build/index.js"] } } }
Lists directory contents with metadata.
interface ListDirectoryParams { path: string; // Directory path recursive?: boolean; // List recursively (default: false) } interface ListDirectoryResult { entries: { name: string; path: string; isDirectory: boolean; size: number; created: string; modified: string; accessed: string; mode: string; }[]; }
Creates a new directory.
interface CreateDirectoryParams { path: string; // Directory path recursive?: boolean; // Create parent directories (default: true) }
Reads file content with encoding support.
interface ReadFileParams { path: string; // File path encoding?: string; // File encoding (default: 'utf8') }
Writes content to a file.
interface WriteFileParams { path: string; // File path content: string; // Content to write encoding?: string; // File encoding (default: 'utf8') }
Appends content to a file.
interface AppendFileParams { path: string; // File path content: string; // Content to append encoding?: string; // File encoding (default: 'utf8') }
Analyzes text file properties.
interface AnalyzeTextParams { path: string; // File path } interface AnalyzeTextResult { lineCount: number; wordCount: number; charCount: number; encoding: string; mimeType: string; }
Calculates file hash using specified algorithm.
interface CalculateHashParams { path: string; // File path algorithm?: 'md5' | 'sha1' | 'sha256' | 'sha512'; // Hash algorithm } interface CalculateHashResult { hash: string; algorithm: string; }
Identifies duplicate files in a directory.
interface FindDuplicatesParams { path: string; // Directory path } interface FindDuplicatesResult { duplicates: { hash: string; size: number; files: string[]; }[]; }
Creates a ZIP archive.
interface CreateZipParams { files: string[]; // Files to include output: string; // Output ZIP path }
Extracts a ZIP archive.
interface ExtractZipParams { path: string; // ZIP file path output: string; // Output directory }
The server uses standard MCP error codes:
enum ErrorCode { ParseError = -32700, InvalidRequest = -32600, MethodNotFound = -32601, InvalidParams = -32602, InternalError = -32603 }
Error responses include:
Example error:
{ "code": -32602, "message": "File not found: /path/to/file.txt" }
src/
├── operations/ # Core operations implementation
├── tools/ # MCP tool definitions and handlers
├── __tests__/ # Test suites
├── index.ts # Entry point
├── server.ts # MCP server setup
├── types.ts # Type definitions
└── utils.ts # Utility functions
Run the test suite:
npm test
Run with coverage:
npm run test:coverage
Run in watch mode:
npm run watch
Lint the codebase:
npm run lint
Type check:
npm run type-check
Core dependencies:
Development dependencies:
MIT
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!