@gleanwork/mcp-server-tester 1.0.0-beta.1 → 1.0.0-beta.3
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/README.md +13 -12
- package/dist/cli/index.js +5 -2
- package/dist/fixtures/mcp.d.ts +8 -0
- package/dist/fixtures/mcp.js +17 -3
- package/dist/fixtures/mcp.js.map +1 -1
- package/dist/index.cjs +30 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -7
- package/dist/index.d.ts +9 -7
- package/dist/index.js +30 -8
- package/dist/index.js.map +1 -1
- package/dist/reporters/ui-dist/app.js +4 -4
- package/package.json +3 -3
- package/src/reporters/ui-dist/app.js +4 -4
package/README.md
CHANGED
|
@@ -30,18 +30,19 @@ Playwright tests are fast, deterministic, and designed for CI. Use them for regr
|
|
|
30
30
|
|
|
31
31
|
Available matchers:
|
|
32
32
|
|
|
33
|
-
| Matcher | Description
|
|
34
|
-
| ------------------------ |
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
33
|
+
| Matcher | Description |
|
|
34
|
+
| ------------------------ | ---------------------------------------------------- |
|
|
35
|
+
| `toMatchToolResponse` | Response exactly matches expected value (deep equal) |
|
|
36
|
+
| `toContainToolText` | Response contains expected substrings |
|
|
37
|
+
| `toMatchToolSchema` | Response validates against a Zod schema |
|
|
38
|
+
| `toMatchToolPattern` | Response matches a regex pattern |
|
|
39
|
+
| `toMatchToolSnapshot` | Response matches a saved baseline |
|
|
40
|
+
| `toBeToolError` | Response is (or is not) an error |
|
|
41
|
+
| `toHaveToolResponseSize` | Response size is within bounds |
|
|
42
|
+
| `toSatisfyToolPredicate` | Response satisfies a custom function |
|
|
43
|
+
| `toHaveToolCalls` | LLM called the expected tools |
|
|
44
|
+
| `toHaveToolCallCount` | LLM made N tool calls |
|
|
45
|
+
| `toPassToolJudge` | LLM evaluates response quality against a rubric |
|
|
45
46
|
|
|
46
47
|
## Eval Datasets
|
|
47
48
|
|
package/dist/cli/index.js
CHANGED
|
@@ -80,7 +80,7 @@ function JsonPreview({ data, maxLines = 15 }) {
|
|
|
80
80
|
|
|
81
81
|
// package.json
|
|
82
82
|
var package_default = {
|
|
83
|
-
version: "1.0.0-beta.
|
|
83
|
+
version: "1.0.0-beta.3"};
|
|
84
84
|
|
|
85
85
|
// src/cli/templates/index.ts
|
|
86
86
|
function getPlaywrightConfigTemplate(answers) {
|
|
@@ -877,7 +877,10 @@ async function createMCPClientForConfig(config, options) {
|
|
|
877
877
|
validatedConfig.connectTimeoutMs !== void 0 ? { timeout: validatedConfig.connectTimeoutMs } : void 0
|
|
878
878
|
);
|
|
879
879
|
} else if (isHttpConfig(validatedConfig)) {
|
|
880
|
-
const headers = {
|
|
880
|
+
const headers = {
|
|
881
|
+
"User-Agent": `@gleanwork/mcp-server-tester/${package_default.version}`,
|
|
882
|
+
...validatedConfig.headers
|
|
883
|
+
};
|
|
881
884
|
if (validatedConfig.auth?.clientCredentials && true) {
|
|
882
885
|
const ccConfig = validatedConfig.auth.clientCredentials;
|
|
883
886
|
const clientId = ccConfig.clientId ?? process.env["MCP_CLIENT_ID"];
|
package/dist/fixtures/mcp.d.ts
CHANGED
|
@@ -169,6 +169,14 @@ declare function toMatchToolPattern(this: {
|
|
|
169
169
|
/**
|
|
170
170
|
* Creates the toMatchToolSnapshot matcher function
|
|
171
171
|
*
|
|
172
|
+
* @remarks
|
|
173
|
+
* **Requires Playwright test context.** This matcher calls `expect(content).toMatchSnapshot()`
|
|
174
|
+
* internally, which only works inside a Playwright test (i.e., when `testInfo` is available).
|
|
175
|
+
* Calling it outside a Playwright test will throw a cryptic context error.
|
|
176
|
+
*
|
|
177
|
+
* To test sanitizer logic without a Playwright context, use the exported `applySanitizers`
|
|
178
|
+
* function directly.
|
|
179
|
+
*
|
|
172
180
|
* Note: This is an async matcher that uses Playwright's snapshot testing.
|
|
173
181
|
*/
|
|
174
182
|
declare function toMatchToolSnapshot(this: {
|
package/dist/fixtures/mcp.js
CHANGED
|
@@ -464,7 +464,18 @@ function applySanitizers(value, sanitizers) {
|
|
|
464
464
|
continue;
|
|
465
465
|
}
|
|
466
466
|
if (isRegexSanitizer(sanitizer)) {
|
|
467
|
-
|
|
467
|
+
let pattern;
|
|
468
|
+
if (sanitizer.pattern instanceof RegExp) {
|
|
469
|
+
pattern = sanitizer.pattern;
|
|
470
|
+
} else {
|
|
471
|
+
try {
|
|
472
|
+
pattern = new RegExp(sanitizer.pattern, "g");
|
|
473
|
+
} catch {
|
|
474
|
+
throw new Error(
|
|
475
|
+
`toMatchToolSnapshot: invalid regex pattern "${sanitizer.pattern}" in sanitizer`
|
|
476
|
+
);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
468
479
|
const replacement = sanitizer.replacement ?? "[SANITIZED]";
|
|
469
480
|
result = result.replace(pattern, replacement);
|
|
470
481
|
continue;
|
|
@@ -1423,7 +1434,7 @@ var debugHttp = createDebug(`${NAMESPACE}:http`);
|
|
|
1423
1434
|
|
|
1424
1435
|
// package.json
|
|
1425
1436
|
var package_default = {
|
|
1426
|
-
version: "1.0.0-beta.
|
|
1437
|
+
version: "1.0.0-beta.3"};
|
|
1427
1438
|
var debug = createDebug("mcp-server-tester:oauth-flow");
|
|
1428
1439
|
async function generatePKCE() {
|
|
1429
1440
|
const codeVerifier = oauth.generateRandomCodeVerifier();
|
|
@@ -1676,7 +1687,10 @@ async function createMCPClientForConfig(config, options) {
|
|
|
1676
1687
|
validatedConfig.connectTimeoutMs !== void 0 ? { timeout: validatedConfig.connectTimeoutMs } : void 0
|
|
1677
1688
|
);
|
|
1678
1689
|
} else if (isHttpConfig(validatedConfig)) {
|
|
1679
|
-
const headers = {
|
|
1690
|
+
const headers = {
|
|
1691
|
+
"User-Agent": `@gleanwork/mcp-server-tester/${package_default.version}`,
|
|
1692
|
+
...validatedConfig.headers
|
|
1693
|
+
};
|
|
1680
1694
|
if (validatedConfig.auth?.clientCredentials && !options?.authProvider) {
|
|
1681
1695
|
const ccConfig = validatedConfig.auth.clientCredentials;
|
|
1682
1696
|
const clientId = ccConfig.clientId ?? process.env["MCP_CLIENT_ID"];
|