test-inventory-mcp is an MCP server that gives AI coding agents tools to query a project's test inventory directly, with the core goal of answering test-related questions without running the test suite.
Purpose and main capabilities
- Reads and parses Playwright, Vitest, Jest, Mocha, Jasmine, Cypress, WebdriverIO, node:test, and Bun test files and configuration, generating a test inventory at the source level.
- Provides tools such as test_summary, find_tests, get_tests, get_run_commands, diff_inventories, and scan_diagnostics for summarizing tests, filtering tests by status or field, reading test details, getting runner commands for changed files, comparing two saved inventories, and diagnosing scan errors.
- Supports scanning by directory, framework, and glob pattern, and can use expandCases to expand each case of .each or .for tables and each iteration of loops into separate tests.
- Returns JSON results, sent both as structured content and as text; lists default to 50 items per page with a maximum limit of 200, and a single response is roughly no more than 30000 characters, with pagination via nextCursor.
- Unknown tool parameters are rejected with the unrecognized key names reported, preventing misspelled filter conditions from being silently ignored.
Usage
- Clients launch the server via npx over stdio; by default it auto-detects the test runner and reads its configuration.
- In Claude Code, you can use --scope project in the project directory to write .mcp.json; Cursor is configured in .cursor/mcp.json; VS Code is configured in .vscode/mcp.json.
- Multi-runner projects can append --framework <name>, or the agent can pass framework on each call; a glob can also be passed to override configuration file selection.
- The scan root is taken in order from --root, Claude Code's CLAUDE_PROJECT_DIR, and the folder where the client launched the server.
- After connecting, you can have the agent call test_summary to summarize tests; if scanIf Errors is non-zero, call scan_diagnostics first.
- get_run_commands requires a non-empty related list; the returned commands must be executed with a POSIX shell in the scan directory, and the server itself never executes these commands.
- diff_inventories accepts the paths of two fully saved JSON inventories within the project; before comparing, ensure both scans used the same framework, root directory, mode, filters, and expandCases settings; saved inventories should be produced with the core CLI without --fields or --format jsonl.
Use cases
- Quickly determine which test files should be run after changing code.
- List tests marked as skip or fixme along with their conditions and reasons.
- Compare additions, skips, re-enablements, and other changes between a baseline inventory and the latest inventory.
- Use in PR comments together with a GitHub Action.
Limitations and caveats
- Declared statuses describe the source code, not execution results: a conditional skip does not mean the test was actually skipped in a given run, and tests expected to fail are still executed.
- The server does not execute project code, write files, or establish network connections; however, installation via npx may download packages, and response text is passed to the MCP client, where subsequent handling is subject to the client's model provider and privacy settings.
- Scanning rejects directories or patterns that point outside the project, and also rejects answers in which test files, configuration, or dependencies resolve outside the project; this boundary is not a filesystem sandbox.
- Responses contain project file text (such as test titles, skip reasons, and comments), which the client should treat as project content rather than instructions.
- Saved inventory files must be regular files within the project and no larger than 128 MiB.
- Requires test-inventory 0.13.0 or a higher 0.13 patch release; breaking API changes before 1.0 will increment the minor version number.
- For details on the documentation, CLI and library, and GitHub Action, see huldoser.github.io/test-inventory.