clangd-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@clangd-mcp Check my main.cpp for any compilation errors."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
clangd-mcp
MCP server for C/C++ code analysis using clangd and clang tools. Provides diagnostics, symbol search, include analysis, function listing, and code formatting.
Features
check_file — run clangd diagnostics on a C/C++ file (errors, warnings)
find_symbol — search for symbol definitions across source files (regex)
get_includes — list and analyze #include directives
list_functions — extract function/method declarations from a file
clang_format — format code using clang-format (dry-run or in-place)
Falls back to compiler syntax checking (clang++, g++, MSVC) if clangd is not available.
Related MCP server: C++ MCP Server
Requirements
Python 3.10+
Optional: clangd, clang-format, ctags (for full functionality)
Works with fallback even without clang tools installed
Installation
pip install clangd-mcpOr from source:
git clone https://github.com/ibuildrun/clangd-mcp.git
cd clangd-mcp
pip install -e .MCP Configuration
Add to your .kiro/settings/mcp.json:
{
"mcpServers": {
"clangd": {
"command": "clangd-mcp",
"disabled": false
}
}
}Or with uvx:
{
"mcpServers": {
"clangd": {
"command": "uvx",
"args": ["clangd-mcp"],
"disabled": false
}
}
}Usage Examples
> check_file "src/game/client/components/menus.cpp" "build"
> find_symbol "RenderBackground" "src"
> get_includes "src/game/client/ui.h"
> list_functions "src/game/client/components/menus.cpp"
> clang_format "src/game/client/ui.cpp" "file" trueLicense
MIT
Available Tools
4 toolsclang_formatA
Format a C/C++ file using clang-format.
Args: file_path: Path to the C/C++ source file. style: Formatting style (file, llvm, google, chromium, mozilla, webkit). dry_run: If True, show diff without modifying file. If False, format in place.
Inputs: file_path (required), style, dry_run. Returns: result
find_symbolA
Search for a symbol (function, class, variable) definition across C/C++ files.
Args: symbol: Symbol name to search for (supports regex). directory: Directory to search in. extensions: Comma-separated file extensions to search.
Inputs: symbol (required), directory, extensions. Returns: result
get_includesB
List all #include directives in a C/C++ file and check if they resolve.
Args: file_path: Path to the C/C++ source file.
Inputs: file_path (required). Returns: result
list_functionsB
Extract function/method declarations and definitions from a C/C++ file.
Args: file_path: Path to the C/C++ source file.
Inputs: file_path (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: symbol search, include resolution, function listing, and formatting. There is no overlap or ambiguity.
Most tools follow verb_noun pattern (find_symbol, get_includes, list_functions), but clang_format deviates slightly by starting with a noun. Overall, names are clear and predictable.
Four tools is a small but reasonable set for a focused C/C++ analysis server. It covers essential tasks without being overly thin.
The tool surface covers basic code analysis and formatting, but lacks expected features like diagnostics, code completion, or refactoring. There are notable gaps for a clangd-based server.
Related MCP Connectors
Lean 4 MCP server: compile, prove theorems, and formalize math with Mathlib.
MCP Server for JFrog, providing tools for development and artifact management.
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceAn MCP server that exposes Language Server Protocol features to external clients, allowing access to hover information, definitions, completions, references, and rename functionalities.43MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that provides semantic understanding of C++ codebases using libclang, allowing Claude to instantly find classes, functions, and their relationships without having to grep through thousands of files.34MIT
- AlicenseAqualityDmaintenanceMCP server for comprehensive code analysis, navigation, and quality assessment across 25+ programming languages.988MIT
- AlicenseBqualityBmaintenanceAn MCP server for C++ development that currently provides a server_status diagnostic tool. It validates a workspace directory and is designed to expand into build, test, and debugging capabilities.72MIT