clangd-mcp
Click on "Install 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-mcpCheck 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.
| Name | Required | Description | Default |
|---|---|---|---|
| style | No | file | |
| dry_run | No | ||
| file_path | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden. It discloses the dry_run behavior (show diff vs modify) but does not mention prerequisites (e.g., clang-format installation) or side effects like file overwriting beyond the implied in-place formatting.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise: one line for purpose, followed by a bulleted list of arguments. No redundant information, and the main action is front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Although an output schema exists, the description does not discuss return values, but that is acceptable. Missing context includes system requirements (clang-format installed) and error handling. Overall, it adequately covers the tool's behavior for a simple operation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, but the description thoroughly explains each parameter: file_path as path, style with options, dry_run with behavior. This adds significant meaning beyond the bare schema types.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb (format) and resource (C/C++ file using clang-format), distinguishing it from siblings like find_symbol and list_functions that serve different purposes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when formatting C/C++ files, but lacks explicit when-to-use or when-not-to-use guidance, nor does it compare to alternatives. However, sibling tools are sufficiently distinct.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | ||
| directory | No | src | |
| extensions | No | .cpp,.h,.hpp,.c |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description fully bears the burden. It reveals that 'symbol' supports regex, which is a behavioral trait. However, it omits details like whether the search is recursive, whether it is read-only, or what happens if no match is found.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise with no unnecessary words. It front-loads the core purpose and then lists parameters with brief explanations. Every sentence adds value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the presence of an output schema (not shown but signaled), the description can omit return format details. It covers purpose and parameters adequately, though it could mention search depth (recursive) or case sensitivity to be fully comprehensive.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so the description must compensate. It clarifies that 'symbol' supports regex and 'extensions' is comma-separated, adding meaning beyond the schema. The 'directory' parameter could be more explicit (e.g., 'path to the root directory for the search').
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb (search), the resource (symbol definition), and the scope (C/C++ files). It distinguishes itself from siblings like 'list_functions' which lists functions rather than searching for arbitrary symbol definitions.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives. For example, there is no comparison with 'list_functions' or conditions like 'use this when you need a specific symbol location, use list_functions for an overview of all functions'.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Mentions checking resolution but lacks details on error handling, output format, or implications of unresolved includes. No annotations provided to compensate.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Short and to the point, though the 'Args:' formatting adds minor redundancy; still efficient.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Adequate for a simple tool with one parameter and an output schema, but lacks behavioral details like what 'resolve' means or side effects.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description barely adds value beyond the schema's title, stating 'Path to the C/C++ source file.' No format or validation hints.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool lists all #include directives in a C/C++ file and checks if they resolve, which distinguishes it from siblings like find_symbol and list_functions.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus siblings; no context about prerequisites or scenarios.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_functionsB
Extract function/method declarations and definitions from a C/C++ file.
Args: file_path: Path to the C/C++ source file.
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden for behavioral disclosure. It does not mention that the tool parses the file, handles errors, or returns locations. The description is too minimal to inform an agent about side effects or performance implications.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise: a single sentence plus a parameter line. It is front-loaded with the purpose. Every word is useful, though the parameter description could be integrated more naturally.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (C/C++ function listing), the description is minimal. An output schema exists, so return values need not be detailed, but the description lacks mention of parsing scope, error handling, or performance considerations. It is adequate but could be more complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It adds 'Path to the C/C++ source file' for file_path, which is slightly more informative than the schema's 'File Path'. However, it omits details like accepted formats, absolute/relative paths, or file extension expectations.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Extract') and clearly identifies the resource ('function/method declarations and definitions from a C/C++ file'). It distinguishes from siblings like find_symbol and get_includes by focusing on listing all functions rather than finding a specific one or retrieving includes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus its siblings (find_symbol, get_includes, clang_format). There is no mention of prerequisites, file types beyond C/C++, or context where this tool should be preferred.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
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.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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 gradedqualityAmaintenanceAn MCP server that exposes Language Server Protocol features to external clients, allowing access to hover information, definitions, completions, references, and rename functionalities.1640MIT
- AlicenseNot gradedqualityFmaintenanceAn 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.33MIT
- AlicenseNot gradedqualityAmaintenanceMCP server for the Cangjie programming language, providing documentation search and LSP-based code intelligence.4MIT
- AlicenseAqualityDmaintenanceMCP server for comprehensive code analysis, navigation, and quality assessment across 25+ programming languages.988MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/ibuildrun/clangd-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server