- Home
- MCP servers
- Directory Context
Directory Context
- javascript
4
GitHub Stars
javascript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"pwalagov-file-control-mcp": {
"command": "node",
"args": [
"path/to/server.js"
]
}
}
}You can run an MCP server that analyzes directories and edits files directly from your AI assistant. This server gives you full project structure insights, safe file operations, and Git context, letting you explore, modify, and manage codebases with confidence.
How to use
You interact with the server through your MCP client to perform directory analysis, file management, and project context tasks. Start by pointing the server to a working directory, then use the available tools to inspect structure, search content, edit files, and manage directories. You can run multiple operations in a batch for atomic changes, and you can enable automatic backups and transaction rollback for safety.
How to install
Prerequisites: ensure Node.js 18.0.0 or higher is installed on your system. You also need npm or yarn to manage dependencies.
- Install dependencies for the MCP server.
npm install
- Configure your MCP client to use this server. Use the following example to connect via a local stdio server.
{
"mcpServers": {
"directory-context": {
"command": "node",
"args": ["path/to/server.js"]
}
}
}
Configuration and safety notes
The server supports safe operations with automatic backups and optional transaction rollback for batch operations. It can expose important project files as MCP resources for easy access by AI assistants. Always validate paths to stay within your designated working directory and review destructive actions (such as delete and rename) before executing.
API and core tools overview
Below are the core capabilities you can invoke. Each tool is designed to be used from your MCP client to manage and inspect your project.
Available tools
set_working_directory
Set the current working directory for all operations. Validates the path and constrains actions within this root.
get_directory_structure
Return a tree view of the directory, with optional depth and file-type filtering.
get_file_contents
Read contents of specified files, enabling review without manual opening.
search_files
Search across files for a text query with optional regex support and file-type filters.
analyze_project_context
Analyze the project to detect type and summarize context, optionally focusing on specific files.
get_git_context
Provide repository information, including commits, branches, and working directory changes.
create_file
Create a new file with specified content and encoding, with optional overwrite control.
update_file
Perform search-and-replace edits, supporting regex and multi-match updates.
append_to_file
Append content to an existing file with optional newline handling.
delete_file
Remove a file, with optional backup creation for safety.
rename_file
Move or rename a file, with collision checks to prevent overwrites.
create_directory
Create directories, including recursive paths.
batch_file_operations
Execute multiple file operations in a single atomic transaction with optional rollback on error.