Skip to main content
Glama
C++ Style Guide MCP Server

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++ 代码

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

Inputs: code (required). Returns: result

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

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

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

Inputs: code (required). Returns: result

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

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

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

Inputs: code (required), file_path. Returns: result

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

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

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

Inputs: identifier (required), category (required). Returns: result

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

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

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

Inputs: code (required), target_standard. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 5 tools

    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 recent community issues

    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
      B
      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
      28 PyPI
      2
      MIT
    • F
      license
      Not graded
      quality
      C
      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
      C
      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
      -