Skip to main content
Glama
dsh-mcp-server-clangd

dsh-mcp-server-clangd

by Rcyc-1025

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
CLANGD_PATHNoPath to the clangd executable. If omitted, clangd is found automatically in PATH.
CLANGD_LOG_LEVELNoLog level. Defaults to info.
CLANGD_PROJECT_ROOTNoProject root; used as the base for relative file paths and required if projectRoot is not provided via CLANGD_BRIDGE_CONFIG.
CLANGD_ALLOWED_ROOTSNoSemicolon-separated list of directories allowed for file access. Defaults to [projectRoot].
CLANGD_BRIDGE_CONFIGNoPath to the clangd-bridge.json config file. The config file can provide projectRoot and other settings.
CLANGD_REQUEST_TIMEOUT_MSNoTimeout in milliseconds for a single LSP request. Defaults to 30000.
CLANGD_COMPILE_COMMANDS_DIRNoDirectory containing compile_commands.json. Defaults to projectRoot.

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

clangd 桥:只读的 C/C++ 代码智能。先调用 clangd_health(start:true 可预热)确认 compile db 与 clangd 可用;其它工具的位置参数从 1 开始(UTF-16 列)。

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}

Tools

Functions exposed to the LLM to take actions

NameDescription
clangd_healthA

自检 clangd 桥:检查 clangd 可执行文件/版本、compile_commands.json、进程状态与风险警告。默认不启动常驻进程(start:false);start:true 会预热并完成 initialize。

clangd_definitionA

查询某个位置符号的定义(textDocument/definition)。输入 file(绝对路径或相对 projectRoot)、1-based line/column;返回定义所在文件与选区范围(1-based,end exclusive)。

clangd_hoverA

查询某个位置符号的悬停信息(textDocument/hover):类型、声明、注释。输入 1-based line/column,返回 contents 文本及其 markdown/plaintext 类型。

clangd_referencesA

查找符号的全部引用(textDocument/references)。返回按文件/行/列排序的 1-based 位置列表;includeDeclaration 控制是否包含声明本身。

clangd_diagnosticsA

获取某个文件的 clangd 诊断(错误/警告/提示)。会先 didOpen/didChange 再等待 publishDiagnostics 推送;waitMs 超时则返回 pending=true 与已缓存的诊断。

clangd_document_symbolsA

获取单个文件内的符号大纲(textDocument/documentSymbol)。clangd 返回层次结构时保留父子关系;超过 limit 时按 DFS 截断并标记 truncated。

clangd_workspace_symbolsA

在工作区内按名称模糊搜索符号(workspace/symbol)。query 必填且不能为空(避免返回全量索引);结果按 clangd 相关性顺序,超过 limit 截断。

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A4/5.0

Scored across 7 tools

Disambiguation5/5

Each tool maps to a distinct clangd/LSP operation (health, definition, hover, references, diagnostics, document symbols, workspace symbols) with no overlapping purposes. An agent can easily select the right tool for a given code-intelligence query.

Naming Consistency5/5

All tools use the same clangd_ prefix followed by a snake_case verb/noun phrase, giving a highly predictable pattern. There is no mixing of camelCase or inconsistent verb styles.

Tool Count5/5

Seven tools is a well-scoped set for a clangd bridge, with each tool covering a distinct core LSP capability. No tool feels redundant or unnecessary.

Completeness4/5

The surface covers the primary code-navigation and analysis needs: health checks, definitions, hover, references, diagnostics, and both document/workspace symbol search. Some advanced LSP operations such as implementation/type-definition lookup, call hierarchy, or rename are absent but are not essential for basic code understanding.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues