Command Palette

Search for a command to run...

UnylyUnyly
Browse all

Mcpp

FreeNot checked

C++ Semantic MCP Server

GitHubEmbed

About

C++ Semantic MCP Server

README

An MCP server that gives AI agents call graphs, cross-references, and impact analysis for C++ codebases.

With mcpp, your agents don’t have to grep through source files. No more guessing call relationships, missing template references, or wondering "what breaks if I change this?". mcpp gives precise, Clang-parsed semantic data: every caller, every call chain, every override.

What your agent can do with mcpp:

  • "Who calls HashGrid::query?" → precise callers, not grep matches
  • "Show the call path from main to Renderer::render" → full chain
  • "What's the blast radius if I change Scene::update?" → transitive impact
  • "Is Aabb::intersects dead code?" → zero callers = dead

Quick start

mcpp index path/to/compile_commands.json

This builds xref.db and prints a config snippet — paste it into your MCP client and you're done.

Usage

index — Build cross-reference database

Parses every translation unit in a compile_commands.json, extracts symbols, references, call edges, and inheritance relations into a SQLite database.

mcpp index path/to/compile_commands.json          # output: xref.db next to compdb
mcpp index path/to/build/ -o /tmp/xref.db         # explicit output path
mcpp index compile_commands.json -j 4             # limit threads (default: all cores)

After indexing, mcpp prints a .mcp.json snippet to stdout for easy copy-paste. Drop it into your MCP client's config:

  • Claude/Copilot CLI: //.mcp.json (repo-root), ~/.copilot/mcp-config.json or /mcp add
  • VS Code Copilot: //.github/copilot/mcp.json in your repo
  • Claude Desktop: claude_desktop_config.json

The snippet uses the mcpServers format supported by most MCP clients:

{
    "mcpServers": {
        "mcpp": {
            "type": "stdio",
            "command": "/path/to/mcpp",
            "args": ["serve", "/path/to/xref.db"]
        }
    }
}

MCP tools (11)

Tool Description
search_cpp_symbols Search symbols by name substring
get_cpp_definition Find where a symbol is defined
find_cpp_references Find all references to a symbol
find_callers Direct callers of a function (1-hop in)
find_callees Direct callees of a function (1-hop out)
get_class_members List members of a class/struct
get_symbol_stats Per-member fan-in counts, dead code detection
find_virtual_overrides Find classes overriding a virtual method
find_call_path Find call chains between two functions
find_call_path_via Call path A→B constrained through waypoint C
get_impact_radius Transitive blast radius of a change (N hops)

Building

Prerequisites

  • .NET 8 SDK
  • Visual Studio 2022 (v143 toolset, for ClangXref.dll)
  • LLVM 21.1.1 static libs (auto-downloaded on first build)

Build steps

# 1. Build native DLL (VS 2022 Developer Command Prompt)
#    Auto-downloads ~540 MB of LLVM libs on first run.
msbuild src\ClangXref\ClangXref.vcxproj /p:Configuration=Release /p:Platform=x64

# 2. Build C# server
dotnet build -c Release src\Mcpp

Both outputs go to bin/.

Generating compile_commands.json

For CMake projects (most common):

cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja

For MSBuild projects, use bt to extract from .binlog, or other tools that generate Clang-compatible compdbs.

Architecture

C# (.NET 8)                           C++ (LLVM 21.1.1)
┌────────────────┐                    ┌──────────────────────┐
│ mcpp.exe       │                    │ ClangXref.dll        │
│ ┌────────────┐ │  P/Invoke (Cdecl)  │ ┌──────────────────┐ │
│ │ CppIndexer │◄├───────────────────►│ │IndexDataConsumer │ │
│ └────────────┘ │  7 callbacks       │ │PPCallbacks       │ │
│ ┌────────────┐ │                    │ └──────────────────┘ │
│ │ XrefDB     │ │                    └──────────────────────┘
│ │ (SQLite)   │ │
│ └────────────┘ │
└────────────────┘

from github.com/sundaramramaswamy/mcpp

Installing Mcpp

This server has no published package — it is built from source. Open the repository and follow its README.

▸ github.com/sundaramramaswamy/mcpp

FAQ

Is Mcpp MCP free?

Yes, Mcpp MCP is free — one-click install via Unyly at no cost.

Does Mcpp need an API key?

No, Mcpp runs without API keys or environment variables.

Is Mcpp hosted or self-hosted?

Self-hosted: the server runs locally on your machine via the install command above.

How do I install Mcpp in Claude Desktop, Claude Code or Cursor?

Open Mcpp on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.

Related MCPs

Compare Mcpp with

Not sure what to pick?

Find your stack in 60 seconds

Author?

Embed badge for your README

Browse similar

All development MCPs