Skip to main content
Glama

@lex-tools/codebase-context-dumper

Official
by lex-tools

代码库上下文转储器 MCP 服务器

模型上下文协议 (MCP) 服务器旨在轻松地将您的代码库上下文转储到大型语言模型 (LLM) 中。

为什么要使用这个?

LLM 中的大型上下文窗口功能强大,但从大型代码库中手动选择和格式化文件非常繁琐。此工具通过以下方式自动化此过程:

  • 递归扫描您的项目目录。
  • 包括指定目录树中未被.gitignore规则排除的文本文件。
  • 自动跳过二进制文件。
  • 将内容与清晰的文件路径标记连接起来。
  • 支持分块来处理大于 LLM 上下文窗口的代码库。
  • 与 MCP 兼容客户端无缝集成。

用法(推荐:npx)

使用此工具的最简单方法是通过npx ,它可以运行最新版本而无需本地安装。

配置您的 MCP 客户端(例如,Claude Desktop、VS Code 扩展)以使用以下命令:

{ "mcpServers": { "codebase-context-dumper": { "command": "npx", "args": [ "-y", "@lex-tools/codebase-context-dumper" ] } } }

然后,MCP 客户端将能够调用该服务器提供的dump_codebase_context工具。

功能和工具详细信息

工具: dump_codebase_context

以递归方式从指定目录读取文本文件,遵循.gitignore规则并跳过二进制文件。将内容与文件路径的页眉/页脚连接起来。支持对大型代码库的输出进行分块。

功能

  • 扫描base_path中提供的目录。
  • 尊重所有级别的.gitignore文件(包括嵌套文件和默认的.git )。
  • 检测并跳过二进制文件。
  • 读取每个有效文本文件的内容。
  • 在每个文件的内容前添加一个标题( --- START: relative/path/to/file --- )并添加一个页脚( --- END: relative/path/to/file --- )。
  • 将所有处理过的文件内容连接成一个字符串。

输入参数

  • base_path (字符串,必需):要扫描的项目目录的绝对路径。
  • num_chunks (整数,可选,默认值:1):将输出划分成的块的总数。必须 >= 1。
  • chunk_index (整数,可选,默认值:1):要返回的块的从 1 开始的索引。要求num_chunks > 1chunk_index <= num_chunks

输出:返回连接后的(可能分块的)文本内容。

本地安装和使用(高级)

如果您希望运行本地版本(例如,用于开发):

  1. 克隆存储库:
    git clone git@github.com:lex-tools/codebase-context-dumper.git cd codebase-context-dumper
  2. 安装依赖项:
    npm install
  3. 构建服务器:
    npm run build
  4. 配置您的 MCP 客户端以指向本地构建输出:
    { "mcpServers": { "codebase-context-dumper": { "command": "/path/to/your/local/codebase-context-dumper/build/index.js" // Adjust path } } }

贡献

欢迎贡献!有关开发、调试和发布新版本的详细信息,请参阅CONTRIBUTING.md

执照

本项目遵循 Apache License 2.0 许可协议。详情请参阅LICENSE文件。

-
security - not tested
A
license - permissive license
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

模型上下文协议 (MCP) 服务器旨在轻松地将您的代码库上下文转储到大型语言模型 (LLM) 中。

  1. 为什么要使用这个?
    1. 用法(推荐:npx)
      1. 功能和工具详细信息
        1. 工具: dump_codebase_context
      2. 本地安装和使用(高级)
        1. 贡献
          1. 执照

            Related MCP Servers

            • -
              security
              A
              license
              -
              quality
              A Model Context Protocol server that extracts and analyzes Python code structures, focusing on import/export relationships between files to help LLMs understand code context.
              Last updated -
              4
              Python
              MIT License
            • A
              security
              A
              license
              A
              quality
              A Model Context Protocol (MCP) server that provides code analysis capabilities using tree-sitter, designed to give Claude intelligent access to codebases with appropriate context management.
              Last updated -
              26
              33
              Python
              MIT License
              • Apple
              • Linux
            • -
              security
              A
              license
              -
              quality
              A Model Context Protocol server that exposes over 200+ APIs from API.market as MCP resources, allowing large language models to discover and interact with various APIs through natural language commands.
              Last updated -
              111
              2
              TypeScript
              MIT License
              • Apple
            • -
              security
              A
              license
              -
              quality
              A Model Context Protocol server that enables Large Language Models to interact with Binary Ninja for reverse engineering tasks like viewing assembly code, decompiled code, renaming functions, and adding comments.
              Last updated -
              2
              Python
              MIT License
              • Linux
              • Apple

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/lex-tools/codebase-context-dumper'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server