MM

mpsm/mcp-cpp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

114 stars 30 forks 质量 75 趋势 16MIT

mpsm/mcp-cpp 是从 https://github.com/mpsm/mcp-cpp. 导入的 MCP 服务器候选。

概览

mpsm/mcp-cpp 是从 https://github.com/mpsm/mcp-cpp. 导入的 MCP 服务器候选。

概述(AI 翻译)

一款模型上下文协议(MCP)服务器,通过 clangd LSP 集成提供 C++ 代码分析能力。使 AI 代理能够利用类似于现代 IDE 的语义理解来处理 C++ 代码库。

为什么是这个MCP服务器?

现代C++开发高度依赖高级工具,以应对复杂的代码库,包括预处理器宏、模板实例和复杂的继承层级。虽然人类使用基于IntelliSense的IDE来理解这些复杂性,但大多数AI代理依赖纯文本浏览。

该 MCP 服务器通过为 AI 代理提供类似于现代 IDE 中开发者的语义分析能力,弥合了这一空白。与通用的 LSP MCP 实现不同,该服务器专注于 C++ 工作流。

该服务器可同时处理多个 C++ 项目,这对于嵌入式 Linux 开发等复杂场景尤为有用,因为理解各个组件之间的交互至关重要。它支持 CMake 和 Meson 构建系统,并支持自动构建目录检测和切换。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

C++ MCP Server

A Model Context Protocol (MCP) server that provides C++ code analysis capabilities through clangd LSP integration. Enables AI agents to work with C++ codebases using semantic understanding similar to modern IDEs.

Why This MCP Server?

Modern C++ development relies heavily on advanced tooling to navigate complex codebases with preprocessor macros, template instantiations, and intricate inheritance hierarchies. While humans use IntelliSense-powered IDEs to understand these complexities, most AI agents rely on text-only browsing.

This MCP server bridges that gap by providing AI agents with semantic analysis capabilities similar to what developers experience in modern IDEs. Unlike generic LSP MCP implementations, this server focuses specifically on C++ workflows.

The server can handle multiple C++ projects simultaneously, which is particularly useful for complex scenarios like embedded Linux development where understanding interactions between individual components is crucial. It supports both CMake and Meson build systems with automatic build directory detection and switching.

Advanced indexing monitoring tracks both clangd’s index state and logs to ensure complete symbol coverage, while intelligent filtering distinguishes between project code and external dependencies.

Features

The server provides three core analysis tools for C++ development. The get_project_details tool performs dynamic CMake and Meson build environment discovery and enables configuration switching. For symbol exploration, search_symbols offers C++ symbol search with project boundary detection and intelligent filtering. When deeper analysis is needed, analyze_symbol_context provides symbol analysis with inheritance and call hierarchy support.

The implementation works with both CMake and Meson projects, handling projects with multiple libraries and executables simultaneously. Advanced indexing monitors clangd’s index state and logs to ensure complete symbol coverage, while intelligent filtering distinguishes between project code and external dependencies. The server automatically discovers and switches between build configurations, and includes a Python CLI tool for quick symbol exploration.

Component Discovery

在 GitHub 查看完整 README

安装

docker run -i --rm -v /path/to/cpp-project:/workspace mcp-cpp-server --root /workspace
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "cpp-tools": { "command": "mcp-cpp-server", "env": { "CLANGD_PATH": "/usr/bin/clangd-20" } } } }