modelcontextprotocol / modelcontextprotocol/servers

Bring all servers to the 90% per-file coverage gate; reintroduce the rule to AGENTS.md

Open
#4,474 2 comments 0 reactions 1 assignee View on GitHub

@cliffhall is already working on this.

Since Jul 4, 2026.

v2
Dominant language
TypeScript
Stars
90.5k
Forks
11.7k
Avg merge
2d 2h
Merged PRs (30d)
5

Description

Goal

Bring every server up to the ≥ 90% per-file test-coverage gate used in the inspector repo, enforce it in tooling, and then reintroduce the rule into AGENTS.md — #4473 deliberately deferred it so the rule wouldn't be aspirational fiction on day one. Once this issue lands, the rule is true and stays true.

The gate (per the inspector v2/main reference)

  • Per-file threshold of ≥ 90 on all four dimensions: lines, statements, functions, branches
  • Genuinely-unreachable branches are not waved through by lowering the gate — they get a justified inline ignore at the source (/* v8 ignore ... -- <reason> */ for TS; # pragma: no cover # <reason> for Python)
  • Coverage is a separate, deliberate command (npm run coverage), not baked into the fast validate loop — mirroring inspector's split (validate = fast unit tests; coverage = instrumented gate)

Scope

TypeScript servers (vitest + @vitest/coverage-v8 already in place):

  • everything, filesystem, memory, sequentialthinking
  • Configure per-file thresholds (coverage.thresholds with perFile: true, 90 across lines/statements/functions/branches) in each server's vitest config
  • Root npm run coverage chaining the per-workspace coverage runs (companion to #4473's validate chain)

Python servers (pytest + pyright + ruff in place; coverage tooling TBD):

  • fetch, git, time
  • Add pytest-cov/coverage.py; note coverage.py's fail_under is global, not per-file — pick the per-file enforcement mechanism as part of this work (e.g. coverage json + a small check script, matching the TS gate's semantics)
  • uv run coverage equivalent documented per server

Tasks

  • Audit current coverage per server — record the baseline in a comment on this issue (some servers may be far from 90; the audit sizes the work)
  • Write the missing tests, server by server (each server can be its own PR — independent, reviewable chunks)
  • Annotate genuinely-unreachable branches with justified ignores instead of gate-lowering
  • Enforce: per-file 90/90/90/90 thresholds in each TS vitest config; per-file mechanism for Python
  • Root coverage script (TS chain) + per-server Python invocation
  • Decide CI posture and document it: inspector runs validate in CI and keeps the coverage gate local-only — adopt the same unless there's a reason not to
  • Reintroduce the rule into AGENTS.md ("Always test new or modified code" section): per-file ≥ 90 on all four dimensions, justified-ignore policy, coverage vs validate split — wording adapted from the inspector reference

Dependencies

  • Builds on #4473 (AGENTS.md + validate script must exist first — this issue extends both)

Acceptance

  • Every TS server passes its per-file 90% gate via npm run coverage
  • Every Python server passes the equivalent gate
  • Gates are enforced by configuration, not convention
  • AGENTS.md states the rule, and the rule is true on the day it's stated

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.