test-inventory-mcp 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +13 -12
- package/dist/command-line.js +6 -8
- package/dist/project.js +9 -6
- package/dist/server.js +3 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# test-inventory-mcp
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#22](https://github.com/Huldoser/test-inventory-mcp/pull/22) [`fad31c9`](https://github.com/Huldoser/test-inventory-mcp/commit/fad31c91e3bc3150cdb4e440795abf0940a7cee8) - Requires test-inventory 0.8.0 and reads Jest 29 and 30 projects: `framework` and `--framework` take `jest`. Without a
|
|
8
|
+
framework from the start command or the call, a call scans with the runner the project in `directory` uses; in a
|
|
9
|
+
project with several, the error names them and asks for `framework`. Globs on the command line no longer need
|
|
10
|
+
`--framework`.
|
|
11
|
+
|
|
3
12
|
## 0.5.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
An MCP server for [test-inventory](https://github.com/Huldoser/test-inventory): AI agents ask which tests a project
|
|
4
4
|
has, which are skipped and why, and which tests a change can affect, without running them.
|
|
5
5
|
|
|
6
|
-
It reads Playwright and
|
|
6
|
+
It reads Playwright, Vitest and Jest test files with test-inventory and answers from their source code. Nothing runs,
|
|
7
7
|
nothing is written, and nothing leaves your machine.
|
|
8
8
|
|
|
9
9
|
## Setup
|
|
10
10
|
|
|
11
|
-
Node.js 22.12 or newer. The client starts the server with `npx` and talks to it over standard input and output.
|
|
12
|
-
|
|
13
|
-
it pick the files instead, as on test-inventory's command line.
|
|
11
|
+
Node.js 22.12 or newer. The client starts the server with `npx` and talks to it over standard input and output. The
|
|
12
|
+
server scans the test files your Playwright, Vitest or Jest config runs, with the runner `--framework` names or, without
|
|
13
|
+
it, the one the project uses. Globs pick the files instead, as on test-inventory's command line.
|
|
14
14
|
|
|
15
15
|
**Claude Code**, in the project folder. `--scope project` writes `.mcp.json`, for everyone who works on the project:
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
|
-
claude mcp add --scope project test-inventory -- npx -y test-inventory-mcp@0.
|
|
18
|
+
claude mcp add --scope project test-inventory -- npx -y test-inventory-mcp@0.6 --framework playwright
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
**Cursor**, in `.cursor/mcp.json`:
|
|
@@ -25,7 +25,7 @@ claude mcp add --scope project test-inventory -- npx -y test-inventory-mcp@0.5 -
|
|
|
25
25
|
"mcpServers": {
|
|
26
26
|
"test-inventory": {
|
|
27
27
|
"command": "npx",
|
|
28
|
-
"args": ["-y", "test-inventory-mcp@0.
|
|
28
|
+
"args": ["-y", "test-inventory-mcp@0.6", "--framework", "playwright"]
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -39,14 +39,15 @@ claude mcp add --scope project test-inventory -- npx -y test-inventory-mcp@0.5 -
|
|
|
39
39
|
"test-inventory": {
|
|
40
40
|
"type": "stdio",
|
|
41
41
|
"command": "npx",
|
|
42
|
-
"args": ["-y", "test-inventory-mcp@0.
|
|
42
|
+
"args": ["-y", "test-inventory-mcp@0.6", "--framework", "playwright"]
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
Without `--framework`, as in a configuration shared by every project,
|
|
49
|
-
|
|
48
|
+
Without `--framework`, as in a configuration shared by every project, each call scans with the runner the project
|
|
49
|
+
uses. In a project with several runners the agent passes `framework`, as the tools tell it, and `patterns` when it
|
|
50
|
+
wants other files than the configs run.
|
|
50
51
|
|
|
51
52
|
The project is the folder given with `--root`, otherwise the one Claude Code names in `CLAUDE_PROJECT_DIR`, otherwise
|
|
52
53
|
the folder the client starts the server in.
|
|
@@ -54,12 +55,12 @@ the folder the client starts the server in.
|
|
|
54
55
|
## Command line
|
|
55
56
|
|
|
56
57
|
```text
|
|
57
|
-
test-inventory-mcp [--framework <playwright|vitest> [<glob...>]
|
|
58
|
+
test-inventory-mcp [--framework <playwright|vitest|jest>] [<glob...>] [--root <dir>]
|
|
58
59
|
```
|
|
59
60
|
|
|
60
61
|
| Option | Meaning |
|
|
61
62
|
| --------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
62
|
-
| `--framework <name>` | `playwright` or `
|
|
63
|
+
| `--framework <name>` | `playwright`, `vitest` or `jest`. Without it, the runner the project uses. A tool call can pass another. |
|
|
63
64
|
| `<glob...>` | The test files, relative to the project, in place of those the configs run. A tool call can pass others. |
|
|
64
65
|
| `--root <dir>` | The project. Tool calls can scan folders inside it, never outside. |
|
|
65
66
|
| `--help`, `--version` | Print the help or the version. |
|
|
@@ -102,7 +103,7 @@ as content of that project, not as instructions. To report a vulnerability, see
|
|
|
102
103
|
## Versioning
|
|
103
104
|
|
|
104
105
|
Tool names, their arguments and their answers are the server's API. Before 1.0, a change that breaks them raises the
|
|
105
|
-
minor version, so `test-inventory-mcp@0.
|
|
106
|
+
minor version, so `test-inventory-mcp@0.6` in the setup above gets fixes only.
|
|
106
107
|
|
|
107
108
|
## License
|
|
108
109
|
|
package/dist/command-line.js
CHANGED
|
@@ -3,12 +3,13 @@ import path from 'node:path';
|
|
|
3
3
|
import { parseArgs } from 'node:util';
|
|
4
4
|
/** The version of this package, read from its package.json in both the sources and the build. */
|
|
5
5
|
export const serverVersion = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
|
|
6
|
-
export const HELP = `Usage: test-inventory-mcp [--framework <playwright|vitest> [<glob...>]
|
|
6
|
+
export const HELP = `Usage: test-inventory-mcp [--framework <playwright|vitest|jest>] [<glob...>] [--root <dir>]
|
|
7
7
|
|
|
8
8
|
An MCP server on standard input and output. It answers an AI agent's questions about the
|
|
9
9
|
tests of a project from their source code, without running them.
|
|
10
10
|
|
|
11
|
-
--framework <name> playwright or
|
|
11
|
+
--framework <name> playwright, vitest or jest; without it, the runner the project uses;
|
|
12
|
+
a tool call can pass another
|
|
12
13
|
<glob...> test files to scan, relative to the root; without them, those the configs
|
|
13
14
|
run; a tool call can pass others
|
|
14
15
|
--root <dir> the project; defaults to $CLAUDE_PROJECT_DIR, then the current folder
|
|
@@ -16,7 +17,7 @@ tests of a project from their source code, without running them.
|
|
|
16
17
|
-v, --version show the version
|
|
17
18
|
|
|
18
19
|
Example, in an MCP client's configuration:
|
|
19
|
-
npx -y test-inventory-mcp
|
|
20
|
+
npx -y test-inventory-mcp
|
|
20
21
|
`;
|
|
21
22
|
function usageError(message) {
|
|
22
23
|
return { exitCode: 2, text: `test-inventory-mcp: ${message}\nRun test-inventory-mcp --help for the options.\n` };
|
|
@@ -44,11 +45,8 @@ export function parseCommandLine(args, env, cwd) {
|
|
|
44
45
|
if (values.version === true)
|
|
45
46
|
return { exitCode: 0, text: `${serverVersion}\n` };
|
|
46
47
|
const framework = values.framework ?? null;
|
|
47
|
-
if (framework !== null && framework !== 'playwright' && framework !== 'vitest') {
|
|
48
|
-
return usageError(`--framework must be playwright or
|
|
49
|
-
}
|
|
50
|
-
if (framework === null && positionals.length > 0) {
|
|
51
|
-
return usageError('the globs need --framework, the runner they are for.');
|
|
48
|
+
if (framework !== null && framework !== 'playwright' && framework !== 'vitest' && framework !== 'jest') {
|
|
49
|
+
return usageError(`--framework must be playwright, vitest or jest; got "${framework}".`);
|
|
52
50
|
}
|
|
53
51
|
const given = values.root ?? env.CLAUDE_PROJECT_DIR ?? cwd;
|
|
54
52
|
let root;
|
package/dist/project.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { realpath, stat } from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { scan } from 'test-inventory';
|
|
4
|
-
const MISSING = 'This server was started without a test runner, so pass `framework`: "playwright" or "vitest". Without ' +
|
|
5
|
-
'`patterns`, the test files are those the configs in `directory` and the folders below it run.';
|
|
6
4
|
/** A pattern from a tool call stays inside the folder it is scanned from: no absolute path and no `..`. */
|
|
7
5
|
function checkPattern(pattern) {
|
|
8
6
|
if (path.posix.isAbsolute(pattern) || path.win32.isAbsolute(pattern) || pattern.split(/[\\/]/).includes('..')) {
|
|
@@ -43,11 +41,16 @@ async function directoryIn(root, directory) {
|
|
|
43
41
|
}
|
|
44
42
|
/** Scans what the arguments name, falling back to what the server was started with. */
|
|
45
43
|
export async function scanProject(config, args) {
|
|
46
|
-
const framework = args.framework ?? config.framework;
|
|
47
|
-
if (framework === null)
|
|
48
|
-
throw new Error(MISSING);
|
|
44
|
+
const framework = args.framework ?? config.framework ?? undefined;
|
|
49
45
|
args.patterns?.forEach(checkPattern);
|
|
50
46
|
const root = args.directory === undefined ? config.root : await directoryIn(config.root, args.directory);
|
|
51
47
|
const patterns = args.patterns ?? (config.patterns.length > 0 ? config.patterns : undefined);
|
|
52
|
-
|
|
48
|
+
try {
|
|
49
|
+
return await scan({ root, patterns, framework, expandCases: args.expandCases });
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
// The scan throws only for its options. Without a runner named, it takes the one the project uses, and with none
|
|
53
|
+
// or several it says what to pass, named as the tool argument.
|
|
54
|
+
throw new Error(error.message.replace('options.framework', '`framework`'));
|
|
55
|
+
}
|
|
53
56
|
}
|
package/dist/server.js
CHANGED
|
@@ -5,7 +5,7 @@ import { serverVersion } from "./command-line.js";
|
|
|
5
5
|
import { DEFAULT_LIMIT, MAX_CHARACTERS, MAX_LIMIT, paginate } from "./page.js";
|
|
6
6
|
import { relatedIn, scanProject } from "./project.js";
|
|
7
7
|
import { DIAGNOSTIC_CODES, DIAGNOSTIC_LEVELS, outputSchema, pickedTest, ref, TEST_KEYS, TEST_STATES, } from "./schema.js";
|
|
8
|
-
export const INSTRUCTIONS = "test-inventory reads a project's Playwright or
|
|
8
|
+
export const INSTRUCTIONS = "test-inventory reads a project's Playwright, Vitest or Jest test files and configs and reports every test from its " +
|
|
9
9
|
'source code, without running anything: its state (active, skip, fixme, todo, expectedToFail, notLoaded), skip ' +
|
|
10
10
|
'reasons and conditions, tags, annotations and location, the projects that run it, the hooks around it, timeouts ' +
|
|
11
11
|
'and retries and where they are set, fixtures, assertion counts and steps, and the files each test runs ' +
|
|
@@ -28,9 +28,9 @@ const scanArguments = {
|
|
|
28
28
|
.optional()
|
|
29
29
|
.describe('A folder inside the project to scan, relative to its root, such as "packages/web". Default: the root.'),
|
|
30
30
|
framework: z
|
|
31
|
-
.enum(['playwright', 'vitest'])
|
|
31
|
+
.enum(['playwright', 'vitest', 'jest'])
|
|
32
32
|
.optional()
|
|
33
|
-
.describe('The test runner. Default: the one the server was started with.'),
|
|
33
|
+
.describe('The test runner. Default: the one the server was started with, otherwise the one the project in `directory` uses.'),
|
|
34
34
|
patterns: z
|
|
35
35
|
.array(z.string().min(1))
|
|
36
36
|
.min(1)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "test-inventory-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "MCP server for test-inventory: AI agents read a project's tests from source code, without running them.",
|
|
5
5
|
"mcpName": "io.github.Huldoser/test-inventory",
|
|
6
6
|
"keywords": [
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@modelcontextprotocol/server": "^2.3.1",
|
|
73
|
-
"test-inventory": "^0.
|
|
73
|
+
"test-inventory": "^0.8.0",
|
|
74
74
|
"zod": "^4.6.7"
|
|
75
75
|
}
|
|
76
76
|
}
|