Nemesis-MCP
OfficialThis server exposes Nemesis-MCP's contract-drift checker so an agent can audit test doubles and fixtures against production code.
Audit a repository or selected paths (
nemesis_audit): scan test files/directories for drift between mocks, stubs and spies and the code they stand in for.Verify a single symbol (
nemesis_verify_symbol): list every test double pointing at a named class/interface/trait and whether each is still valid — useful before editing a class.Check stale fixtures (
nemesis_stale_fixtures): compare JSON/YAML fixtures against current DTO shapes to find missing, renamed or removed fields.Scope each scan with optional
paths,exclude(e.g. intentionally broken fixtures), and alangfilter (TypeScript, JavaScript, PHP, Python, Rust).Filter by severity via
strictness:breaking_only(default),all(includes warnings), oruntyped_only.All tools are read-only/analysis only (
taskSupport: forbidden); nothing is executed, imported or booted.
Audits JavaScript test doubles (mocks, stubs, and spies) created with Vitest or Jest, reporting mismatches with the real code such as ghost methods, arity errors, return drift, and visibility breaches.
Supports inspecting Jest doubles (jest.spyOn, manual mocks, mockReturnValue, mockImplementation, etc.) to detect stale or invalid mocks before running tests.
Audits PHP test doubles built with PHPUnit, Pest, or Mockery, catching signatures that no longer match the real class, including stubbed methods, return values, and visibility violations.
Supports checking pytest-mock based patches (mocker.patch, patch.object, create_autospec, etc.) against production code to find stale test doubles.
Audits Python test doubles created with pytest-mock or unittest.mock, detecting patches and mocks that no longer match the target module, method signatures, or return types.
Audits Rust mockall-based test doubles, verifying expected method calls and return values against the current Rust implementations.
Audits TypeScript test doubles (mocks, stubs, and spies) created with Vitest or Jest, reporting mismatches with the real code such as ghost methods, arity errors, return drift, and visibility breaches.
Supports inspecting Vitest doubles (vi.spyOn, vi.mocked, vi.mock, mockReturnValue, mockResolvedValue, etc.) to detect stale or invalid mocks before running tests.
Validates YAML fixtures against their expected DTOs, reporting missing, stale, or incorrectly typed fields.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Nemesis-MCP Scan the test mocks and report any that no longer match the current code."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Nemesis-MCP
A mock outlives the code it stands for, and the suite goes green anyway.
Nemesis (Νέμεσις) is the Greek goddess who deals out what is due. Her name comes from némein, to apportion, and her business is proportion: she takes back what was claimed beyond its warrant. A test double claims to stand in for something real. This tool checks whether it still has the right to.
TL;DR: Nemesis reads your test doubles and your production code, and reports every place a mock, stub or spy no longer matches the thing it replaces. It runs no tests. Nothing is executed, imported or booted, so the answer is the same every time you ask.
The failure it exists for is specific. When a signature changes, a mocked unit test keeps passing, because the mock defines the contract rather than the code does. The suite stays green while the thing it guards has moved. Agent-written tests reach that state faster than handwritten ones, because a generated mock records the shape of the code on the day it was generated and nothing ever revisits it.
Status: pre-release. Nemesis-MCP is not yet published to npm. The source is public on GitHub, so install from source, see Install. Any
npm install -gornpxline in this README describes the planned published experience and does not work yet.
Contents: What it finds · Install · Quick start · Languages · Fixtures · Discovery · Suppression · Development
What it finds
Four violation types, and nothing else. The set is fixed on purpose: a checker that grows a category per bug becomes a checker nobody reads.
Type | Meaning |
| The double stubs a member that is not there any more, with a did-you-mean from edit distance. Also covers an imported target that the module no longer exports, and a module mock supplying a key the module does not have. |
| The double passes more arguments than the method accepts, omits required ones, passes a literal of the wrong type, names an argument matching no parameter, or supplies a replacement function whose own signature the method no longer offers. |
| The pinned return value cannot satisfy the declared return type. Includes an object literal missing a required field or carrying a stale one, an enum case the enum no longer has, a promise handed back by a method that is not awaitable, and a fluent chain on a method that is not fluent. |
| The double replaces a member it cannot legitimately replace: a private or protected method, a final method, a final class, a static reached through an instance double, an accessor spied without an access type, or a PHP constructor. |
Every finding carries a confidence. definite is what syntax alone can prove and is worth failing a
build over. warning is a heuristic, and the difference is deliberate: two differing named types
are only a warning, because the class relating them usually lives in vendor/ or node_modules/,
which are never walked. A Python method with one leading underscore is a naming convention rather
than access control, so stubbing it warns; only a name-mangled __member is a definite breach. A
return value written behind a type assertion is read through the cast, because that is where drift
hides, but a field missing from it only warns: as unknown as T is also how a deliberate partial
stub is written, and syntax cannot tell the two apart. A stubbed method whose name is built at
runtime, such as shouldReceive($method) inside a loop, names nothing checkable and is skipped
entirely.
Where the evidence runs out, the answer is silence. A warning that is wrong most of the time teaches people to ignore the tool, which costs more than the finding was worth.
Related MCP server: open-code-review
Install
git clone https://github.com/AraneaDev/Nemesis-MCP.git
cd Nemesis-MCP
npm install
npm run buildThat gives you two binaries, nemesis for the command line and nemesis-mcp for the MCP server.
Planned, not available yet: once published, this becomes
npm install -g nemesis-mcp, ornpx nemesis-mcpon demand. Neither works until the package ships.
Quick start
# Every double in the repository, checked against the code it stands for
node dist/cli/main.js audit
# One symbol, and the state of every double that names it
node dist/cli/main.js verify-symbol PaymentGateway
# JSON fixtures against the DTOs they are supposed to describe
node dist/cli/main.js fixturesaudit exits 0 when clean, 1 on a violation, and 2 when a file was not read, so it works as
a pre-merge gate without further wiring. --strictness=all includes warnings,
--strictness=breaking_only is the default, and --allow-partial accepts an incomplete scan
knowingly rather than failing on it.
A file the grammar could not fully read is a third case, and it is not exit 2. The parse recovers, everything around the unreadable region is still indexed, and the run says how many files that happened to. Only a file that was not read at all, because of a read error or a size budget, leaves a gap in the symbol graph and makes the scan partial.
The summary says how much of the scan it actually compared:
Scanned 174 test file(s), inspected 4772 double(s).
2772 compared, 1521 unresolved, 475 with no contract to check, 4 unnamed.That second line matters more than the first. A double whose target cannot be resolved was counted, not checked, and a clean result over mostly-unresolved doubles means the scan found nothing because it could see nothing.
As an MCP server
{
"mcpServers": {
"nemesis": {
"command": "node",
"args": ["/absolute/path/to/Nemesis-MCP/dist/mcp/main.js"]
}
}
}Three tools: nemesis_audit for a whole tree, nemesis_verify_symbol for one symbol before you
change it, and nemesis_stale_fixtures for JSON and YAML fixtures against their DTOs.
The useful habit for an agent is to call nemesis_verify_symbol before editing a class and
nemesis_audit after, so a rename that stranded a mock is caught in the same turn that made it
rather than in review.
Supported ecosystems
Language | Frameworks | Patterns |
TypeScript, JavaScript | Vitest, Jest |
|
PHP | PHPUnit, Pest, Mockery |
|
Python | pytest-mock, unittest.mock |
|
Rust | mockall |
|
A module is a first-class target, not only a class. patch("core.system.subprocess_runner.run") and
vi.mock('../db.js', factory) both resolve to the file they name, and a name that file imports is a
member of it, because that is where Python convention says to patch it.
Fixtures
nemesis fixtures compares JSON and YAML fixtures against the DTOs they describe: a missing
required field, a field that no longer exists, a value of the wrong type, an enum case that was
renamed, and the same questions asked again inside nested objects and arrays.
A fixture is matched to a DTO by name or by shape overlap, and an ambiguous match is left alone. Config files, lock files and anything under a config directory are never treated as fixtures.
Discovery
Zero configuration. Test files are found by the conventions each ecosystem already uses, and
.gitignore is honoured, along with .nemesisignore if you add one. node_modules, vendor,
dist, build and the rest are never walked. Symlinks are followed once, by real path, so a
directory linked into its own tree cannot make the walk loop.
Scans are bounded: 2 MB per file, 10,000 files, 200 MB in total and 120 seconds. Hitting a bound exits 2 rather than reporting a clean result over a partial read.
Suppression
// nemesis-ignore-next-line
vi.spyOn(legacy, 'gone').mockReturnValue(true);One line, one comment, no configuration file. A suppression that has to be found in a separate file is a suppression nobody revisits.
Development
npm run typecheck
npm run lint
npm test
npm run buildNever pipe a gate into grep or tail. A pipe reports the exit status of the last command, so a
failing gate reads as a passing one. That mistake shipped a commit through a red test suite during
development, twice.
Fixtures under fixtures/experiments/ are deliberately broken, one directory per drift scenario,
and each one is expected to produce exactly the findings its README comment describes.
License
MIT.
Built by Tim Schipper and released as open source under aranea.dev.
Available Tools
3 toolsnemesis_auditNemesis AuditB
Scan the repository (or given paths) for contract drift between test doubles (mocks, stubs, spies) and production code.
Inputs: lang, paths, exclude, strictness.
nemesis_stale_fixturesNemesis Stale FixturesB
Check JSON/YAML fixtures against current production DTO shapes (missing/renamed/removed fields).
Inputs: paths, strictness.
nemesis_verify_symbolNemesis Verify SymbolA
List every test double pointing at a production symbol and whether each remains valid.
Inputs: symbol (required), exclude, strictness.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
nemesis_audit is a broad scan for contract drift, while nemesis_verify_symbol focuses on per-symbol test double validity and nemesis_stale_fixtures targets fixture/DTO shape mismatches. The overlap between audit and verify_symbol is minor and resolvable from context.
All tools share the nemesis_ prefix and use snake_case, but the pattern is not fully uniform: nemesis_audit is verb-only, nemesis_verify_symbol is verb_noun, and nemesis_stale_fixtures is adjective_noun. The naming is still readable and predictable.
Three tools is well-scoped for a focused contract-drift analysis server. Each tool addresses a distinct part of the domain without unnecessary bloat or obvious missing categories.
The set covers broad drift scanning, per-symbol validation, and stale fixture detection, which covers the core detection workflow. It lacks explicit remediation or detailed reporting tools, but those are not necessarily required for an analysis-focused server.
Maintenance
Related MCP Connectors
Change-impact intelligence for tracing dependencies, stale references and required updates.
Find retiring AI models and outdated API SDKs in your code, with dates, replacements and guides.
Dated, verified API breakages for coding agents, plus a local scan for them in your existing code.
On-demand drift checks: declared CSS color, radius, spacing & type vs your own tokens or a pack
Related MCP Servers
- FlicenseAqualityNot gradedmaintenanceStatic analysis engine that detects schema mismatches between data producers (like MCP servers) and consumers (like client code), preventing runtime errors by validating contracts at development time.11-
- AlicenseAqualityDmaintenanceAI-powered code review tool that detects AI-generated code defects invisible to traditional linters — hallucinated packages, deprecated APIs, cross-file contradictions, hidden security anti-patterns, and over-engineering. Works as a standalone CLI, GitHub Action, or MCP server. Supports TypeScript, Python, Java, Go, and Kotlin. Free for individuals, no API key required.441Business Source 1.1
- AlicenseAqualityDmaintenanceValidates AI-generated code against actual codebases to catch hallucinations, dead code, and API mismatches before runtime.1254 npm1MIT
- AlicenseNot gradedqualityBmaintenanceA local-first, deterministic, read-only MCP server that audits test suites for false-green tests, tautological assertions, and mock-contract drift, ensuring tests truly validate production code. It provides tools to detect test fidelity issues, verify mock drift, and synthesize strict mock contracts.MIT