Safe File MCP is an MCP server that aggregates and loads an entire codebase directly into an LLM context window for streamlined development and editing. It connects AI assistants to local project directories, enabling models to inspect full code context before making changes. Software engineers, full-stack developers, and AI assisted programmers use Safe File MCP with clients like Claude Desktop and Claude Code to overcome fragmented context when writing code that matches existing architectural patterns. The server exposes tools to check codebase size, retrieve token counts, minify or ignore non-essential files, and read or search project directories. In addition to analysis, it provides file manipulation capabilities, including directory creation, moving files, complete file writing, and line-based partial edits via a dedicated edit mode. By executing commands and surfacing repository structure without requiring manual file uploads, Safe File MCP equips language models with the operational background needed to understand multi-file interactions, debug complex issues, and perform targeted project refactoring without losing structural context.
Category: Other & General Purpose
Tags: demonstration, examples, protocol, testing
npx context-coder or pass npx context-coder --edit-file-mode to allow partial line edits. 2. Alternatively, run the server using Docker by specifying image: ghcr.io/khromov/context-coder:full with port mapping 3001:3001 in your docker-compose.yml file. 3. For Claude Desktop, configure the client via supergateway: json { "mcpServers": { "context-coder": { "command": "npx", "args": ["-y", "supergateway", "--streamableHttp", "http://localhost:3001/mcp"] } } } 4. For Claude Code, add the server to .mcp.json in your root: json { "mcpServers": { "context-coder": { "command": "npx", "args": ["-y", "context-coder", "--mini", "--stdio"] } } } 5. Restart the client and begin sessions by invoking get_codebase_size and get_codebase.get_codebase_size and retrieving formatted project summaries with get_codebase. * Identifying large files with get_codebase_top_largest_files to configure exclusion patterns in .cocoignore or placeholder substitution in .cocominify. * Rewriting complete multi-file modules using write_file to keep implementations aligned with existing code conventions and dependencies. * Performing targeted, line-based partial edits using the edit_file tool when running the server with --edit-file-mode enabled. * Managing workspace files by creating directories, moving files, inspecting directory trees, and executing terminal shell commands within the project environment.Part of MCP Servers
You can run Safe File MCP directly using npx context-coder in your terminal or by pulling the official Docker images such as ghcr.io/khromov/context-coder:full. For Claude Code, you can register the package inside your project configuration file using npx with the mini and stdio flags.
Safe File MCP provides tools to evaluate and manipulate your project files. These include get_codebase_size, get_codebase, get_codebase_top_largest_files, read_file, write_file, edit_file for line-based edits, create_directory, list_directory, directory_tree, move_file, search_files, and execute_command for shell execution.
Safe File MCP is designed to integrate with Claude Desktop and Claude Code. Claude Desktop connects either through a local HTTP stream managed by supergateway on port 3001 or through Docker containers. Claude Code integrates directly using standard input and output with npx or Docker.
You can exclude unwanted files and directories by creating a .cocoignore file in your repository root, matching standard gitignore syntax. To keep files visible without loading full contents, create a .cocominify file, which substitutes file bodies with placeholders to conserve context tokens.
By default, the server expects complete file overwrites using the write_file tool to ensure file consistency. When you pass the --edit-file-mode flag or set the CONTEXT_CODER_EDIT_MODE environment variable, the server exposes the edit_file tool, allowing the model to perform line-based partial changes.