@gleanwork/mcp-server-tester 2.0.0-beta.1 → 2.0.0-beta.2
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/dist/cli/index.js +88 -4
- package/dist/fixtures/mcp.js +1 -1
- package/dist/fixtures/mcp.js.map +1 -1
- package/dist/index.cjs +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import * as path2 from 'path';
|
|
3
|
-
import path2__default, { resolve, join,
|
|
3
|
+
import path2__default, { resolve, join, dirname, basename, isAbsolute, posix, sep } from 'path';
|
|
4
4
|
import { pathToFileURL, fileURLToPath } from 'url';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import * as z42 from 'zod/v4';
|
|
@@ -8,7 +8,7 @@ import { ZodFirstPartyTypeKind } from 'zod/v3';
|
|
|
8
8
|
import { execFile, spawn } from 'child_process';
|
|
9
9
|
import fs4, { existsSync, readFileSync, constants, rmSync } from 'fs';
|
|
10
10
|
import * as fs from 'fs/promises';
|
|
11
|
-
import fs__default, { mkdir, writeFile, stat, readFile,
|
|
11
|
+
import fs__default, { mkdir, writeFile, stat, readFile, lstat, rename, rm, readdir, open as open$1, unlink, rmdir, realpath, mkdtemp, chmod } from 'fs/promises';
|
|
12
12
|
import { createRequire } from 'module';
|
|
13
13
|
import os, { homedir, tmpdir, userInfo } from 'os';
|
|
14
14
|
import { promisify } from 'util';
|
|
@@ -4324,6 +4324,9 @@ var init_bundle = __esm({
|
|
|
4324
4324
|
MAX_CREDENTIAL_BYTES = 64 * 1024;
|
|
4325
4325
|
}
|
|
4326
4326
|
});
|
|
4327
|
+
function macCoworkProfileDirectory() {
|
|
4328
|
+
return join(homedir(), "Library/Application Support/Claude-3p/configLibrary");
|
|
4329
|
+
}
|
|
4327
4330
|
function fail() {
|
|
4328
4331
|
throw new Error(ERROR2);
|
|
4329
4332
|
}
|
|
@@ -4739,9 +4742,69 @@ async function preflightMacCoworkSettings(options) {
|
|
|
4739
4742
|
try {
|
|
4740
4743
|
await validateInstall(options);
|
|
4741
4744
|
} catch {
|
|
4742
|
-
throw new Error(
|
|
4745
|
+
throw new Error(
|
|
4746
|
+
`${ERROR2}
|
|
4747
|
+
Run 'mst cowork setup' first if the Claude 3P profile library is missing.`
|
|
4748
|
+
);
|
|
4743
4749
|
}
|
|
4744
4750
|
}
|
|
4751
|
+
async function initializeMacCoworkProfile(profileDirectory = macCoworkProfileDirectory()) {
|
|
4752
|
+
if (process.platform !== "darwin")
|
|
4753
|
+
throw new Error("Cowork profile setup requires macOS.");
|
|
4754
|
+
const directory = resolve(profileDirectory);
|
|
4755
|
+
const parent = dirname(directory);
|
|
4756
|
+
await mkdir(parent, { recursive: true, mode: 448 });
|
|
4757
|
+
try {
|
|
4758
|
+
await validateEmptyCoworkProfile(directory);
|
|
4759
|
+
return { profileDirectory: directory, created: false };
|
|
4760
|
+
} catch {
|
|
4761
|
+
try {
|
|
4762
|
+
await lstat(directory);
|
|
4763
|
+
} catch (error) {
|
|
4764
|
+
if (error.code !== "ENOENT") throw error;
|
|
4765
|
+
const temporary = `${directory}.mst-init-${randomUUID()}`;
|
|
4766
|
+
await mkdir(temporary, { mode: 448 });
|
|
4767
|
+
const id = randomUUID();
|
|
4768
|
+
try {
|
|
4769
|
+
await writeFile(
|
|
4770
|
+
join(temporary, "_meta.json"),
|
|
4771
|
+
JSON.stringify({
|
|
4772
|
+
appliedId: id,
|
|
4773
|
+
entries: [{ id, name: "MST base" }]
|
|
4774
|
+
}) + "\n",
|
|
4775
|
+
{ mode: 384 }
|
|
4776
|
+
);
|
|
4777
|
+
await writeFile(join(temporary, `${id}.json`), "{}\n", {
|
|
4778
|
+
mode: 384
|
|
4779
|
+
});
|
|
4780
|
+
await rename(temporary, directory);
|
|
4781
|
+
return { profileDirectory: directory, created: true };
|
|
4782
|
+
} catch (setupError) {
|
|
4783
|
+
await rm(temporary, { recursive: true, force: true }).catch(() => {
|
|
4784
|
+
});
|
|
4785
|
+
if (setupError.code === "EEXIST") {
|
|
4786
|
+
await validateEmptyCoworkProfile(directory);
|
|
4787
|
+
return { profileDirectory: directory, created: false };
|
|
4788
|
+
}
|
|
4789
|
+
throw setupError;
|
|
4790
|
+
}
|
|
4791
|
+
}
|
|
4792
|
+
throw new Error(
|
|
4793
|
+
"Claude 3P profile exists but is not an empty MST-managed profile. No files were changed."
|
|
4794
|
+
);
|
|
4795
|
+
}
|
|
4796
|
+
}
|
|
4797
|
+
async function validateEmptyCoworkProfile(directory) {
|
|
4798
|
+
const original = await readBytes(join(directory, "_meta.json"));
|
|
4799
|
+
const meta = metadata(original);
|
|
4800
|
+
const source = JSON.parse(
|
|
4801
|
+
(await readBytes(join(directory, `${meta.appliedId}.json`))).toString(
|
|
4802
|
+
"utf8"
|
|
4803
|
+
)
|
|
4804
|
+
);
|
|
4805
|
+
if (typeof source !== "object" || source === null || Array.isArray(source) || Object.keys(source).length !== 0)
|
|
4806
|
+
throw new Error("Claude 3P profile is not empty.");
|
|
4807
|
+
}
|
|
4745
4808
|
async function installMacCoworkSettings(options) {
|
|
4746
4809
|
let lock;
|
|
4747
4810
|
let journal;
|
|
@@ -5312,7 +5375,7 @@ init_esm_shims();
|
|
|
5312
5375
|
|
|
5313
5376
|
// package.json
|
|
5314
5377
|
var package_default = {
|
|
5315
|
-
version: "2.0.0-beta.
|
|
5378
|
+
version: "2.0.0-beta.2"};
|
|
5316
5379
|
|
|
5317
5380
|
// src/cli/templates/index.ts
|
|
5318
5381
|
function getPlaywrightConfigTemplate(answers) {
|
|
@@ -16594,6 +16657,26 @@ Batch complete: ${result.passed} passed, ${result.failed} failed, ${result.skipp
|
|
|
16594
16657
|
if (result.failed > 0) process.exitCode = 1;
|
|
16595
16658
|
}
|
|
16596
16659
|
|
|
16660
|
+
// src/cli/commands/cowork/index.ts
|
|
16661
|
+
init_esm_shims();
|
|
16662
|
+
init_macTransaction();
|
|
16663
|
+
async function setupCowork() {
|
|
16664
|
+
const result = await initializeMacCoworkProfile();
|
|
16665
|
+
if (result.created) {
|
|
16666
|
+
console.log(
|
|
16667
|
+
`Initialized the empty Claude 3P profile at ${result.profileDirectory}.`
|
|
16668
|
+
);
|
|
16669
|
+
console.log(
|
|
16670
|
+
"Next: launch Claude Desktop, sign in, open one normal conversation, quit Claude Desktop, then run the Cowork evaluation."
|
|
16671
|
+
);
|
|
16672
|
+
} else {
|
|
16673
|
+
console.log(`Claude 3P profile is ready at ${result.profileDirectory}.`);
|
|
16674
|
+
console.log(
|
|
16675
|
+
"If Claude Desktop is not signed in, launch it and complete sign-in before running the Cowork evaluation."
|
|
16676
|
+
);
|
|
16677
|
+
}
|
|
16678
|
+
}
|
|
16679
|
+
|
|
16597
16680
|
// src/cli/index.ts
|
|
16598
16681
|
var program = new Command();
|
|
16599
16682
|
program.name("mcp-server-tester").description("CLI tools for MCP server evaluation and testing").version(package_default.version);
|
|
@@ -16633,6 +16716,7 @@ program.command("batch").description("Run multiple evaluation manifests").option
|
|
|
16633
16716
|
dryRun: options.dryRun
|
|
16634
16717
|
})
|
|
16635
16718
|
);
|
|
16719
|
+
program.command("cowork").description("Prepare the local macOS Claude 3P profile for Cowork").command("setup").description("Initialize or validate the empty Claude 3P profile").action(setupCowork);
|
|
16636
16720
|
program.command("open").description("Open the MCP eval reporter UI in your browser").option(
|
|
16637
16721
|
"-d, --dir <directory>",
|
|
16638
16722
|
"Report output directory",
|
package/dist/fixtures/mcp.js
CHANGED
|
@@ -1874,7 +1874,7 @@ var debugHttp = createDebug(`${NAMESPACE}:http`);
|
|
|
1874
1874
|
|
|
1875
1875
|
// package.json
|
|
1876
1876
|
var package_default = {
|
|
1877
|
-
version: "2.0.0-beta.
|
|
1877
|
+
version: "2.0.0-beta.2"};
|
|
1878
1878
|
var debug = createDebug("mcp-server-tester:oauth-flow");
|
|
1879
1879
|
async function generatePKCE() {
|
|
1880
1880
|
const codeVerifier = oauth.generateRandomCodeVerifier();
|