Token导航 LogoToken导航TokenDH.com
Simplecov MCP logo
开发工具未说明官方级别未说明来源级核验

Simplecov MCP

MCP Server

一个MCP服务器,允许Claude直接访问SimpleCov覆盖率报告,无需读取整个大型JSON文件,按需获取所需数据。

工具数

5

提示词数

0

GitHub Stars

0

资源数

0
开发工具TypeScriptClaude数据分析Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

ryo-ymd

提供方

ryo-ymd

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

simplecov mcp

允许Claude直接访问SimpleCov覆盖率报告的MCP服务器。

无需通读全文 coverage/.resultset.json (可以是数十MB)。通过工具只检索您需要的数据。

设置

git clone https://github.com/yourname/simplecov-mcp.git
cd simplecov-mcp
pnpm install && pnpm build

然后,在Rails项目根目录中注册MCP服务器:

claude mcp add simplecov node /path/to/simplecov-mcp/build/index.js

这将MCP服务器添加到项目的 .mcp.json服务器自动检测 coverage/ 从工作目录中选择目录。

要明确指定覆盖路径,请执行以下操作:

claude mcp add simplecov -e SIMPLECOV_COVERAGE_PATH=/path/to/coverage node /path/to/simplecov-mcp/build/index.js

添加后,重新启动Claude Code并用验证 /mcp.

工具

get_summary

返回总体覆盖率摘要。

> get_summary

{
  "lastRun": { "line": 100, "branch": 100 },
  "totalFiles": 1669,
  "computed": { "lineCoverage": 53.56, "branchCoverage": 48.07 }
}

list_files

列出文件及其覆盖率。支持排序和过滤。

参数类型默认值说明
sort_bypathline_coveragebranch_coveragemissed_linespath排序键
orderascdescasc排序顺序
min_coveragenumber-最低覆盖率
max_coveragenumber-最大覆盖百分比
path_patternstring-文件路径的部分匹配筛选器
> list_files sort_by=missed_lines order=desc max_coverage=50

[
  { "file": ".../inquiries_controller.rb", "line": "8.96% (37/413)", "missed": 376 },
  ...
]

get_file_coverage

返回特定文件的详细覆盖率,包括每行命中次数、未覆盖的行号和分支覆盖率。

参数类型说明
file_pathstring(必填)文件路径。按后缀匹配
> get_file_coverage file_path=app/models/user.rb

{
  "filePath": "/usr/src/app/app/models/user.rb",
  "lineCoverage": "85.71% (12/14)",
  "uncoveredLineNumbers": [42, 43],
  "lines": [...],
  "branches": [...]
}

get_uncovered_lines

仅提取未覆盖的线条和分支。在添加测试时很有用。

> get_uncovered_lines file_path=app/services/order_service.rb

{
  "filePath": "/usr/src/app/app/services/order_service.rb",
  "lineCoverage": "72.5%",
  "uncoveredLineNumbers": [15, 16, 42, 43, 44],
  "uncoveredBranches": [
    { "condition": "[:if, 3, 15, 6, 15, 40]", "branch": "[:else, 5, 15, 6, 15, 40]" }
  ]
}

estimate_file_coverage

估计代码更改后的覆盖率,而无需重新运行测试。将服务器启动时保存的文件(基线)与磁盘上的当前文件进行比较,并通过行级差异映射旧的覆盖率数据。

参数类型说明
file_pathstring(必填)文件路径。按后缀匹配
> estimate_file_coverage file_path=app/models/user.rb

{
  "filePath": "/usr/src/app/app/models/user.rb",
  "fileChanged": true,
  "originalCoverage": "85.71% (12/14)",
  "estimatedCoverage": "82.35% (14/17)",
  "changeSummary": { "unchanged": 45, "added": 5, "removed": 2, "modified": 3 },
  "estimatedNewLines": [
    { "line": 15, "type": "modified", "status": "covered", "confidence": "medium" },
    { "line": 22, "type": "added", "status": "likely_covered", "confidence": "low" }
  ],
  "estimatedUncoveredLineNumbers": [30, 42, 43],
  "note": "..."
}

估算逻辑:

线型方法置信度
不变按原样使用原始覆盖率
modified继承原始覆盖率(测试可能仍然到达线路)中等
已添加来自周围街区覆盖率的估计值

此工具专为代理编码工作流而设计:运行一次测试,进行改进,估计覆盖率影响,然后继续前进。

Claude使用示例

"Show me files with low coverage"
"Show uncovered lines in app/models/user.rb"
"List controllers with coverage below 50%"
"Write tests for the uncovered lines in this file"
"Estimate coverage after my changes to user.rb"

运作原理

Rails Project
├── coverage/
│   ├── .resultset.json  ← Generated by SimpleCov (tens of MB)
│   └── .last_run.json   ← Summary
└── .mcp.json            ← MCP configuration (created by claude mcp add)

simplecov-mcp searches for the coverage/ directory starting from cwd,
then walking up to parent directories. It parses .resultset.json and
holds the data in memory. Claude retrieves only the needed portions
via tools.

At startup, the server also reads and caches the source files referenced
in coverage data. This baseline is used by estimate_file_coverage to
detect changes and map coverage through line-level diffs (LCS-based).

目录标签

目录标签

开发工具TypeScriptClaude数据分析代码覆盖率本地部署测试工具开发效率MCP服务器

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

部署方式(deploymentType,部署类型)

local-only

工具数量(toolCount,工具数)

5

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明nonelocal-only

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP