MCP File Browser Server

MCP File Browser Server

Enables Large Language Models to safely browse and interact with local file systems through secure directory listing, file reading, and content search capabilities. Built with comprehensive security controls and high-performance handling of large directories and files.

Category
Visit Server

README

MCP File Browser Server

A secure, high-performance Model Context Protocol (MCP) server that enables Large Language Models to safely browse and interact with local file systems. Built with security-first architecture and comprehensive access controls.

MCP Protocol Security Status

🚀 Features

Core Capabilities

  • 📁 Directory Browsing: List directories with comprehensive metadata (size, permissions, modification date, type)
  • 📄 File Reading: Stream large files with encoding detection and size validation
  • 🔍 File Search: Search by name, extension, and content patterns
  • 🔗 Symbolic Link Support: Intelligent handling of symbolic links with clear metadata marking
  • ⚡ High Performance: Handles directories with 10,000+ files in under 2 seconds

Security & Access Control

  • 🛡️ Path Validation: Prevents directory traversal attacks with canonical path resolution
  • 🔐 Permission-Based Access: Granular permission levels (read-only, read-write, admin)
  • 📋 Allowlist/Denylist: Configurable directory access controls
  • 📊 Audit Logging: Comprehensive logging of all file access attempts
  • 🚫 System Protection: Never exposes sensitive directories (/etc, /root, /home) by default

Performance & Reliability

  • 💾 Intelligent Caching: Configurable caching for frequently accessed directories and metadata
  • 🌊 Streaming Support: Memory-efficient handling of large files
  • ⚙️ Resource Management: Configurable limits for memory usage, file size, and directory depth
  • 📈 Monitoring: Health checks and performance metrics
  • 🔄 Concurrent Operations: Support for multiple simultaneous LLM clients

📋 Requirements

System Requirements

  • Operating System: Linux, macOS, or Windows
  • Memory: Minimum 100MB RAM (configurable)
  • Storage: Minimal disk space for server and cache
  • Permissions: Standard file system access permissions

Dependencies

  • MCP Protocol compliance
  • File system access capabilities
  • Logging and monitoring support

🛠️ Installation

Prerequisites

# Ensure you have the necessary development tools
# (Installation instructions will be added as development progresses)

Quick Start

# Clone the repository
git clone https://github.com/ntufar/mcp.git
cd mcp

# Install dependencies
# (Installation commands will be added)

# Configure the server
# (Configuration instructions will be added)

# Start the server
# (Start commands will be added)

⚙️ Configuration

Basic Configuration

{
  "server": {
    "name": "mcp-file-browser",
    "version": "1.0.0"
  },
  "security": {
    "allowedPaths": ["/home/user/documents", "/home/user/projects"],
    "deniedPaths": ["/etc", "/root", "/sys"],
    "maxFileSize": "100MB",
    "maxDirectoryDepth": 10
  },
  "performance": {
    "cacheSize": "50MB",
    "cacheTTL": 300,
    "maxConcurrentOperations": 50
  }
}

Security Settings

  • allowedPaths: Directories the server can access
  • deniedPaths: Directories explicitly blocked
  • maxFileSize: Maximum file size for operations
  • maxDirectoryDepth: Maximum directory traversal depth

🔧 Usage

MCP Protocol Integration

The server exposes the following MCP tools and resources:

Tools

  • list_directory - List directory contents with metadata
  • read_file - Read file contents with streaming support
  • search_files - Search files by name, extension, or content
  • get_file_metadata - Retrieve detailed file information
  • check_permissions - Verify file/directory access permissions

Resources

  • Directory listings with structured metadata
  • File contents with encoding detection
  • Search results with relevance scoring
  • System health and performance metrics

Example Usage

// List directory contents
const directoryListing = await mcpClient.callTool('list_directory', {
  path: '/home/user/projects',
  includeHidden: false,
  maxDepth: 2
});

// Read file with streaming
const fileContent = await mcpClient.callTool('read_file', {
  path: '/home/user/documents/example.txt',
  encoding: 'utf-8',
  maxSize: '10MB'
});

// Search files
const searchResults = await mcpClient.callTool('search_files', {
  query: 'configuration',
  searchPath: '/home/user',
  fileTypes: ['.json', '.yaml', '.conf']
});

🏗️ Architecture

Core Components

  • Security Layer: Path validation, permission checking, audit logging
  • File System Interface: Abstraction layer for file operations
  • Caching Engine: Intelligent metadata and content caching
  • MCP Protocol Handler: Standard MCP tools and resources
  • Monitoring System: Health checks and performance metrics

Data Flow

LLM Client → MCP Protocol → Security Validation → File System → Cache → Response

🧪 Testing

Comprehensive Testing Strategy

  • Test-Driven Development (TDD): Tests written before implementation for all file system operations
  • 90%+ Code Coverage: Mandatory coverage for file system operation modules
  • Mock File Systems: Deterministic unit tests using mock file systems
  • Real LLM Integration: Testing with actual LLM clients (Claude, GPT-4, Gemini, Qwen, OpenCode)

Test Coverage

  • Unit Tests: Individual component testing with mock file systems
  • Integration Tests: End-to-end MCP protocol testing
  • Security Tests: Path traversal, permission boundary testing, attack prevention
  • Performance Tests: Large directory and file handling with specific benchmarks
  • Concurrent Tests: Multi-client operation testing
  • Contract Tests: API contract validation with OpenAPI specification
  • LLM Integration Tests: Real LLM client workflow validation

