A Model Context Protocol (MCP) server designed to easily dump your codebase context into Large Language Models (LLMs).
A Model Context Protocol (MCP) server designed to easily dump your codebase context into Large Language Models (LLMs).
Large context windows in LLMs are powerful, but manually selecting and formatting files from a large codebase is tedious. This tool automates the process by:
.gitignore
rules.The easiest way to use this tool is via npx
, which runs the latest version without needing a local installation.
Configure your MCP client (e.g., Claude Desktop, VS Code extensions) to use the following command:
{ "mcpServers": { "codebase-context-dumper": { "command": "npx", "args": [ "-y", "@lex-tools/codebase-context-dumper" ] } } }
The MCP client will then be able to invoke the dump_codebase_context
tool provided by this server.
dump_codebase_context
Recursively reads text files from a specified directory, respecting .gitignore
rules and skipping binary files. Concatenates content with file path headers/footers. Supports chunking the output for large codebases.
Functionality:
base_path
..gitignore
files at all levels (including nested ones and .git
by default).--- START: relative/path/to/file ---
) and appends a footer (--- END: relative/path/to/file ---
) to each file's content.Input Parameters:
base_path
(string, required): The absolute path to the project directory to scan.num_chunks
(integer, optional, default: 1): The total number of chunks to divide the output into. Must be >= 1.chunk_index
(integer, optional, default: 1): The 1-based index of the chunk to return. Requires num_chunks > 1
and chunk_index <= num_chunks
.Output: Returns the concatenated (and potentially chunked) text content.
If you prefer to run a local version (e.g., for development):
git clone git@github.com:lex-tools/codebase-context-dumper.git cd codebase-context-dumper
npm install
npm run build
{ "mcpServers": { "codebase-context-dumper": { "command": "/path/to/your/local/codebase-context-dumper/build/index.js" // Adjust path } } }
Contributions are welcome! Please see CONTRIBUTING.md for details on development, debugging, and releasing new versions.
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!