mcprigor 1.0.0-rc.4 → 1.1.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.
@@ -13,7 +13,7 @@ npm install --save-dev mcprigor
13
13
  For reproducible CI runs, pin an exact version in `package.json` and update it deliberately:
14
14
 
15
15
  ```json
16
- { "devDependencies": { "mcprigor": "1.0.0-rc.4" } }
16
+ { "devDependencies": { "mcprigor": "1.1.0" } }
17
17
  ```
18
18
 
19
19
  Release notes and tarball checksums for each version are on the [GitHub releases page](https://github.com/FusionOnePlatform/mcprigor/releases).
@@ -10,7 +10,7 @@ You need Node.js 20 or 22. MCP Rigor is published on npm as [`mcprigor`](https:/
10
10
  mkdir mcp-acceptance-tests
11
11
  cd mcp-acceptance-tests
12
12
  npm init -y
13
- npm install --save-dev mcprigor
13
+ npm install mcprigor
14
14
  ```
15
15
 
16
16
  To check the installation:
@@ -88,7 +88,7 @@ Open `report.html` or attach it to a ticket.
88
88
  npx mcprigor workspace .
89
89
  ```
90
90
 
91
- Open the printed local URL. Select `calculator.mcpr`, edit it, choose **Validate**, then **Run tests**.
91
+ Open the printed local URL. Select `calculator.mcpr` — the editor gives you syntax highlighting and autocomplete — then choose **Validate** and **▶ Run tests**. You can also create new test files, run several suites at once with the checkboxes, and review run history and trends in the results panel. See the [QA workspace guide](QA-WORKSPACE.md).
92
92
 
93
93
  ## If you do not know tool names
94
94
 
@@ -0,0 +1,67 @@
1
+ # MCP Rigor as an MCP server
2
+
3
+ Expose MCP Rigor itself over the Model Context Protocol so AI agents — Claude Code, Cursor, or any MCP client — can write, validate, and run natural-language acceptance tests for the MCP server they are building. The agent gets a deterministic feedback loop: it writes a `.mcpr` file, runs it, reads structured pass/fail results, fixes the server, and repeats. No AI interprets the test wording at runtime.
4
+
5
+ ## Start it
6
+
7
+ From your project directory:
8
+
9
+ ```bash
10
+ mcprigor serve
11
+ ```
12
+
13
+ Or with an explicit root:
14
+
15
+ ```bash
16
+ mcprigor serve path/to/project
17
+ ```
18
+
19
+ The server speaks MCP over stdio. Typical client configuration:
20
+
21
+ ```json
22
+ {
23
+ "mcpServers": {
24
+ "mcprigor": {
25
+ "command": "npx",
26
+ "args": ["mcprigor", "serve", "/absolute/path/to/project"]
27
+ }
28
+ }
29
+ }
30
+ ```
31
+
32
+ ## Tools
33
+
34
+ | Tool | Purpose |
35
+ | --- | --- |
36
+ | `list_suites` | List test files under the root (`.mcpr`, YAML, JSON). |
37
+ | `read_suite` | Read one test file. |
38
+ | `write_suite` | Create or overwrite one `.mcpr` file (omit `text` for a starter template). |
39
+ | `validate_suite` | Compile without running; returns test names or a diagnostic with line/column and a fix hint. |
40
+ | `run_tests` | Run 1–20 suites; returns per-test status, duration, and failure messages. Failing runs set `isError`. |
41
+ | `run_parity` | Run a suite's declared parity targets and compare transports. |
42
+ | `get_history` | Read recorded run history, filterable by suite or test name. |
43
+
44
+ Results are returned both as JSON text and as `structuredContent`, and test runs append to `.mcprigor/workspace-history.jsonl` — the same history the [QA workspace](QA-WORKSPACE.md) shows as trends.
45
+
46
+ ## The agent loop
47
+
48
+ 1. `write_suite` — the agent drafts acceptance tests in natural language.
49
+ 2. `validate_suite` — deterministic wording check; diagnostics carry exact line and column.
50
+ 3. `run_tests` — starts the server declared by each suite's `Server:` line, runs the tests, returns structured results.
51
+ 4. The agent fixes its MCP server (or the test) and repeats.
52
+ 5. `get_history` — spot regressions across iterations.
53
+
54
+ ## Trust model
55
+
56
+ `run_tests` and `run_parity` start whatever command each suite's `Server:` line declares, with the workspace root as working directory — exactly like running `mcprigor test` yourself. This is the same trust model as `npm test`: point the root at a project you trust, because test suites in that project can execute code.
57
+
58
+ Additional guards:
59
+
60
+ - file access is confined to the workspace root, with the same path and type restrictions as the QA workspace;
61
+ - `write_suite` only writes `.mcpr` files, capped at 1 MiB;
62
+ - batches are capped at 20 suites per call;
63
+ - a recursion guard refuses to start when a suite under test spawns `mcprigor serve` itself more than two levels deep.
64
+
65
+ ## Limits
66
+
67
+ The MCP server exposes the create/validate/run loop. Renaming files, deleting files, snapshot acceptance, contract updates, and evidence comparison remain CLI (or workspace) operations by design — an agent should not silently rewrite baselines that exist to catch its own regressions.
@@ -185,6 +185,79 @@ Test: "Search behaves the same"
185
185
 
186
186
  Run with `mcprigor parity FILE`.
187
187
 
188
+ ## Test a server that needs a bearer token
189
+
190
+ Point the suite at the deployed endpoint and pass the token through an environment variable. Never paste a real token into a test file.
191
+
192
+ ```text
193
+ MCP Test 1
194
+ Suite: "Deployed order service"
195
+ MCP URL: https://qa.example.com/mcp
196
+
197
+ Server options:
198
+ headers:
199
+ Authorization: "Bearer ${env.QA_TOKEN}"
200
+
201
+ Test: "an authenticated call succeeds"
202
+ Call tool "find_order" with:
203
+ orderId: "A-1001"
204
+ Expect "structuredContent.status" equals "shipped"
205
+ ```
206
+
207
+ Run it with the token in the environment:
208
+
209
+ ```bash
210
+ QA_TOKEN=... mcprigor test orders.mcpr
211
+ ```
212
+
213
+ Three guarantees come with this pattern:
214
+
215
+ - if `QA_TOKEN` is not set, the run stops with `Environment variable not found: QA_TOKEN` instead of sending an empty header;
216
+ - header values are registered with the redactor automatically, so the token never appears in reports or evidence bundles;
217
+ - a wrong or expired token surfaces the server's own response (for example `{"error":"unauthorized"}`) in the failure message.
218
+
219
+ Any header works the same way — `X-Api-Key`, custom tenant headers, and so on.
220
+
221
+ ## Compare an open local server with a protected deployment
222
+
223
+ Parity targets accept per-target options, so the local build can run without auth while the deployed target sends the token:
224
+
225
+ ```text
226
+ Compare target "Local": node dist/server.js
227
+ Compare target "QA": https://qa.example.com/mcp
228
+
229
+ Target options for "QA":
230
+ headers:
231
+ Authorization: "Bearer ${env.QA_TOKEN}"
232
+
233
+ Test: "Search behaves the same"
234
+ Call tool "search" with:
235
+ query: "red shoes"
236
+ Expect "structuredContent.total" equals 2
237
+ ```
238
+
239
+ ## When the token must be fetched first
240
+
241
+ MCP Rigor does not perform OAuth login flows or token exchanges itself; tests stay deterministic and secrets stay outside test files. When a short-lived token must be acquired (client-credentials exchange, cloud CLI, vault), fetch it in the step before the run:
242
+
243
+ ```bash
244
+ QA_TOKEN=$(curl -s -X POST https://auth.example.com/oauth/token \
245
+ -d grant_type=client_credentials \
246
+ -d client_id="$CLIENT_ID" -d client_secret="$CLIENT_SECRET" | jq -r .access_token)
247
+ QA_TOKEN=$QA_TOKEN mcprigor test orders.mcpr
248
+ ```
249
+
250
+ In CI, do the same in the workflow:
251
+
252
+ ```yaml
253
+ - name: Acceptance tests
254
+ env:
255
+ QA_TOKEN: ${{ secrets.QA_TOKEN }}
256
+ run: npx mcprigor test tests/*.mcpr
257
+ ```
258
+
259
+ Interactive browser-redirect OAuth is out of scope by design: an acceptance run must be repeatable without a human in the loop.
260
+
188
261
  ## Match a snapshot
189
262
 
190
263
  ```text
@@ -1,6 +1,6 @@
1
1
  # QA workspace
2
2
 
3
- Use MCP Rigor in a browser to edit, validate, and run saved tests.
3
+ Use MCP Rigor in a browser to create, edit, validate, and run saved tests — no terminal needed for the daily loop.
4
4
 
5
5
  ## Start it
6
6
 
@@ -18,31 +18,53 @@ mcprigor workspace . --port 4173
18
18
 
19
19
  Open the printed local URL, for example `http://127.0.0.1:4173`.
20
20
 
21
+ Start it from a dedicated project folder rather than your home directory. Hidden directories and unreadable folders are skipped automatically, and suite discovery stops six levels deep.
22
+
23
+ ## First run
24
+
25
+ An empty folder shows a three-step welcome screen. Choose **+ New test file** (or press `Ctrl/⌘+N`): the file is created from a working example and opens immediately. Point the `Server:` line at your MCP server command — or replace it with `MCP URL:` for a deployed HTTP endpoint — then **Validate** and **▶ Run tests**.
26
+
21
27
  ## Daily workflow
22
28
 
23
- 1. Select a `.mcpr` suite in the left panel.
24
- 2. Edit the plain-language scenario.
25
- 3. Choose **Validate**.
26
- 4. Fix any diagnostic shown below the editor.
27
- 5. Choose **Run tests** or **Run parity**.
28
- 6. Review the result panel.
29
- 7. Save the file.
29
+ 1. Select a `.mcpr` suite in the left panel, or create one with **+ New test file**.
30
+ 2. Edit the plain-language scenario. The editor provides syntax highlighting, line numbers, and autocomplete: top-level declarations at the start of a line, actions and assertions when indented, and comparison phrases after `Expect "field"`. Accept with `Tab` or `Enter`; force the list open with `Ctrl+Space`.
31
+ 3. Choose **Validate** (`Ctrl/⌘+S` saves, `Ctrl/⌘+Enter` runs). A wording problem highlights the offending line and moves the cursor to it.
32
+ 4. Choose **▶ Run tests** or **Parity**.
33
+ 5. Review the results panel: per-file pass/fail with durations; select a file for its full report.
34
+
35
+ The editor marks unsaved changes; running or validating saves them first. If the file changed elsewhere after you opened it, the workspace refuses to overwrite it and asks you to reload.
36
+
37
+ ## Batch runs
38
+
39
+ Every file row has a checkbox. Selecting one or more files shows a batch bar with **Validate**, **Parity**, and **▶ Run** for the whole selection (up to 20 files per run). The Run panel lists each file with its outcome and duration.
40
+
41
+ ## Renaming
42
+
43
+ Rename a file from the pencil icon on its row, the toolbar pencil, or by double-clicking the file name. Run history follows the new name automatically, so History and Trends stay intact. To rename an individual test, edit its `Test: "…"` line — history tracks tests by name within each suite.
44
+
45
+ ## History, trends, and search
46
+
47
+ Test runs are recorded in `.mcprigor/workspace-history.jsonl` (most recent 2000 entries). The results panel has three tabs:
48
+
49
+ - **Run** — the current run, with per-file reports.
50
+ - **History** — past runs, expandable to per-test status, duration, and error text.
51
+ - **Trends** — per-suite pass rate, a duration sparkline over the last 30 runs, and per-test pass-rate bars that make flaky or consistently failing tests stand out.
30
52
 
31
- The editor marks unsaved changes. If the file changed elsewhere after you opened it, the workspace refuses to overwrite it and asks you to reload.
53
+ One search box filters all three tabs. It matches suite names, test names, and error text, and highlights matches, so you can answer questions like "when did `delivered` start failing?" without leaving the browser.
32
54
 
33
55
  ## What is available
34
56
 
35
- - Saved `.mcpr`, YAML, and JSON suites
36
- - Plain-language editing
37
- - Validation without server execution
38
- - Test execution
57
+ - Creating, renaming, and editing `.mcpr` suites (YAML and JSON suites are listed and editable too)
58
+ - Syntax highlighting and grammar-aware autocomplete
59
+ - Validation without server execution, with line-anchored diagnostics
60
+ - Test execution, single file or batch
39
61
  - Transport parity execution
40
- - Terminal-style results
62
+ - Persistent run history with trends and search
41
63
  - Local evidence indexing
42
64
 
43
- ## Current candidate limits
65
+ ## Current limits
44
66
 
45
- The browser currently focuses on the core edit/validate/run/parity loop. Use the CLI for:
67
+ The browser focuses on the create/edit/validate/run loop. Use the CLI for:
46
68
 
47
69
  - guided test generation;
48
70
  - contract discovery and drift updates;
@@ -73,6 +95,7 @@ If a suite does not appear, confirm that:
73
95
 
74
96
  - it is under the selected workspace directory;
75
97
  - its extension is `.mcpr`, `.yaml`, `.yml`, or `.json`;
76
- - it is not inside `node_modules`, `.git`, or `dist`.
98
+ - it is not inside `node_modules`, `dist`, a hidden directory (such as `.git`), or deeper than six levels;
99
+ - the directory containing it is readable.
77
100
 
78
101
  For server and test failures, see [troubleshooting](TROUBLESHOOTING.md).
package/docs/README.md CHANGED
@@ -48,7 +48,7 @@ install → create .mcpr test → check → test → add CI → enable evidence
48
48
  ```
49
49
 
50
50
  ```bash
51
- npm install --save-dev mcprigor
51
+ npm install mcprigor
52
52
  npx mcprigor init tests/acceptance.mcpr
53
53
  npx mcprigor check tests/acceptance.mcpr
54
54
  npx mcprigor test tests/acceptance.mcpr --html report.html
@@ -43,6 +43,12 @@ Check that the stdio server:
43
43
 
44
44
  For HTTP, verify the URL, authentication, and server logs.
45
45
 
46
+ For token-protected endpoints:
47
+
48
+ - `Environment variable not found: QA_TOKEN` — export the variable before running, or set it in the CI step's `env:` block.
49
+ - `MCP-INIT-001 Streamable HTTP error … unauthorized` — the token was sent but rejected; check its value, expiry, and audience. The server's own response body is included in the message.
50
+ - Tokens and header values are redacted from reports and evidence automatically; do not paste them into test files to "make them visible".
51
+
46
52
  ## A field was not found
47
53
 
48
54
  Example:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcprigor",
3
- "version": "1.0.0-rc.4",
3
+ "version": "1.1.0",
4
4
  "description": "Plain-language MCP testing with isolated extensions and a local QA workspace",
5
5
  "type": "module",
6
6
  "bin": {