LLM Client Testing

  • Universal Compatibility: Testing across all major LLM platforms
  • Workflow Validation: Multi-step file analysis tasks with LLMs
  • Error Handling: LLM error recovery and user experience validation
  • Performance Under Load: Multiple LLM clients with concurrent operations
  • User Experience: Response quality and task completion efficiency

Running Tests

# Run all tests
npm test

# Run specific test suites
npm run test:unit
npm run test:integration
npm run test:security
npm run test:performance
npm run test:contract
npm run test:llm

# Run LLM integration tests
npm run test:llm:claude
npm run test:llm:gpt4
npm run test:llm:gemini
npm run test:llm:qwen

📊 Performance Benchmarks

Directory Operations

  • Small directories (< 100 files): < 100ms
  • Medium directories (100-1,000 files): < 500ms
  • Large directories (1,000-10,000 files): < 2 seconds
  • Massive directories (> 10,000 files): < 5 seconds

File Operations

  • File metadata retrieval: < 50ms
  • Small file reading (< 1MB): < 100ms
  • Large file streaming (> 100MB): Streaming with < 10MB memory usage

Resource Usage

  • Memory footprint: < 100MB for normal operations
  • Concurrent clients: 50+ simultaneous operations
  • Cache efficiency: 90%+ hit rate for frequently accessed data

🔒 Security Considerations

Built-in Security Features

  • Path Traversal Protection: Canonical path resolution prevents ../ attacks
  • Permission Respect: Never bypasses operating system security
  • Audit Trail: Comprehensive logging of all operations
  • Resource Limits: Prevents resource exhaustion attacks
  • Input Validation: Strict validation of all user inputs

Security Best Practices

  1. Configure allowlists for production deployments
  2. Monitor audit logs for suspicious access patterns
  3. Regular security updates and vulnerability scanning
  4. Principle of least privilege for file system access
  5. Encryption at rest for sensitive configuration data

🤝 Contributing

Development Guidelines

We follow strict development principles outlined in our Constitution:

  • Security-First Architecture: All changes must enhance security
  • Test-Driven Development: TDD mandatory for all file operations
  • Performance Standards: Maintain established benchmarks
  • MCP Protocol Compliance: Full adherence to MCP standards

Getting Started

  1. Read the Constitution
  2. Review the Specification (64 requirements)
  3. Study the Implementation Tasks (T001-T064)
  4. Follow the Implementation Plan with TDD approach
  5. Set up development environment
  6. Execute tasks in order: Setup → Tests → Implementation → Integration → Polish
  7. Run comprehensive tests to ensure everything works
  8. Submit a pull request with security review

Task Execution Strategy

  • Testing-First: Complete Phase 3.2 (16 test tasks) before any implementation
  • Parallel Execution: 30+ tasks can run simultaneously (marked with [P])
  • Constitutional Compliance: Follow security-first, TDD, and performance principles
  • LLM Integration: Include real LLM client testing throughout development

Code Quality Requirements

  • 90%+ test coverage for file system operations (constitutional requirement)
  • Test-Driven Development (TDD) mandatory for all file operations
  • LLM integration testing with real LLM clients
  • Security-focused code reviews for all file access code
  • Performance benchmarks maintained with each release
  • Comprehensive documentation for all public APIs

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🆘 Support

Documentation

Getting Help

  • Issues: Report bugs and feature requests on GitHub
  • Discussions: Ask questions in GitHub Discussions
  • Security: Report security issues privately via email

🗺️ Roadmap

Phase 1: Foundation & Planning ✅

  • [x] Project constitution and governance principles
  • [x] Comprehensive specification (64 requirements)
  • [x] Architecture design and data modeling
  • [x] API contracts and testing strategy
  • [x] LLM integration testing planning

Phase 2: Core Implementation 🚧

  • [ ] 64 Implementation Tasks Generated (T001-T064)
  • [ ] Testing infrastructure setup (TDD approach)
  • [ ] Security layer implementation
  • [ ] File system interface development
  • [ ] MCP protocol integration
  • [ ] Performance optimization

Phase 3: Advanced Features 📋

  • [ ] LLM client integration testing
  • [ ] Advanced search capabilities
  • [ ] Enhanced caching system
  • [ ] Comprehensive test suite execution

Phase 4: Enterprise Features 📋

  • [ ] Multi-user support
  • [ ] Advanced monitoring and analytics
  • [ ] Enterprise security features
  • [ ] Production deployment

📈 Status

Current Status: Tasks Generated - Ready for Implementation

  • Specification: ✅ Complete (v1.0.0) - 64 requirements (16 functional + 48 testing)
  • Architecture: ✅ Complete - Comprehensive data model and API contracts
  • Testing Strategy: ✅ Complete - TDD approach with LLM integration testing
  • Implementation Plan: ✅ Complete - 40-45 tasks with testing-first approach
  • Implementation Tasks: ✅ Complete - 64 detailed tasks (T001-T064) generated
  • Core Implementation: 🚀 Ready to Begin
  • Documentation: 🚧 In Progress

Built with ❤️ by Nicolai Tufar for the MCP ecosystem

Empowering LLMs with secure, efficient file system access while maintaining the highest standards of security and performance.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured