Code Merge MCP 服务器 logo

Code Merge MCP 服务器

Community
yy1588133

Code Merge MCP 是一个基于 Model Context Protocol (MCP) 的服务器实现,专为代码文件内容提取、合并和分析而设计。它提供了一套强大的工具,帮助大语言模型(如GPT、Claude)更有效地处理和分析代码库。

Publisheryy1588133
Repositorycode-merge-mcp
LanguageJavaScript
Forks
5
Stars
21
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    Code Merge MCP 服务器 exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    21 stars and 5 forks from the linked repository.

MseeP.ai Security Assessment Badge

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
# 克隆仓库
git clone https://github.com/yourusername/code-merge-mcp.git
cd code-merge-mcp

# 安装依赖
npm install

VS Code 配置

在 VS Code 的 mcp_settings.json 中添加:

json
{
  "mcpServers": {
    "code-merge": {
      "command": "node",
      "args": [
        "<项目完整路径>/src/main.js"
      ],
    }
  }
}

将 <项目完整路径> 替换为实际路径,例如 C:\Users\username\code-merge-mcp。

项目结构

code-merge-mcp/
├── bin/                # 可执行文件目录
│   ├── cli.js           # 命令行入口点
│   └── mcp-server.js    # MCP服务器入口点
├── src/
│   ├── core/           # 核心功能模块
│   │   ├── compressor.js   # 内容压缩
│   │   ├── file-lister.js  # 文件列表生成
│   │   ├── file-reader.js  # 文件读取
│   │   └── filter.js       # 文件过滤
│   ├── tools/          # 工具实现
│   │   ├── analyze_code.js  # 代码分析工具
│   │   ├── get_file_tree.js # 文件树生成工具
│   │   └── merge_content.js # 内容合并工具
│   ├── main.js         # 主入口点
│   └── mcp-server.js   # MCP 服务器实现
├── package.json        # 项目配置
└── README.md           # 项目文档

贡献指南

欢迎提交 Issue 和 Pull Request 来改进这个工具。在提交代码前,请确保:

  1. 代码符合项目的编码规范
  2. 添加适当的测试用例
  3. 更新相关文档

许可证

MIT License

致谢

本项目基于 TownBoats/codeMerge 开发,感谢原作者的贡献。

Installation

TypingMind
{
  "mcpServers": {
    "code-merge-mcp": {
      "command": "node",
      "args": [
        "<project_full_path>/src/main.js"
      ]
    }
  }
}

Use Code Merge MCP 服务器 MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Code Merge MCP 服务器 is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Code Merge MCP 服务器 as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Code Merge MCP 服务器 MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "code-merge-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "code-merge-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Code Merge MCP 服务器 MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Code Merge MCP 服务器 MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Code Merge MCP 服务器 to help me with this task?
Code Merge MCP 服务器
Sure. I read it.
Here is what I found using Code Merge MCP 服务器.

Frequently asked questions

What is the Code Merge MCP 服务器 MCP server used for?

Code Merge MCP 服务器 is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Code Merge MCP 服务器 MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Code Merge MCP 服务器 with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Code Merge MCP 服务器 MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Code Merge MCP 服务器 connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Code Merge MCP 服务器 MCP to TypingMind?

Code Merge MCP 服务器 runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Code Merge MCP 服务器 MCP provide in TypingMind?

Code Merge MCP 服务器 exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Code Merge MCP 服务器 MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Code Merge MCP 服务器 requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