Skip to main content
Glama
SongJiangzhou

C++ Style Guide MCP Server

中文 | English

C++ Style Guide MCP Server

Enforce consistent C++ style and best practices across your codebase. Analyze naming conventions, memory safety, and const correctness, and get actionable modernization suggestions up to C++23. Accelerate reviews with ready-made prompts and quick access to curated guidelines.

Tools

Tool

Description

check_naming

Validate C++ identifiers (variables, classes, functions, etc.) against naming conventions

check_include_guard

Verify header file include guards or #pragma once usage

analyze_memory_safety

Detect memory leaks, dangling pointers, and unsafe memory patterns

suggest_modern_cpp

Get modernization suggestions targeting C++11 through C++23

check_const_correctness

Find missing const qualifiers on member functions, parameters, and variables

Related MCP server: mcp-zen-of-languages

Resources

URI

Description

cpp-style://naming/{category}

Naming convention reference (variable, class, function, namespace, …)

cpp-style://best-practices/{topic}

Best practice guides (memory, exceptions, templates, concurrency, …)

cpp-style://standard/{version}

C++ standard feature docs (cpp11 – cpp23)

cpp-style://examples/{pattern}

Design pattern examples (RAII, Pimpl, Factory, Observer, …)

Prompts

Prompt

Description

code_review

Code review template (general / performance / safety / readability / modern)

refactor_suggestion

Refactoring guide targeting a specific C++ standard

Usage

npx -y @smithery/cli install @SongJiangzhou/cpp_guidelines --client claude

MCP endpoint (HTTP / streamable-http)

https://cpp-style-guide-mcp.fly.dev/mcp

Local installation

git clone https://github.com/SongJiangzhou/cpp_guidelines_mcp.git
cd cpp_guidelines_mcp
uv sync
uv run mcp run cpp_style_server.py

Add to your MCP client config:

{
  "mcpServers": {
    "cpp-style": {
      "command": "uv",
      "args": ["run", "mcp", "run", "cpp_style_server.py"],
      "cwd": "/path/to/cpp_guidelines_mcp"
    }
  }
}

Examples

# Check a variable name
check_naming("myVariable", "variable")

# Analyze memory safety
analyze_memory_safety("void f(int* p) { delete p; p->run(); }")

# Modernize code to C++17
suggest_modern_cpp("for (int i=0; i<v.size(); i++) {...}", "cpp17")

# Check const correctness
check_const_correctness("class Foo { int getValue() { return x; } int x; };")

# Access naming convention docs
Resource: cpp-style://naming/all

# Access memory best practices
Resource: cpp-style://best-practices/memory

Project Structure

cpp_guidelines_mcp/
├── cpp_style_server.py        # MCP server entry point
├── cpp_style/
│   ├── tools/                 # 5 analysis tools
│   ├── resources/             # 4 reference resource categories
│   ├── prompts/               # 2 prompt templates
│   └── data/                  # JSON knowledge base
├── fly.toml                   # Fly.io deployment config
├── Dockerfile                 # Container image
└── smithery.yaml              # Smithery config (local stdio mode)

Tech Stack

License

MIT

Available Tools

5 tools
analyze_memory_safetyC
分析 C++ 代码中的内存安全问题

参数:
    code: 要分析的 C++ 代码

返回:
    内存安全分析报告,包括潜在的内存泄漏、悬空指针、不安全操作等
ParametersJSON Schema
NameRequiredDescriptionDefault
codeYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions the tool analyzes for issues like memory leaks and dangling pointers, but lacks details on behavioral traits such as analysis depth, performance implications, error handling, or output format specifics. This is a significant gap for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured, with a clear purpose statement followed by parameter and return sections. Every sentence adds value, and there's no redundant information. It could be slightly more front-loaded by integrating the return details into the main statement, but it's efficient overall.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (analyzing code for safety issues), no annotations, and an output schema (implied by 'Has output schema: true'), the description is minimally adequate. It covers the basic purpose and return types but lacks details on behavioral aspects and usage context, making it incomplete for optimal agent guidance.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds minimal semantics beyond the input schema. It specifies that the 'code' parameter is C++ code to analyze, but with 0% schema description coverage, it doesn't elaborate on format, size limits, or preprocessing needs. The baseline is 3 due to the single parameter being straightforward, but the description doesn't fully compensate for the coverage gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: analyzing C++ code for memory safety issues. It specifies the verb 'analyze' and resource 'C++ code', making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'check_const_correctness' or 'suggest_modern_cpp', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

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 alternatives. It doesn't mention sibling tools like 'check_const_correctness' or 'suggest_modern_cpp', nor does it specify prerequisites or contexts for usage. This leaves the agent without direction on tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

