@mcpjam/cli 1.0.3 → 1.1.1
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/index.js +117 -52
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { config } from "dotenv";
|
|
3
3
|
import { Command as Command2 } from "commander";
|
|
4
|
+
import { createRequire as createRequire2 } from "module";
|
|
4
5
|
|
|
5
6
|
// src/evals/index.ts
|
|
6
7
|
import { Command } from "commander";
|
|
@@ -53,8 +54,8 @@ var Logger = class {
|
|
|
53
54
|
const prefix = failed === 0 ? chalk.green("\u2714") : chalk.red("\u2716");
|
|
54
55
|
this.logLine(`${prefix} ${summary}`);
|
|
55
56
|
}
|
|
56
|
-
static header(
|
|
57
|
-
this.logLine(chalk.bold.blue(`MCPJAM CLI ${
|
|
57
|
+
static header(version3) {
|
|
58
|
+
this.logLine(chalk.bold.blue(`MCPJAM CLI ${version3}`));
|
|
58
59
|
this.logLine("");
|
|
59
60
|
}
|
|
60
61
|
static serverConnection(serverCount, toolCount) {
|
|
@@ -1456,11 +1457,11 @@ function getFunctionName(functionReference) {
|
|
|
1456
1457
|
);
|
|
1457
1458
|
}
|
|
1458
1459
|
if (typeof functionReference === "string") return functionReference;
|
|
1459
|
-
const
|
|
1460
|
-
if (!
|
|
1460
|
+
const name2 = functionReference[functionName];
|
|
1461
|
+
if (!name2) {
|
|
1461
1462
|
throw new Error(`${functionReference} is not a functionReference`);
|
|
1462
1463
|
}
|
|
1463
|
-
return
|
|
1464
|
+
return name2;
|
|
1464
1465
|
}
|
|
1465
1466
|
function createApi(pathParts = []) {
|
|
1466
1467
|
const handler = {
|
|
@@ -1761,7 +1762,7 @@ var ConvexHttpClient = class {
|
|
|
1761
1762
|
return await this.queryInner(query, queryArgs, {});
|
|
1762
1763
|
}
|
|
1763
1764
|
async queryInner(query, queryArgs, options) {
|
|
1764
|
-
const
|
|
1765
|
+
const name2 = getFunctionName(query);
|
|
1765
1766
|
const args = [convexToJson(queryArgs)];
|
|
1766
1767
|
const headers = {
|
|
1767
1768
|
"Content-Type": "application/json",
|
|
@@ -1775,7 +1776,7 @@ var ConvexHttpClient = class {
|
|
|
1775
1776
|
const localFetch = specifiedFetch || fetch;
|
|
1776
1777
|
const timestamp = options.timestampPromise ? await options.timestampPromise : void 0;
|
|
1777
1778
|
const body = JSON.stringify({
|
|
1778
|
-
path:
|
|
1779
|
+
path: name2,
|
|
1779
1780
|
format: "convex_encoded_json",
|
|
1780
1781
|
args,
|
|
1781
1782
|
...timestamp ? { ts: timestamp } : {}
|
|
@@ -1793,7 +1794,7 @@ var ConvexHttpClient = class {
|
|
|
1793
1794
|
const respJSON = await response.json();
|
|
1794
1795
|
if (this.debug) {
|
|
1795
1796
|
for (const line of respJSON.logLines ?? []) {
|
|
1796
|
-
logForFunction(this.logger, "info", "query",
|
|
1797
|
+
logForFunction(this.logger, "info", "query", name2, line);
|
|
1797
1798
|
}
|
|
1798
1799
|
}
|
|
1799
1800
|
switch (respJSON.status) {
|
|
@@ -1812,9 +1813,9 @@ var ConvexHttpClient = class {
|
|
|
1812
1813
|
}
|
|
1813
1814
|
}
|
|
1814
1815
|
async mutationInner(mutation, mutationArgs) {
|
|
1815
|
-
const
|
|
1816
|
+
const name2 = getFunctionName(mutation);
|
|
1816
1817
|
const body = JSON.stringify({
|
|
1817
|
-
path:
|
|
1818
|
+
path: name2,
|
|
1818
1819
|
format: "convex_encoded_json",
|
|
1819
1820
|
args: [convexToJson(mutationArgs)]
|
|
1820
1821
|
});
|
|
@@ -1840,7 +1841,7 @@ var ConvexHttpClient = class {
|
|
|
1840
1841
|
const respJSON = await response.json();
|
|
1841
1842
|
if (this.debug) {
|
|
1842
1843
|
for (const line of respJSON.logLines ?? []) {
|
|
1843
|
-
logForFunction(this.logger, "info", "mutation",
|
|
1844
|
+
logForFunction(this.logger, "info", "mutation", name2, line);
|
|
1844
1845
|
}
|
|
1845
1846
|
}
|
|
1846
1847
|
switch (respJSON.status) {
|
|
@@ -1909,9 +1910,9 @@ var ConvexHttpClient = class {
|
|
|
1909
1910
|
*/
|
|
1910
1911
|
async action(action, ...args) {
|
|
1911
1912
|
const actionArgs = parseArgs(args[0]);
|
|
1912
|
-
const
|
|
1913
|
+
const name2 = getFunctionName(action);
|
|
1913
1914
|
const body = JSON.stringify({
|
|
1914
|
-
path:
|
|
1915
|
+
path: name2,
|
|
1915
1916
|
format: "convex_encoded_json",
|
|
1916
1917
|
args: [convexToJson(actionArgs)]
|
|
1917
1918
|
});
|
|
@@ -1937,7 +1938,7 @@ var ConvexHttpClient = class {
|
|
|
1937
1938
|
const respJSON = await response.json();
|
|
1938
1939
|
if (this.debug) {
|
|
1939
1940
|
for (const line of respJSON.logLines ?? []) {
|
|
1940
|
-
logForFunction(this.logger, "info", "action",
|
|
1941
|
+
logForFunction(this.logger, "info", "action", name2, line);
|
|
1941
1942
|
}
|
|
1942
1943
|
}
|
|
1943
1944
|
switch (respJSON.status) {
|
|
@@ -1967,10 +1968,10 @@ var ConvexHttpClient = class {
|
|
|
1967
1968
|
*/
|
|
1968
1969
|
async function(anyFunction, componentPath, ...args) {
|
|
1969
1970
|
const functionArgs = parseArgs(args[0]);
|
|
1970
|
-
const
|
|
1971
|
+
const name2 = typeof anyFunction === "string" ? anyFunction : getFunctionName(anyFunction);
|
|
1971
1972
|
const body = JSON.stringify({
|
|
1972
1973
|
componentPath,
|
|
1973
|
-
path:
|
|
1974
|
+
path: name2,
|
|
1974
1975
|
format: "convex_encoded_json",
|
|
1975
1976
|
args: convexToJson(functionArgs)
|
|
1976
1977
|
});
|
|
@@ -1996,7 +1997,7 @@ var ConvexHttpClient = class {
|
|
|
1996
1997
|
const respJSON = await response.json();
|
|
1997
1998
|
if (this.debug) {
|
|
1998
1999
|
for (const line of respJSON.logLines ?? []) {
|
|
1999
|
-
logForFunction(this.logger, "info", "any",
|
|
2000
|
+
logForFunction(this.logger, "info", "any", name2, line);
|
|
2000
2001
|
}
|
|
2001
2002
|
}
|
|
2002
2003
|
switch (respJSON.status) {
|
|
@@ -2196,8 +2197,8 @@ var require_node_gyp_build = __commonJS({
|
|
|
2196
2197
|
load.resolve = load.path = function(dir) {
|
|
2197
2198
|
dir = path.resolve(dir || ".");
|
|
2198
2199
|
try {
|
|
2199
|
-
var
|
|
2200
|
-
if (process.env[
|
|
2200
|
+
var name2 = runtimeRequire(path.join(dir, "package.json")).name.toUpperCase().replace(/-/g, "_");
|
|
2201
|
+
if (process.env[name2 + "_PREBUILD"]) dir = process.env[name2 + "_PREBUILD"];
|
|
2201
2202
|
} catch (err) {
|
|
2202
2203
|
}
|
|
2203
2204
|
if (!prebuildsOnly) {
|
|
@@ -2246,18 +2247,18 @@ var require_node_gyp_build = __commonJS({
|
|
|
2246
2247
|
var files = readdirSync(dir).filter(filter);
|
|
2247
2248
|
return files[0] && path.join(dir, files[0]);
|
|
2248
2249
|
}
|
|
2249
|
-
function matchBuild(
|
|
2250
|
-
return /\.node$/.test(
|
|
2250
|
+
function matchBuild(name2) {
|
|
2251
|
+
return /\.node$/.test(name2);
|
|
2251
2252
|
}
|
|
2252
|
-
function parseTuple(
|
|
2253
|
-
var arr2 =
|
|
2253
|
+
function parseTuple(name2) {
|
|
2254
|
+
var arr2 = name2.split("-");
|
|
2254
2255
|
if (arr2.length !== 2) return;
|
|
2255
2256
|
var platform2 = arr2[0];
|
|
2256
2257
|
var architectures = arr2[1].split("+");
|
|
2257
2258
|
if (!platform2) return;
|
|
2258
2259
|
if (!architectures.length) return;
|
|
2259
2260
|
if (!architectures.every(Boolean)) return;
|
|
2260
|
-
return { name, platform: platform2, architectures };
|
|
2261
|
+
return { name: name2, platform: platform2, architectures };
|
|
2261
2262
|
}
|
|
2262
2263
|
function matchTuple(platform2, arch2) {
|
|
2263
2264
|
return function(tuple) {
|
|
@@ -4427,9 +4428,9 @@ var require_extension = __commonJS({
|
|
|
4427
4428
|
"../common/temp/node_modules/.pnpm/ws@8.18.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ws/lib/extension.js"(exports, module) {
|
|
4428
4429
|
"use strict";
|
|
4429
4430
|
var { tokenChars } = require_validation();
|
|
4430
|
-
function push(dest,
|
|
4431
|
-
if (dest[
|
|
4432
|
-
else dest[
|
|
4431
|
+
function push(dest, name2, elem) {
|
|
4432
|
+
if (dest[name2] === void 0) dest[name2] = [elem];
|
|
4433
|
+
else dest[name2].push(elem);
|
|
4433
4434
|
}
|
|
4434
4435
|
function parse(header) {
|
|
4435
4436
|
const offers = /* @__PURE__ */ Object.create(null);
|
|
@@ -4455,12 +4456,12 @@ var require_extension = __commonJS({
|
|
|
4455
4456
|
throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
4456
4457
|
}
|
|
4457
4458
|
if (end === -1) end = i;
|
|
4458
|
-
const
|
|
4459
|
+
const name2 = header.slice(start, end);
|
|
4459
4460
|
if (code2 === 44) {
|
|
4460
|
-
push(offers,
|
|
4461
|
+
push(offers, name2, params);
|
|
4461
4462
|
params = /* @__PURE__ */ Object.create(null);
|
|
4462
4463
|
} else {
|
|
4463
|
-
extensionName =
|
|
4464
|
+
extensionName = name2;
|
|
4464
4465
|
}
|
|
4465
4466
|
start = end = -1;
|
|
4466
4467
|
} else {
|
|
@@ -5695,7 +5696,7 @@ var require_websocket_server = __commonJS({
|
|
|
5695
5696
|
socket.on("error", socketOnError);
|
|
5696
5697
|
const key = req.headers["sec-websocket-key"];
|
|
5697
5698
|
const upgrade = req.headers.upgrade;
|
|
5698
|
-
const
|
|
5699
|
+
const version3 = +req.headers["sec-websocket-version"];
|
|
5699
5700
|
if (req.method !== "GET") {
|
|
5700
5701
|
const message = "Invalid HTTP method";
|
|
5701
5702
|
abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);
|
|
@@ -5711,7 +5712,7 @@ var require_websocket_server = __commonJS({
|
|
|
5711
5712
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
5712
5713
|
return;
|
|
5713
5714
|
}
|
|
5714
|
-
if (
|
|
5715
|
+
if (version3 !== 8 && version3 !== 13) {
|
|
5715
5716
|
const message = "Missing or invalid Sec-WebSocket-Version header";
|
|
5716
5717
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
5717
5718
|
return;
|
|
@@ -5753,7 +5754,7 @@ var require_websocket_server = __commonJS({
|
|
|
5753
5754
|
}
|
|
5754
5755
|
if (this.options.verifyClient) {
|
|
5755
5756
|
const info = {
|
|
5756
|
-
origin: req.headers[`${
|
|
5757
|
+
origin: req.headers[`${version3 === 8 ? "sec-websocket-origin" : "origin"}`],
|
|
5757
5758
|
secure: !!(req.socket.authorized || req.socket.encrypted),
|
|
5758
5759
|
req
|
|
5759
5760
|
};
|
|
@@ -5946,52 +5947,52 @@ var TableDefinition = class {
|
|
|
5946
5947
|
" indexes"() {
|
|
5947
5948
|
return this.indexes;
|
|
5948
5949
|
}
|
|
5949
|
-
index(
|
|
5950
|
+
index(name2, indexConfig) {
|
|
5950
5951
|
if (Array.isArray(indexConfig)) {
|
|
5951
5952
|
this.indexes.push({
|
|
5952
|
-
indexDescriptor:
|
|
5953
|
+
indexDescriptor: name2,
|
|
5953
5954
|
fields: indexConfig
|
|
5954
5955
|
});
|
|
5955
5956
|
} else if (indexConfig.staged) {
|
|
5956
5957
|
this.stagedDbIndexes.push({
|
|
5957
|
-
indexDescriptor:
|
|
5958
|
+
indexDescriptor: name2,
|
|
5958
5959
|
fields: indexConfig.fields
|
|
5959
5960
|
});
|
|
5960
5961
|
} else {
|
|
5961
5962
|
this.indexes.push({
|
|
5962
|
-
indexDescriptor:
|
|
5963
|
+
indexDescriptor: name2,
|
|
5963
5964
|
fields: indexConfig.fields
|
|
5964
5965
|
});
|
|
5965
5966
|
}
|
|
5966
5967
|
return this;
|
|
5967
5968
|
}
|
|
5968
|
-
searchIndex(
|
|
5969
|
+
searchIndex(name2, indexConfig) {
|
|
5969
5970
|
if (indexConfig.staged) {
|
|
5970
5971
|
this.stagedSearchIndexes.push({
|
|
5971
|
-
indexDescriptor:
|
|
5972
|
+
indexDescriptor: name2,
|
|
5972
5973
|
searchField: indexConfig.searchField,
|
|
5973
5974
|
filterFields: indexConfig.filterFields || []
|
|
5974
5975
|
});
|
|
5975
5976
|
} else {
|
|
5976
5977
|
this.searchIndexes.push({
|
|
5977
|
-
indexDescriptor:
|
|
5978
|
+
indexDescriptor: name2,
|
|
5978
5979
|
searchField: indexConfig.searchField,
|
|
5979
5980
|
filterFields: indexConfig.filterFields || []
|
|
5980
5981
|
});
|
|
5981
5982
|
}
|
|
5982
5983
|
return this;
|
|
5983
5984
|
}
|
|
5984
|
-
vectorIndex(
|
|
5985
|
+
vectorIndex(name2, indexConfig) {
|
|
5985
5986
|
if (indexConfig.staged) {
|
|
5986
5987
|
this.stagedVectorIndexes.push({
|
|
5987
|
-
indexDescriptor:
|
|
5988
|
+
indexDescriptor: name2,
|
|
5988
5989
|
vectorField: indexConfig.vectorField,
|
|
5989
5990
|
dimensions: indexConfig.dimensions,
|
|
5990
5991
|
filterFields: indexConfig.filterFields || []
|
|
5991
5992
|
});
|
|
5992
5993
|
} else {
|
|
5993
5994
|
this.vectorIndexes.push({
|
|
5994
|
-
indexDescriptor:
|
|
5995
|
+
indexDescriptor: name2,
|
|
5995
5996
|
vectorField: indexConfig.vectorField,
|
|
5996
5997
|
dimensions: indexConfig.dimensions,
|
|
5997
5998
|
filterFields: indexConfig.filterFields || []
|
|
@@ -6178,7 +6179,7 @@ function validateAndNormalizeMCPClientConfiguration(value) {
|
|
|
6178
6179
|
try {
|
|
6179
6180
|
const envParsed = MCPClientOptionsSchema.parse(value);
|
|
6180
6181
|
const normalizedServers = {};
|
|
6181
|
-
for (const [
|
|
6182
|
+
for (const [name2, server] of Object.entries(envParsed.servers)) {
|
|
6182
6183
|
try {
|
|
6183
6184
|
if (server && typeof server === "object" && "url" in server) {
|
|
6184
6185
|
MastraMCPServerDefinitionSchema.parse(server);
|
|
@@ -6188,18 +6189,18 @@ function validateAndNormalizeMCPClientConfiguration(value) {
|
|
|
6188
6189
|
...server,
|
|
6189
6190
|
url: normalizedUrl
|
|
6190
6191
|
};
|
|
6191
|
-
normalizedServers[
|
|
6192
|
+
normalizedServers[name2] = normalizedServer;
|
|
6192
6193
|
} else {
|
|
6193
6194
|
MastraMCPServerDefinitionSchema.parse(server);
|
|
6194
|
-
normalizedServers[
|
|
6195
|
+
normalizedServers[name2] = server;
|
|
6195
6196
|
}
|
|
6196
6197
|
} catch (error) {
|
|
6197
6198
|
if (error instanceof z.ZodError) {
|
|
6198
6199
|
throw new Error(
|
|
6199
|
-
`Invalid server configuration for '${
|
|
6200
|
+
`Invalid server configuration for '${name2}': ${error.message}`
|
|
6200
6201
|
);
|
|
6201
6202
|
}
|
|
6202
|
-
throw new Error(`Invalid server configuration for '${
|
|
6203
|
+
throw new Error(`Invalid server configuration for '${name2}': ${error}`);
|
|
6203
6204
|
}
|
|
6204
6205
|
}
|
|
6205
6206
|
return {
|
|
@@ -6270,12 +6271,12 @@ function convertMastraToolToVercelTool(toolName, mastraTool, options) {
|
|
|
6270
6271
|
}
|
|
6271
6272
|
function convertMastraToolsToVercelTools(mastraTools) {
|
|
6272
6273
|
return Object.fromEntries(
|
|
6273
|
-
Object.entries(mastraTools).map(([
|
|
6274
|
-
const pureToolName = extractPureToolName(
|
|
6274
|
+
Object.entries(mastraTools).map(([name2, mastraTool]) => {
|
|
6275
|
+
const pureToolName = extractPureToolName(name2);
|
|
6275
6276
|
return [
|
|
6276
6277
|
pureToolName,
|
|
6277
6278
|
convertMastraToolToVercelTool(pureToolName, mastraTool, {
|
|
6278
|
-
originalName:
|
|
6279
|
+
originalName: name2
|
|
6279
6280
|
})
|
|
6280
6281
|
];
|
|
6281
6282
|
})
|
|
@@ -6488,9 +6489,73 @@ evalsCommand.description("Run MCP evaluations").command("run").description("Run
|
|
|
6488
6489
|
});
|
|
6489
6490
|
|
|
6490
6491
|
// src/index.ts
|
|
6492
|
+
import updateNotifier from "update-notifier";
|
|
6493
|
+
|
|
6494
|
+
// package.json
|
|
6495
|
+
var package_default = {
|
|
6496
|
+
name: "@mcpjam/cli",
|
|
6497
|
+
version: "1.1.1",
|
|
6498
|
+
type: "module",
|
|
6499
|
+
description: "MCPJam CLI for programmatic MCP testing and evals",
|
|
6500
|
+
license: "Apache-2.0",
|
|
6501
|
+
author: "MCPJam (https://mcpjam.com)",
|
|
6502
|
+
homepage: "https://mcpjam.com",
|
|
6503
|
+
repository: {
|
|
6504
|
+
type: "git",
|
|
6505
|
+
url: "https://github.com/MCPJam/inspector.git",
|
|
6506
|
+
directory: "cli"
|
|
6507
|
+
},
|
|
6508
|
+
main: "dist/index.js",
|
|
6509
|
+
bin: {
|
|
6510
|
+
mcpjam: "bin/mcpjam.js"
|
|
6511
|
+
},
|
|
6512
|
+
files: [
|
|
6513
|
+
"bin",
|
|
6514
|
+
"dist",
|
|
6515
|
+
"package.json",
|
|
6516
|
+
"README.md"
|
|
6517
|
+
],
|
|
6518
|
+
scripts: {
|
|
6519
|
+
build: "tsup",
|
|
6520
|
+
dev: "tsup --watch",
|
|
6521
|
+
"build-and-test": "npm run build && npm run test",
|
|
6522
|
+
test: "node bin/mcpjam.js evals run -t examples/test-servers.json -e examples/mcp-environment.json -l examples/llms.json",
|
|
6523
|
+
start: "node bin/mcpjam.js"
|
|
6524
|
+
},
|
|
6525
|
+
dependencies: {
|
|
6526
|
+
"@ai-sdk/anthropic": "^2.0.17",
|
|
6527
|
+
"@ai-sdk/openai": "^2.0.32",
|
|
6528
|
+
"@hono/node-server": "^1.13.7",
|
|
6529
|
+
"@mastra/core": "^0.13.2",
|
|
6530
|
+
"@mastra/mcp": "^0.10.12",
|
|
6531
|
+
"@modelcontextprotocol/sdk": "^1.17.3",
|
|
6532
|
+
"@openrouter/ai-sdk-provider": "^1.2.0",
|
|
6533
|
+
ai: "^5.0.11",
|
|
6534
|
+
chalk: "^5.6.0",
|
|
6535
|
+
"cli-table3": "^0.6.5",
|
|
6536
|
+
commander: "^12.0.0",
|
|
6537
|
+
dotenv: "^17.2.2",
|
|
6538
|
+
hono: "^4.6.11",
|
|
6539
|
+
"ollama-ai-provider": "^1.2.0",
|
|
6540
|
+
"update-notifier": "^7.3.1",
|
|
6541
|
+
zod: "^3.25.76"
|
|
6542
|
+
},
|
|
6543
|
+
devDependencies: {
|
|
6544
|
+
"@types/node": "^20",
|
|
6545
|
+
"@types/update-notifier": "^6.0.8",
|
|
6546
|
+
tsup: "^8.3.5",
|
|
6547
|
+
typescript: "^5"
|
|
6548
|
+
}
|
|
6549
|
+
};
|
|
6550
|
+
|
|
6551
|
+
// src/index.ts
|
|
6552
|
+
var require3 = createRequire2(import.meta.url);
|
|
6553
|
+
updateNotifier({ pkg: package_default, updateCheckInterval: 0 }).notify();
|
|
6554
|
+
var { name, version: version2 } = require3("../package.json");
|
|
6555
|
+
updateNotifier({ pkg: { name, version: version2 } }).notify();
|
|
6491
6556
|
config();
|
|
6492
6557
|
var program = new Command2();
|
|
6493
|
-
program.name("mcpjam").description("MCPJam CLI for programmatic MCP testing").version(
|
|
6558
|
+
program.name("mcpjam").description("MCPJam CLI for programmatic MCP testing").version(version2);
|
|
6494
6559
|
program.addCommand(evalsCommand);
|
|
6495
6560
|
program.parse();
|
|
6496
6561
|
//# sourceMappingURL=index.js.map
|