MCP Test Runner

io.github.LovRanRan由 GitHub 账号 LovRanRan 发布v0.1.0更新于 Oct 24, 2026

Local test execution and coverage summaries for onboarding agents.

已验证STDIO仅桌面开发者工具数据与分析

概览

AI 生成的概览

一个本地 MCP 服务器,可运行 pytest 与 Jest 测试、解析其 JSON 输出并汇总 pytest 覆盖率,让助手用真实执行结果验证代码结论。

可以做什么
在受限的工作目录中运行 pytest 或 Jest 并返回原始命令输出,可设置超时、CPU 与内存上限,并提供健康检查用于冒烟测试。运行单个 pytest 节点 ID 或按测试名称模式运行 Jest 测试。将 pytest 与 Jest 的 JSON 输出归一化为统一的测试结果结构。从覆盖率 JSON 文件汇总 pytest-cov 覆盖率总计。
适用场景
适合助手在熟悉或分析代码库时,用真实测试执行而非猜测来支撑结论,例如把陈述标记为已验证、未验证或被反驳。最适用于使用 pytest 的 Python 项目,或可用的 Jest 的 JavaScript 项目。
运行要求
以 Python 3.11+ 包形式从 PyPI 本地安装(发行名 lovranran-mcp-test-runner,控制台脚本 mcp-test-runner),通过 stdio 运行。目标项目需要 pytest 及 pytest-json-report,覆盖率需要 pytest-cov;Jest 通过 npx 运行,因此需要 Node.js 和可解析的 Jest。CPU 与内存限制依赖支持 resource.setrlimit 的 POSIX 平台。未声明认证、环境变量或请求头。
安装前请注意
这些工具会在指定工作目录中以子进程方式执行测试命令,因此只应指向你信任的项目;测试代码可执行任意命令。Jest 通过 npx 调用,若本地未安装 Jest 可能会下载软件包。资源限制仅限 POSIX,v1 没有 Docker 隔离。覆盖率汇总仅支持 pytest,执行类工具返回原始输出,需另行解析。

安装

在 SourceWeft 中

  1. 打开 控制台中的 MCP Test Runner,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

mcp-test-runner

MCP server for deterministic local test execution and normalized test result reporting.

mcp-test-runner is the verification layer for codebase onboarding agents. It exposes focused MCP tools for running pytest and Jest, parsing test output, and summarizing coverage so downstream agents can mark claims as verified, unverified, or contradicted by real execution.

Codebase Onboarding Stack

mcp-test-runner is the verification layer in a three-server MCP tool stack for Project 6 wayfinder, a codebase onboarding agent.

  • mcp-repo-mapper maps repository structure, languages, entry points, framework evidence, and Python dependency edges.
  • mcp-ast-explorer provides symbol-grounded Python definition, signature, reference, call-chain, and class-hierarchy lookups.
  • mcp-test-runner runs local pytest/Jest checks and coverage summaries so agent claims can be verified against execution.

In wayfinder, this server turns high-risk code understanding claims into verified, unverified, or contradicted evidence from real test execution.

Status

This repository is a Python-first v1 MCP test runner. It supports bounded pytest execution, Jest command execution, single-test targeting, pytest coverage summaries, and normalized pytest/Jest JSON parsing.

The server does not use an LLM. Test results come from subprocess execution and structured parser output.

Tools

ToolPurpose
health()Returns ok for smoke checks.
run_pytest(path, test_filter?, timeout_seconds?, cpu_seconds?, memory_mb?)Run pytest in a bounded working directory and return raw command output.
run_jest(path, test_filter?, timeout_seconds?, cpu_seconds?, memory_mb?)Run Jest through npx jest and return raw command output.
run_single_test(path, test_id, framework?, timeout_seconds?, cpu_seconds?, memory_mb?)Run one pytest node id or one Jest test-name pattern.
parse_test_output(stdout, framework)Normalize test runner JSON output.
get_coverage_summary(path, framework?, timeout_seconds?, cpu_seconds?, memory_mb?)Return pytest-cov JSON coverage totals.

Supported Scope

  • Python 3.11+ package.
  • FastMCP 2.x server.
  • pytest execution with JSON report output via pytest-json-report.
  • Jest command execution via npx jest --json --outputFile.
  • pytest and Jest JSON normalization into one TestRunResult schema.
  • Single pytest node id execution and Jest test-name targeting.
  • pytest-cov coverage summary from .coverage.json.
  • Subprocess timeout plus POSIX resource.setrlimit CPU / memory caps.

Current Limitations

  • v1 does not use Docker. It uses cwd validation, subprocess timeouts, and POSIX resource limits.
  • Resource limits require a POSIX platform that supports resource.setrlimit.
  • Jest execution expects Node.js plus project-local or npx-resolvable Jest.
  • Jest single-test targeting uses --testNamePattern; it does not parse Jest file-specific node ids.
  • Coverage summary is pytest-only in v1.
  • Tools return raw command output for execution; call parse_test_output to normalize framework JSON.

Local Development

Install dependencies:

bash
uv sync --extra dev

The PyPI distribution name is lovranran-mcp-test-runner because mcp-test-runner is already taken on PyPI. The installed console script remains mcp-test-runner.

Run the MCP server:

bash
uv run mcp-test-runner

Run verification:

bash
uv run ruff check .uv run mypyuv run pytest

License

MIT

来源:README.md,提交 e24d639

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分