check_const_correctnessB
检查 C++ 代码中的 const 正确性

参数:
    code: 要检查的 C++ 代码

返回:
    const 正确性检查报告,包括缺少 const 的地方和改进建议
ParametersJSON Schema
NameRequiredDescriptionDefault
codeYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool checks const correctness and returns a report with suggestions, but lacks details on execution behavior, such as whether it performs static analysis, runtime checks, error handling, or performance implications. For a tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, starting with the main purpose followed by parameter and return details in a structured format. It avoids unnecessary words, but could be slightly more concise by integrating the parameter and return sections more seamlessly. Every sentence adds value, making it efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (analyzing C++ code for const correctness), the description is minimally adequate. It covers the purpose, parameter, and return value, and an output schema exists, so it doesn't need to explain return values in detail. However, with no annotations and incomplete behavioral details, it leaves gaps in understanding how the tool operates or interacts with other tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful context beyond the input schema. The schema only defines 'code' as a string with 0% description coverage, but the description specifies it as '要检查的 C++ 代码' (C++ code to check), clarifying the parameter's purpose and expected content. This compensates well for the low schema coverage, though it doesn't detail format or constraints like code length or language version.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '检查 C++ 代码中的 const 正确性' (Check const correctness in C++ code). It specifies the verb ('检查' - check) and resource ('C++ 代码中的 const 正确性' - const correctness in C++ code), making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'analyze_memory_safety' or 'suggest_modern_cpp', which might also involve C++ code analysis, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

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 alternatives. It doesn't mention any prerequisites, context for usage, or comparisons to sibling tools such as 'check_naming' or 'suggest_modern_cpp'. Without this information, users might struggle to select the appropriate tool for their needs.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

check_include_guardA
检查 C++ 头文件的包含保护是否正确

参数:
    code: 头文件的完整代码
    file_path: 可选的文件路径,用于生成建议的保护宏名

返回:
    检查结果,包含是否符合规范、详细说明和建议
ParametersJSON Schema
NameRequiredDescriptionDefault
codeYes
file_pathNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it states what the tool does (checks include guards) and mentions the return format ('检查结果,包含是否符合规范、详细说明和建议' - check results including compliance, detailed explanation, and suggestions), it doesn't describe important behavioral aspects like error handling, performance characteristics, or what constitutes 'correct' include guards. For a code analysis tool with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise and well-structured. It opens with the core purpose, then clearly lists parameters and return values in separate sections. Every sentence earns its place by providing essential information without redundancy. The bilingual presentation (Chinese purpose with parameter/return labels) is efficient and clear.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (2 parameters, 1 required), the presence of an output schema (which handles return value documentation), and the clear parameter explanations in the description, this is reasonably complete. The main gap is the lack of behavioral context about how the analysis works, but the output schema reduces the need to describe return values in the description itself. For a code analysis tool, this provides adequate context for basic usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description provides meaningful parameter information beyond the schema. While schema description coverage is 0%, the description explains that 'code' is '头文件的完整代码' (complete header file code) and 'file_path' is '可选的文件路径,用于生成建议的保护宏名' (optional file path used to generate suggested guard macro names). This adds crucial semantic context about what each parameter represents and how they're used, compensating well for the lack of schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '检查 C++ 头文件的包含保护是否正确' (Check if C++ header file include guards are correct). It specifies the verb ('检查' - check), resource ('C++ 头文件' - C++ header files), and scope ('包含保护' - include guards). This distinguishes it from sibling tools like 'check_const_correctness' or 'suggest_modern_cpp' which focus on different aspects of C++ code analysis.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context (when working with C++ header files that should have include guards), but doesn't explicitly state when to use this tool versus alternatives. It doesn't mention prerequisites, limitations, or comparisons with sibling tools. The context is clear but lacks explicit guidance on when this specific check is appropriate versus other code analysis tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

check_namingA
检查 C++ 标识符命名是否符合规范

参数:
    identifier: 要检查的标识符名称
    category: 标识符类别,可选值:
             - variable: 变量
             - constant: 常量
             - function: 函数
             - class: 类
             - namespace: 命名空间
             - member_variable: 成员变量
             - template_parameter: 模板参数
             - file_naming: 文件命名

返回:
    检查结果,包含是否符合规范、详细说明和建议
ParametersJSON Schema
NameRequiredDescriptionDefault
identifierYes
categoryYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool checks naming compliance and returns results with details and suggestions, but it does not disclose important behavioral traits such as what specific naming standards are applied (e.g., Google C++ Style Guide, ISO C++ Core Guidelines), whether it performs case sensitivity checks, or if there are any limitations (e.g., length constraints, reserved words). This leaves gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, starting with the main purpose followed by parameter and return details. It uses bullet points for the category options to enhance readability. However, the inclusion of both Chinese and English terms (e.g., '标识符' and 'identifier') adds minor redundancy, slightly reducing efficiency.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (2 parameters, no annotations, but with an output schema), the description is fairly complete. It covers the purpose, parameters, and return values, and the presence of an output schema means the description does not need to explain return values in detail. However, it lacks context on the specific naming standards or behavioral constraints, which could be important for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds significant meaning beyond the input schema, which has 0% description coverage. It explains that 'identifier' is the name to check and 'category' specifies the type with a detailed list of optional values (e.g., variable, constant, function), providing clear semantics that are not present in the schema. This fully compensates for the lack of schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('检查' meaning 'check') and resource ('C++ 标识符命名' meaning 'C++ identifier naming'), and it distinguishes this from sibling tools like 'analyze_memory_safety' or 'check_const_correctness' by focusing specifically on naming conventions rather than other code quality aspects.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through the parameter 'category' which lists specific identifier types (e.g., variable, function, class), suggesting when to use this tool for different naming checks. However, it does not explicitly state when to use this tool versus alternatives like 'suggest_modern_cpp' or provide exclusions, leaving some ambiguity.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

suggest_modern_cppB
建议将代码升级为现代 C++ 写法

参数:
    code: 要分析的 C++ 代码
    target_standard: 目标 C++ 标准,可选值:
                    - cpp11: C++11
                    - cpp14: C++14
                    - cpp17: C++17 (默认)
                    - cpp20: C++20
                    - cpp23: C++23

返回:
    现代化建议报告,包括可以使用的新特性和重写示例
ParametersJSON Schema
NameRequiredDescriptionDefault
codeYes
target_standardNocpp17

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions the tool '建议' (suggests) upgrades and returns a report, but lacks details on behavioral traits like whether it modifies code, requires specific permissions, handles errors, or has rate limits. For a tool with no annotations, this is insufficient disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with a clear purpose statement followed by structured parameter and return sections. Every sentence earns its place by providing essential information without redundancy, making it efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (code analysis with parameter options), no annotations, and an output schema (implied by '返回' section), the description is fairly complete. It covers purpose, parameters, and return values, but could improve by adding more behavioral context or usage guidelines to fully compensate for the lack of annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds significant meaning beyond the input schema, which has 0% description coverage. It explains that 'code' is the C++ code to analyze and 'target_standard' is the target C++ standard with optional values and default, including a detailed enum-like list. This compensates well for the low schema coverage, though it doesn't cover all possible parameter nuances.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '建议将代码升级为现代 C++ 写法' (suggests upgrading code to modern C++ style). It specifies the verb '建议' (suggest) and resource '代码' (code), but doesn't explicitly differentiate from sibling tools like 'analyze_memory_safety' or 'check_const_correctness', which focus on specific aspects rather than general modernization.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

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. The description doesn't mention sibling tools or contexts where this tool is preferred, such as for general code modernization versus specific checks like memory safety or naming conventions. Usage is implied but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A3.7/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose within C++ code analysis: memory safety, const correctness, include guards, naming conventions, and modern C++ suggestions. There is no overlap in functionality, and an agent can easily distinguish which tool to use for each specific code quality concern.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern with snake_case (e.g., analyze_memory_safety, check_const_correctness, suggest_modern_cpp). The naming is predictable and readable throughout the set, with no deviations in style or convention.

Tool Count5/5

With 5 tools, this server is well-scoped for a C++ style guide purpose. Each tool addresses a distinct aspect of code quality (memory, constness, includes, naming, modernization), making the count appropriate and manageable without being too sparse or overwhelming.

Completeness4/5

The tool set covers key areas of C++ style and safety analysis effectively, including memory, const correctness, includes, naming, and modernization. A minor gap is the lack of tools for other common style aspects like formatting, error handling patterns, or performance optimization suggestions, but core workflows are well-covered.

Maintenance

ActivityInactive
ResponsivenessNo issues

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

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides comprehensive codebase analysis including project structure evaluation, cross-language duplicate detection, microservices validation, and configuration optimization with AI-powered pattern learning that generates actionable improvement reports.
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Enables AI assistants and developers to analyze code for language-specific best practices and idiomatic patterns across programming languages, CI automation, and configuration formats.
    16
    2
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides precise C++ code semantic analysis for AI coding tools like Claude Code and Cursor by integrating clangd static analysis, enabling symbol definition lookup, reference tracking, and hover information.
    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

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/SongJiangzhou/cpp_guidelines_mcp'

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