Skip to main content

MCP server for running and normalizing local test results.

Project description

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

Tool Purpose
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:

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:

uv run mcp-test-runner

Run verification:

uv run ruff check .
uv run mypy
uv run pytest

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lovranran_mcp_test_runner-0.1.0.tar.gz (110.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lovranran_mcp_test_runner-0.1.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file lovranran_mcp_test_runner-0.1.0.tar.gz.

File metadata

  • Download URL: lovranran_mcp_test_runner-0.1.0.tar.gz
  • Upload date:
  • Size: 110.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for lovranran_mcp_test_runner-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cbe35371a0dfba8693d949b69f745a6a31f8f08a124846fb942ac1c5cb7b57ae
MD5 8af7e5b10b5f96332d99e15c4480ebac
BLAKE2b-256 10bf29c2b25de53518621292fc4be5e047a7bb1eb427193591ddb2fd6b5f7139

See more details on using hashes here.

File details

Details for the file lovranran_mcp_test_runner-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lovranran_mcp_test_runner-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for lovranran_mcp_test_runner-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b86e99a2e549d5a71498589e280b40e08913bff7d3e1da45cd4217a9af3f532
MD5 880c00d4ee1ba73d4986e6b73cc7b1f3
BLAKE2b-256 cbfae957d007e51a8e33b17851b0b752f978852bbe2f58c3f2f8c74aaae29b4f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page