Detects PHP Composer projects through composer.json files for project type identification and dependency analysis
Detects and analyzes Docker configurations including Dockerfile and docker-compose.yml files as part of project type detection
Automatically identifies and prioritizes .env environment files as important configuration files in project analysis
Provides Git repository integration including commit history, branch information, working directory status, and diff visualization for project analysis
Identifies Java/Android projects through build.gradle files for project type detection and build configuration analysis
Provides Node.js project detection and analysis through package.json files, enabling project type identification and dependency management understanding
Detects PHP projects through composer.json files and provides PHP-specific project analysis
Detects Python projects through requirements.txt files and provides Python-specific project analysis capabilities
Identifies Ruby projects through Gemfile detection and provides Ruby-specific project context
Identifies Rust projects through Cargo.toml files and provides Rust-specific project context analysis
Enhanced Directory Context MCP Server
TL;DR: A powerful MCP server that gives AI assistants full directory analysis and file editing capabilities.
What It Does
- 📁 Analyze directories - Get project structure, find files, search content
- ✏️ Edit files - Create, update, delete, rename files and folders
- 🔍 Smart search - Find code/text across multiple files with regex support
- 🔄 Git integration - View commits, branches, and changes
- 🛡️ Safe operations - Auto-backups and transaction rollback
Quick Setup
- Install dependencies:
npm install
- Add to your Claude Desktop config:
Main Tools
Tool | What It Does |
---|---|
set_working_directory | Set the folder to work in |
get_directory_structure | Show folder/file tree |
search_files | Find text in files |
create_file | Make new files |
update_file | Edit existing files |
delete_file | Remove files (with backup) |
batch_file_operations | Do multiple operations at once |
Enhanced Directory Context MCP Server
A comprehensive Model Context Protocol (MCP) server that provides advanced directory analysis and file management capabilities for AI assistants like Claude. This server combines directory context extraction with full file editing capabilities, making it a powerful tool for code analysis, project management, and file operations.
Features
🔍 Directory Analysis
- Complete Directory Structure: Get detailed tree views of any directory with metadata
- Intelligent Project Analysis: Automatic project type detection and context summary
- Smart File Search: Regex and text-based search across multiple file types
- Git Integration: Extract repository context, commit history, and working directory status
- File Statistics: Comprehensive analysis of file types, sizes, and modification dates
📝 File Operations
- Create Files: Generate new files with specified content
- Update Files: Sophisticated search-and-replace operations with regex support
- Append Content: Add content to existing files with formatting options
- Delete Files: Remove files with optional backup creation
- Rename/Move Files: Relocate and rename files with collision detection
- Directory Management: Create directory structures recursively
🔄 Advanced Features
- Batch Operations: Execute multiple file operations in a single transaction
- Automatic Backups: Optional backup creation for destructive operations
- Transaction Rollback: Rollback capability for failed batch operations
- Resource Exposure: Automatic exposure of important project files as MCP resources
- Error Handling: Comprehensive error handling with detailed feedback
Installation
Prerequisites
- Node.js 18.0.0 or higher
- npm or yarn package manager
Setup
- Clone or download the MCP server files
- Install dependencies:
- Configure your MCP client (Claude Desktop, etc.) to use this server:
Claude Desktop Configuration:
Add to your claude_desktop_config.json
:
Alternative Configuration:
Use the provided mcp-json-config.json
as a template and update the paths accordingly.
Usage
Setting Up Your Working Directory
Before using any features, set your working directory:
Directory Analysis Tools
Get Directory Structure
Analyze Project Context
Search Files
Git Context
File Management Tools
Create Files
Update Files
Append to Files
Delete Files
Rename/Move Files
Create Directories
Batch Operations
Execute multiple operations atomically:
Project Type Detection
The server automatically detects project types based on configuration files:
- Node.js/JavaScript:
package.json
- Python:
requirements.txt
- Rust:
Cargo.toml
- Go:
go.mod
- Java:
pom.xml
,build.gradle
- PHP:
composer.json
- Ruby:
Gemfile
- Docker:
Dockerfile
,docker-compose.yml
- And more...
File Priority Detection
The server identifies important files automatically:
- Configuration files (
package.json
,config.js
, etc.) - Entry points (
index.js
,main.py
,app.js
) - Documentation (
README.md
, docs) - Docker files
- Environment files (
.env
)
Resource Exposure
Important files are automatically exposed as MCP resources, making them easily accessible to AI assistants without explicit file reading requests.
Error Handling and Safety Features
- Backup Creation: Automatic backups for destructive operations
- Collision Detection: Prevents accidental overwrites
- Transaction Rollback: Batch operations can be fully rolled back on error
- Path Validation: Ensures operations stay within working directory bounds
- Detailed Error Messages: Comprehensive error reporting for debugging
API Reference
Core Tools
Tool | Description | Required Parameters |
---|---|---|
set_working_directory | Set the working directory | directory |
get_directory_structure | Get directory tree | None |
get_file_contents | Read multiple files | files |
search_files | Search within files | query |
analyze_project_context | Analyze project | None |
get_git_context | Git repository info | None |
File Operations
Tool | Description | Required Parameters |
---|---|---|
create_file | Create new file | path , content |
update_file | Update existing file | path , updates |
append_to_file | Append to file | path , content |
delete_file | Delete file | path |
rename_file | Rename/move file | old_path , new_path |
create_directory | Create directory | path |
batch_file_operations | Multiple operations | operations |
Configuration Options
Server Configuration
- Working Directory: Set via
set_working_directory
or during initialization - File Type Filters: Configurable file extension filtering
- Search Limits: Configurable maximum search results
- Backup Policies: Optional backup creation for destructive operations
MCP Client Configuration
Configure the server in your MCP client with appropriate command and arguments. The server communicates via stdio and requires no additional network configuration.
Development and Contribution
Project Structure
Dependencies
@modelcontextprotocol/sdk
: Core MCP functionality- Node.js built-in modules:
fs
,path
,child_process
Running in Development Mode
This starts the server with Node.js inspector enabled for debugging.
License
MIT License - See package.json for details.
Support and Issues
For issues, feature requests, or contributions, please refer to the repository's issue tracker.
Note: This MCP server provides powerful file system access. Ensure you trust the AI assistant and understand the operations being performed, especially destructive operations like file deletion or modification.
local-only server
The server can only run on the client's local machine because it depends on local resources.
Tools
Enables comprehensive directory analysis and file management operations including project structure exploration, intelligent file search, full CRUD operations on files and directories, batch operations with rollback capabilities, and Git integration.
Related MCP Servers
- AsecurityAlicenseAqualityProvides tools for collecting and documenting code from directories.Last updated -434214MIT License
- -securityAlicense-qualityEnables integration with Google Drive for listing, reading, and searching over files, supporting various file types with automatic export for Google Workspace files.Last updated -1,05146MIT License
- AsecurityFlicenseAqualityEnables comprehensive GitHub operations through natural language including file management, repository administration, issue tracking, and advanced code searching.Last updated -4741
- AsecurityAlicenseAqualityProvides tools for analyzing project structures, searching through codebases, managing dependencies, and performing file operations with advanced filtering capabilities.Last updated -61601MIT License