Skip to main content
Glama
ArcherLin13

cpp-coro-graph

by ArcherLin13

cpp-coro-graph (V1)

構文レベルの C++17 コルーチン + デバイスドメイン グラフ。
主なターゲット: Linux。 標準ライブラリのみの Python 3.9+(実行に pip 依存は不要)。

V1 でできること:

  • すべての関数をノードとして: 定義 {...} および 宣言 Foo(); / = default / = delete(ヘッダー含む)

  • クラス/構造体メンバーを Class::Method として修飾(ctor/dtor 含む)

  • exec::task<…> Name / co_await / co_return を持つ関数を検出

  • co_await Foo(…) からの await エッジと、通常の calls を描画

  • メンバーパイプライン: SosModel::Call 内の co_await m.Init()SosModel::Init に解決(外側のクラス + ローカル変数 SosModel m

  • デバイスドメインcpu / gpu / npu / dsp)を rules/devices.json でタグ付け

  • SQLite DB + HTML ビジュアライゼーション + CLI(query / callers / callees / explore)+ MCP

V1 でできないこと:

  • テンプレート / マクロ / オーバーロード解決(後で compile_commands が必要)

  • スレッド間再開 / 時間からの真の並列エッジ

  • 完全な C++ パース(正規表現 + ブレースマッチングであり、コンパイラではない)

Linux へのインストール

git clone https://github.com/ArcherLin13/cpp-coro-graph.git
cd cpp-coro-graph

# option A — no install (recommended for a quick try)
chmod +x scripts/cpp-coro-graph scripts/index_repo.sh
./scripts/cpp-coro-graph index /path/to/your/repo

# option B — install CLI on PATH
python3 -m pip install -e .
cpp-coro-graph index /path/to/your/repo

必要なのは python3(3.9+)のみ。標準ライブラリの sqlite3 モジュールを使用。

Related MCP server: cpp-semantic-graph

Linux コードツリーのインデックス作成

# one-shot: index + HTML + status
./scripts/index_repo.sh /path/to/your/linux/repo

# or step by step
python3 -m cpp_coro_graph index /path/to/your/linux/repo
python3 -m cpp_coro_graph viz --db /path/to/your/linux/repo/.cpp-coro-graph/graph.db
python3 -m cpp_coro_graph status --db /path/to/your/linux/repo/.cpp-coro-graph/graph.db

出力:

  • /path/to/your/linux/repo/.cpp-coro-graph/graph.db

  • /path/to/your/linux/repo/.cpp-coro-graph/graph.html(ブラウザで開く)

ソースがある Linux マシン(または WSL2 Linux ファイルシステム)上で ツールを実行してください。WSL から /mnt/c/... 経由でのインデックス作成は避けてください。

スモークテスト:

./scripts/cpp-coro-graph index fixtures/sample --db fixtures/sample/.cpp-coro-graph/graph.db
./scripts/cpp-coro-graph viz --db fixtures/sample/.cpp-coro-graph/graph.db

ビジュアライゼーション(モジュール幹線、全宇宙ではない)

デフォルトの HTML は モジュール → エントリ → await 幹線 → ダブルクリックで展開:

# recommended: one module’s entries + main await flow
python3 -u -m cpp_coro_graph -q viz --db "$DB" --module path/to/module --depth 1

# pin one entry
python3 -u -m cpp_coro_graph -q viz --db "$DB" --around Call --depth 1

# legacy full graph (avoid on large trees)
python3 -u -m cpp_coro_graph -q viz --db "$DB" --full

ブラウザで: モジュールを選択し、エントリチップをクリックし、ノードを ダブルクリック して次の await レイヤーを展開します。必要に応じて calls を切り替えます。このモードではファイル/contains エッジは表示されません。

グラフのクエリ(codegraph スタイル)

大規模グラフ(10k+ ノード)— HTML よりもこちらを推奨:

DB=/path/to/repo/.cpp-coro-graph/graph.db

# search symbols
python3 -u -m cpp_coro_graph -q query OnSos --db "$DB"

# who calls / awaits this
python3 -u -m cpp_coro_graph -q callers OnSos --db "$DB"

# what it calls / awaits / spawns
python3 -u -m cpp_coro_graph -q callees OnSos --db "$DB" --edge-kind calls,await,spawns

# neighborhood BFS
python3 -u -m cpp_coro_graph -q explore OnSos --depth 2 --db "$DB"

# incoming blast radius
python3 -u -m cpp_coro_graph -q impact OnSos --depth 2 --db "$DB"

# JSON for scripting
python3 -u -m cpp_coro_graph -q callers OnSos --db "$DB" --json

インデックス作成したリポジトリに cd した場合、--db は省略可能(.cpp-coro-graph/graph.db を上方向に検索)。

Cursor MCP(オプション)

{
  "mcpServers": {
    "cpp-coro-graph": {
      "command": "python3",
      "args": [
        "-m", "cpp_coro_graph", "mcp",
        "--db", "/path/to/your/linux/repo/.cpp-coro-graph/graph.db"
      ],
      "cwd": "/path/to/cpp-coro-graph"
    }
  }
}

ツール: coro_explorecoro_stats

カスタムデバイスルール

rules/devices.json を編集するか、--rules your.json を渡します:

{
  "patterns": [
    {"match": "RunOnNpu", "domain": "npu", "backend": "custom"},
    {"match": "clEnqueue", "domain": "gpu", "backend": "opencl"}
  ]
}

最初に一致したものが優先されます。長い / より具体的な文字列を先に置いてください。

エッジの種類(4 つのみ)

種類

ビジュアル

意味

calls

実線

直接 / 同期呼び出し(スレッドヘルパー含む)

await

破線

co_await / CO_AWAIT

contains

グレー

ファイルが関数/クラスを所有

inherits

緑の破線

class Child : public Base

callers / callees はデフォルトで 制御 = calls+await のみ(ファイル/継承は含まない)なので、2 つの方向は区別されたままです。

python3 -u -m cpp_coro_graph -q callees Call --db "$DB"           # await+calls
python3 -u -m cpp_coro_graph -q callers Init --db "$DB"
python3 -u -m cpp_coro_graph -q explore SosModel --edge-kind inherits,contains --db "$DB"

スキップされるディレクトリ

.gitbuildoutthird_partynode_modules.codegraphbazel-*.repoprebuilts、…

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    F
    maintenance
    Provides a local code knowledge graph for Java projects, enabling querying of classes, methods, fields, calls, inheritance, and imports via MCP tools like query, context, impact, and cypher.
    1
  • F
    license
    Not graded
    quality
    B
    maintenance
    Builds a semantic knowledge graph of C++ code and exposes 9 MCP tools for AI assistants to search classes, functions, inheritance, callers, callees, overrides, and more.
    3
  • F
    license
    Not graded
    quality
    A
    maintenance
    CodeGraph MCP is a powerful standalone tool that parses your entire C/C++ codebase into a semantic knowledge graph and seamlessly exposes it to AI coding assistants via the Model Context Protocol (MCP). By providing AI (like Claude Desktop, Cursor, or Google Antigravity) with a structural map of your project—including caller/callee relationships, file dependencies, and dynamic function definition

View all related MCP servers

Related MCP Connectors

  • Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.

  • MCP server for static security analysis of Android source code

  • Persistent memory and cross-session learning for AI coding assistants (hosted remote MCP).

View all MCP Connectors

Latest Blog Posts

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/ArcherLin13/cpp-coro-graph'

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