KC

kandrwmrtn/cplusplus_mcp

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

34 stars 6 forks 品質 83 トレンド 26MIT

Libclang を使って C++ のコードベースを解析するための MCP (Model Context Protocol) サーバー.

概要

Libclang を使って C++ のコードベースを解析するための MCP (Model Context Protocol) サーバー。 構造を理解しようとするC++のコードベースを通してClaude grepを持つ代わりに、このサーバーは、あなたのコードの分離的な理解を提供します。 クロードは、数千のファイルで失われたことなく、瞬時にクラス、関数、およびその関係を見つけることができます。 C++の構文、継承階層、およびグラフを呼び出します。Claudeは、IDEのようにコードベースをナビゲートする機能を提供します。 コンテキスト効率の高いC++コード分析: - 名前パターンでクラスを検索 - 名前パターンで関数を見つけます - 詳細なクラス情報を取得する(メソッド、メンバー、継承) - - 関数のシグネチャとパラメータを取得する - 特定のファイル内の検索記号 - - クラスの完全な継承階層を取得する - ベースクラスから継承するすべてのクラスを見つける - 特定の関数を呼び出すすべての関数を見つける - - 特定の関数によって呼び出されるすべての関数を見つける - 特定の関数から1つの関数から呼び出しパスを見つける - - - - 特定の関数から1つの関数から1つの関数から1つの関数への呼び出しパスを検索...

概要(AI 翻訳)

Libclang を使って C++ のコードベースを解析するための MCP (Model Context Protocol) サーバー。

なぜこれを使うのか?

構造を理解しようとするC++のコードベースを通してClaude grepを持つ代わりに、このサーバーは、あなたのコードの分離的な理解を提供します。 クロードは、数千のファイルで失われたことなく、瞬時にクラス、関数、およびその関係を見つけることができます。 C++の構文、継承階層、およびグラフを呼び出します。Claudeは、IDEのようにコードベースをナビゲートする機能を提供します。

##特徴

コンテキスト効率的なC++コード解析: -search classes - 名前パターンでクラスを検索する

  • search functions - 名前パターンで関数を見つける -get class info - 詳細なクラス情報(メソッド、メンバー、継承)を取得する
  • get function signature - 関数署名とパラメータの取得
  • find in file - 特定のファイル内の検索記号
  • get class hierarchy - クラスの完全な継承階層を取得する
  • get derived classes - ベースクラスから継承するすべてのクラスを見つける
  • find callers - 特定の関数を呼び出すすべての関数を見つける
  • find callees - 特定の関数によって呼び出されるすべての関数を見つける

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

C++ MCP Server

An MCP (Model Context Protocol) server for analyzing C++ codebases using libclang.

Why Use This?

Instead of having Claude grep through your C++ codebase trying to understand the structure, this server provides semantic understanding of your code. Claude can instantly find classes, functions, and their relationships without getting lost in thousands of files. It understands C++ syntax, inheritance hierarchies, and call graphs - giving Claude the ability to navigate your codebase like an IDE would.

Features

Context-efficient C++ code analysis:

  • search_classes - Find classes by name pattern
  • search_functions - Find functions by name pattern
  • get_class_info - Get detailed class information (methods, members, inheritance)
  • get_function_signature - Get function signatures and parameters
  • find_in_file - Search symbols within specific files
  • get_class_hierarchy - Get complete inheritance hierarchy for a class
  • get_derived_classes - Find all classes that inherit from a base class
  • find_callers - Find all functions that call a specific function
  • find_callees - Find all functions called by a specific function
  • get_call_path - Find call paths from one function to another

Prerequisites

  • Python 3.9 or higher
  • pip (Python package manager)
  • Git (for cloning the repository)
  • LLVM’s libclang (the setup scripts will attempt to download a portable build)

Setup

  1. Clone the repository:
git clone 
cd CPlusPlus-MCP-Server
  1. Run the setup script for your platform (this creates a virtual environment, installs dependencies, and fetches libclang if possible):

    • Windows
      server_setup.bat
      
    • Linux/macOS
      ./server_setup.sh
      
  2. Test the installation (recommended):

# Activate the virtual environment first
mcp_env\Scripts\activate

# Run the installation test
python scripts\test_installation.py

This will verify that all components are properly installed and working. The test script lives at scripts/test_installation.py.

Configuring Claude Code

To use this MCP server with Claude Code, you need to add it to your Claude configuration file.

  1. Find and open your Claude configuration file. Common locations include:

    C:\Users\\.claude.json
    C:\Users\\AppData\Roaming\Claude\.claude.json
    %APPDATA%\Claude\.claude.json
    

    The exact location may vary depending on your Claude installation.

  2. Add the C++ MCP server to the mcpServers section:

    {
      "mcpServers": {
        "cpp-analyzer": {
          "command": "python",
          "args": [
            "-m",
            "mcp_server.cpp_mcp_server"
          ],
          "cwd": "YOUR_INSTALLATION_PATH_HERE",
          "env": {
            "PYTHONPATH": "YOUR_INSTALLATION_PATH_HERE"
          }
        }
      }
    }
    
GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "cpp-analyzer": { "command": "python", "args": [ "-m", "mcp_server.cpp_mcp_server" ], "cwd": "YOUR_INSTALLATION_PATH_HERE", "env": { "PYTHONPATH": "YOUR_INSTALLATION_PATH_HERE" } } } }