用途:通过 MCP 让 AI 助手(Claude、Cursor、Copilot)调用 CytoScnPy 的代码度量分析工具。
前提:需要独立 CLI 二进制 cytoscnpy-cli;Python 包不支持 mcp-server。
配置方式:Claude Desktop 在 claude_desktop_config.json 中加入 mcpServers 配置,command 为 cytoscnpy,args 为 ["mcp-server"];Cursor 使用与 Claude Desktop 相同的配置,加入 Cursor 的 MCP 设置。VS Code + Copilot 在安装扩展后会自动注册 MCP 服务器,无需额外配置,可直接让 Copilot 执行如“Run a security scan on this file”的请求。
可用工具:连接后向 AI 助手暴露安全扫描(检测密钥、令牌)、危险扫描(检测危险代码模式)、质量扫描(复杂度、可维护性等代码质量指标)、克隆检测(查找重复代码)、原始度量(LOC、SLOC、注释、空行)。
VS Code 扩展设置项及默认值:analysisMode 为 workspace(workspace 准确、file 快速);enableSecretsScan 为 false;enableDangerScan 为 false;enableQualityScan 为 false;enableCloneScan 为 false;confidenceThreshold 为 0(范围 0-100);excludeFolders 为 [];includeFolders 为 [];maxComplexity 为 10;minMaintainabilityIndex 为 40;maxNesting 为 3;maxArguments 为 5;maxLines 为 50。
CI/CD:支持 JSON、GitLab、SARIF 和 GitHub Annotations 输出格式。更多细节见 references/integrations.md。
限制:必须使用独立 CLI 二进制,Python 包不支持 mcp-server;其余平台与收费信息暂未提供。