C++ Style Guide MCP Server

C++ Style Guide MCP Server

Provides professional C++ code style checking, best practices analysis, and modern C++ upgrade suggestions with tools for naming conventions, memory safety, const correctness, and access to comprehensive C++ style documentation.

Category
访问服务器

README

C++ Style Guide MCP Server

专业的 C++ 编码规范检查和最佳实践建议工具,基于 MCP (Model Context Protocol) 协议构建。

功能特性

5 个代码分析工具

  • check_naming - 检查命名规范(变量、函数、类等)
  • check_include_guard - 验证头文件包含保护
  • analyze_memory_safety - 检测内存泄漏和悬空指针
  • suggest_modern_cpp - 现代 C++ 升级建议 (C++11/14/17/20/23)
  • check_const_correctness - 检查 const 正确性

4 类规范文档资源

  • cpp-style://naming/{category} - 命名规范
  • cpp-style://best-practices/{topic} - 最佳实践
  • cpp-style://standard/{version} - C++ 标准特性
  • cpp-style://examples/{pattern} - 设计模式示例

2 个代码审查提示模板

  • code_review - 综合/性能/安全/可读性审查
  • refactor_suggestion - 重构建议

快速开始

通过 Smithery 安装(推荐)

npx -y @smithery/cli install cpp-style-guide-mcp --client claude

本地安装

# 1. 克隆仓库
git clone https://github.com/lv5railgun/cpp_guidelines.git
cd cpp_guidelines

# 2. 安装依赖
uv sync

# 3. 添加到 Claude Desktop 配置
# 在 .mcp.json 或 Claude 配置文件中:
{
  "mcpServers": {
    "cpp-style": {
      "command": "uv",
      "args": ["run", "mcp", "run", "cpp_style_server.py"],
      "cwd": "/path/to/cpp_guidelines"
    }
  }
}

使用示例

# 检查命名规范
请使用 check_naming 工具检查 "myVariable" 是否符合成员变量命名规范

# 分析内存安全
请分析以下代码的内存安全问题:
void processData(int* ptr) {
    delete ptr;
    ptr->process();  // 悬空指针!
}

# 现代化建议
请使用 suggest_modern_cpp 工具将代码升级到 C++17

# 查看文档
请获取资源 cpp-style://naming/all
请获取资源 cpp-style://best-practices/memory

发布到 Smithery

准备工作

项目已包含所有必需的配置文件:

  • smithery.yaml - Smithery 部署配置
  • Dockerfile - 容器化配置
  • pyproject.toml - 项目元数据

发布步骤

# 1. 提交代码
git add .
git commit -m "准备发布到 Smithery"
git push origin main

# 2. 访问 Smithery 发布页面
# https://smithery.ai/new
# 连接 GitHub 仓库,Smithery 会自动检测配置并部署

# 3. 测试安装
npx -y @smithery/cli install cpp-style-guide-mcp --client claude

验证清单

  • [ ] 本地测试通过: uv run mcp run cpp_style_server.py
  • [ ] GitHub 仓库已推送
  • [ ] Smithery 构建成功
  • [ ] 可以通过 Smithery CLI 安装
  • [ ] 工具调用正常

项目结构

cpp_guidelines/
├── cpp_style_server.py      # MCP 服务器主文件
├── cpp_style/               # 核心功能模块
│   ├── tools/              # 5个分析工具
│   └── resources/          # 4类规范文档
├── smithery.yaml           # Smithery 配置
├── Dockerfile              # 容器配置
└── pyproject.toml          # 项目元数据

开发

# 运行服务器
uv run mcp run cpp_style_server.py

# 添加新工具
@mcp.tool()
def your_tool(param: str) -> str:
    """工具描述"""
    return "result"

# 添加新资源
@mcp.resource("cpp-style://category/{param}")
def your_resource(param: str) -> str:
    return "content"

技术栈

  • Python >= 3.12
  • FastMCP >= 1.21.0
  • uv (包管理)
  • Docker (部署)

许可证

MIT License

链接

  • GitHub: https://github.com/lv5railgun/cpp_guidelines
  • Issues: https://github.com/lv5railgun/cpp_guidelines/issues
  • Smithery: https://smithery.ai/

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选