Code Merge
About
Enables code analysis and merging from multiple files in a project with efficient handling of file trees, content compression, and filtering through .gitignore rules for comprehensive codebase context.
Details
- Author
- yy1588133
- Repository
- yy1588133/code-merge-mcp
- GitHub stars
- 10
- License
- MIT License
- Categories
- Productivity, Developer Tools, Design, File Management, AI, Project Management, Infrastructure
- Tags
- #analytics
Jump to
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Code MergeCommand (node, npx, python, etc.)nodeArguments-
Argument 1
<项目完整路径>/src/main.js
Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
-
Argument 1
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
get_file_tree
生成项目文件结构的树状视图,支持多种过滤选项。参数: path (目标目录路径), use_gitignore (是否使用 .gitignore 规则,可选), ignore_git (是否忽略 .git 目录,可选), custom_blacklist (自定义黑名单项目,可选)
merge_content
将多个文件的内容合并为单一输出,适合准备用于大语言模型的代码分析。参数: path (目标文件或目录路径), compress (是否压缩输出,可选), use_gitignore (是否使用 .gitignore 规则,可选), ignore_git (是否忽略 .git 目录,可选), custom_blacklist (自定义黑名单项目,可选)
analyze_code
分析代码文件并提供统计信息,如行数和函数数量。参数: path (目标文件或目录路径), language (可选的语言过滤器), countLines (是否统计代码行数), countFunctions (是否统计函数数量)
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"code merge": {
"cwd": "string (optional)",
"env": {},
"args": [
"<\u9879\u76ee\u5b8c\u6574\u8def\u5f84>/src/main.js"
],
"shell": false,
"command": "node"
}
}
}
Linux
{
"cwd": "string (optional)",
"env": [],
"args": [
"<\u9879\u76ee\u5b8c\u6574\u8def\u5f84>/src/main.js"
],
"shell": false,
"command": "node"
}
Macos
{
"cwd": "string (optional)",
"env": [],
"args": [
"<\u9879\u76ee\u5b8c\u6574\u8def\u5f84>/src/main.js"
],
"shell": false,
"command": "node"
}
Windows
{
"cwd": "string (optional)",
"env": [],
"args": [
"<\u9879\u76ee\u5b8c\u6574\u8def\u5f84>/src/main.js"
],
"shell": false,
"command": "node"
}
Code Merge MCP 服务器
Code Merge MCP 是一个基于 Model Context Protocol (MCP) 的服务器实现,专为代码文件内容提取、合并和分析而设计。它提供了一套强大的工具,帮助大语言模型(如GPT、Claude)更有效地处理和分析代码库。
核心功能
- 文件树生成:生成项目文件结构的树状视图
- 代码合并:将多个文件的内容合并为单一输出
- 代码分析:提供代码统计信息,如行数和函数数量
- 智能过滤:支持 .gitignore 规则和自定义黑名单
技术架构
本项目基于 Model Context Protocol (MCP) SDK 构建,使用 Node.js 实现。主要组件包括:
- MCP 服务器:处理客户端请求并提供工具功能
- 工具模块:实现各种代码处理功能
- 核心库:提供文件系统操作和过滤功能
工具说明
1. get_file_tree
生成项目文件结构的树状视图,支持多种过滤选项。
参数:
- path:目标目录路径
- use_gitignore:是否使用 .gitignore 规则(可选)
- ignore_git:是否忽略 .git 目录(可选)
- custom_blacklist:自定义黑名单项目(可选)
示例输出:
project/
├── src/
│ ├── main.js
│ └── utils/
│ └── helper.js
├── tests/
│ └── test.js
└── README.md
2. merge_content
将多个文件的内容合并为单一输出,适合准备用于大语言模型的代码分析。
参数:
- path:目标文件或目录路径
- compress:是否压缩输出(可选)
- use_gitignore:是否使用 .gitignore 规则(可选)
- ignore_git:是否忽略 .git 目录(可选)
- custom_blacklist:自定义黑名单项目(可选)
输出:包含合并后的文件内容和统计信息
3. analyze_code
分析代码文件并提供统计信息,如行数和函数数量。
参数:
- path:目标文件或目录路径
- language:可选的语言过滤器
- countLines:是否统计代码行数
- countFunctions:是否统计函数数量
输出:包含代码分析结果的统计信息
安装与使用
环境要求
- Node.js (v16.x 或更高版本推荐)
- npm (通常随 Node.js 一起安装)
从 Git 仓库获取项目
```bash
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





