@mcpc-tech/cli 0.1.51 → 0.1.52

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/server.cjs CHANGED
@@ -501,7 +501,7 @@ var require_cross_spawn = __commonJS({
501
501
  var cp = require("child_process");
502
502
  var parse2 = require_parse();
503
503
  var enoent = require_enoent();
504
- function spawn2(command, args, options) {
504
+ function spawn3(command, args, options) {
505
505
  const parsed = parse2(command, args, options);
506
506
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
507
507
  enoent.hookChildProcess(spawned, parsed);
@@ -513,8 +513,8 @@ var require_cross_spawn = __commonJS({
513
513
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
514
514
  return result;
515
515
  }
516
- module2.exports = spawn2;
517
- module2.exports.spawn = spawn2;
516
+ module2.exports = spawn3;
517
+ module2.exports.spawn = spawn3;
518
518
  module2.exports.sync = spawnSync;
519
519
  module2.exports._parse = parse2;
520
520
  module2.exports._enoent = enoent;
@@ -3869,7 +3869,7 @@ function parseArgs(args, options) {
3869
3869
  var import_promises4 = require("node:fs/promises");
3870
3870
  var import_node_os3 = require("node:os");
3871
3871
  var import_node_path6 = require("node:path");
3872
- var import_node_process3 = __toESM(require("node:process"), 1);
3872
+ var import_node_process4 = __toESM(require("node:process"), 1);
3873
3873
 
3874
3874
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/large-result.js
3875
3875
  var import_promises = require("node:fs/promises");
@@ -4430,6 +4430,152 @@ Skill path: ${meta.basePath}
4430
4430
  };
4431
4431
  }
4432
4432
 
4433
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/bash.js
4434
+ var import_node_child_process = require("node:child_process");
4435
+ var import_node_process = __toESM(require("node:process"), 1);
4436
+ var DEFAULT_MAX_BYTES = 1e5;
4437
+ var DEFAULT_MAX_LINES = 2e3;
4438
+ var DEFAULT_TIMEOUT_MS = 6e4;
4439
+ function truncateOutput(stdout, stderr, maxBytes = DEFAULT_MAX_BYTES, maxLines = DEFAULT_MAX_LINES) {
4440
+ const fullOutput = (stderr ? `STDERR:
4441
+ ${stderr}
4442
+
4443
+ STDOUT:
4444
+ ` : "") + stdout;
4445
+ const lines = fullOutput.split("\n");
4446
+ if (lines.length > maxLines) {
4447
+ const truncatedLines = lines.slice(-maxLines);
4448
+ return {
4449
+ output: `[OUTPUT TRUNCATED] Showing last ${maxLines} lines of ${lines.length} total
4450
+
4451
+ ` + truncatedLines.join("\n"),
4452
+ truncated: true
4453
+ };
4454
+ }
4455
+ if (fullOutput.length > maxBytes) {
4456
+ const truncatedBytes = fullOutput.slice(-maxBytes);
4457
+ return {
4458
+ output: `[OUTPUT TRUNCATED] Showing last ${maxBytes} bytes of ${fullOutput.length} total
4459
+
4460
+ ` + truncatedBytes,
4461
+ truncated: true
4462
+ };
4463
+ }
4464
+ return {
4465
+ output: fullOutput,
4466
+ truncated: false
4467
+ };
4468
+ }
4469
+ function executeBash(command, cwd2, timeoutMs) {
4470
+ return new Promise((resolve5) => {
4471
+ const stdout = [];
4472
+ const stderr = [];
4473
+ const proc = (0, import_node_child_process.spawn)("bash", [
4474
+ "-c",
4475
+ command
4476
+ ], {
4477
+ cwd: cwd2,
4478
+ stdio: [
4479
+ "ignore",
4480
+ "pipe",
4481
+ "pipe"
4482
+ ]
4483
+ });
4484
+ proc.stdout?.on("data", (data) => {
4485
+ stdout.push(data.toString());
4486
+ });
4487
+ proc.stderr?.on("data", (data) => {
4488
+ stderr.push(data.toString());
4489
+ });
4490
+ proc.on("close", (code) => {
4491
+ resolve5({
4492
+ stdout: stdout.join(""),
4493
+ stderr: stderr.join(""),
4494
+ exitCode: code
4495
+ });
4496
+ });
4497
+ proc.on("error", (err) => {
4498
+ resolve5({
4499
+ stdout: "",
4500
+ stderr: err.message,
4501
+ exitCode: null
4502
+ });
4503
+ });
4504
+ setTimeout(() => {
4505
+ proc.kill("SIGTERM");
4506
+ resolve5({
4507
+ stdout: stdout.join(""),
4508
+ stderr: stderr.join("") + "\n\n[TIMEOUT] Command execution timed out",
4509
+ exitCode: null
4510
+ });
4511
+ }, timeoutMs);
4512
+ });
4513
+ }
4514
+ function createBashPlugin(options = {}) {
4515
+ const { maxBytes, maxLines, timeoutMs } = {
4516
+ maxBytes: DEFAULT_MAX_BYTES,
4517
+ maxLines: DEFAULT_MAX_LINES,
4518
+ timeoutMs: DEFAULT_TIMEOUT_MS,
4519
+ ...options
4520
+ };
4521
+ let serverRef = null;
4522
+ return {
4523
+ name: "plugin-bash",
4524
+ version: "1.0.0",
4525
+ // Store server reference for tool registration
4526
+ configureServer: (server) => {
4527
+ serverRef = server;
4528
+ },
4529
+ // Register bash tool with agent name prefix
4530
+ composeStart: (context2) => {
4531
+ if (!serverRef) return;
4532
+ const agentName = context2.serverName;
4533
+ const toolName = `${agentName}__bash`;
4534
+ serverRef.tool(toolName, "Execute a bash command and return its output.\n\nUse this for:\n- Running shell commands\n- Executing scripts\n- System operations\n\nNote: Output is truncated if too large.", {
4535
+ type: "object",
4536
+ properties: {
4537
+ command: {
4538
+ type: "string",
4539
+ description: "The bash command to execute"
4540
+ },
4541
+ cwd: {
4542
+ type: "string",
4543
+ description: "Optional: Working directory for the command (defaults to current directory)"
4544
+ }
4545
+ },
4546
+ required: [
4547
+ "command"
4548
+ ]
4549
+ }, async (args) => {
4550
+ const cwd2 = args.cwd || import_node_process.default.cwd();
4551
+ const result = await executeBash(args.command, cwd2, timeoutMs);
4552
+ const { output, truncated } = truncateOutput(result.stdout, result.stderr, maxBytes, maxLines);
4553
+ let finalOutput = output;
4554
+ if (result.exitCode !== null && result.exitCode !== 0) {
4555
+ finalOutput = `[EXIT CODE: ${result.exitCode}]
4556
+ ` + finalOutput;
4557
+ }
4558
+ if (truncated) {
4559
+ finalOutput += `
4560
+
4561
+ [Note: Output was truncated]`;
4562
+ }
4563
+ return {
4564
+ content: [
4565
+ {
4566
+ type: "text",
4567
+ text: finalOutput
4568
+ }
4569
+ ],
4570
+ isError: result.exitCode !== null && result.exitCode !== 0
4571
+ };
4572
+ }, {
4573
+ internal: true
4574
+ });
4575
+ }
4576
+ };
4577
+ }
4578
+
4433
4579
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
4434
4580
  var import_plugin_code_execution = require("@mcpc-tech/plugin-code-execution");
4435
4581
 
@@ -6409,10 +6555,10 @@ function parse(content, options = {}) {
6409
6555
  }
6410
6556
 
6411
6557
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/src/markdown-loader.js
6412
- var import_node_process = __toESM(require("node:process"), 1);
6558
+ var import_node_process2 = __toESM(require("node:process"), 1);
6413
6559
  function replaceEnvVars(str2) {
6414
6560
  return str2.replace(/\$([A-Za-z_][A-Za-z0-9_]*)(?!\s*\()/g, (match, varName) => {
6415
- const value = import_node_process.default.env[varName];
6561
+ const value = import_node_process2.default.env[varName];
6416
6562
  if (value !== void 0) {
6417
6563
  return value;
6418
6564
  }
@@ -6511,18 +6657,19 @@ var defaultPlugin = markdownLoaderPlugin();
6511
6657
 
6512
6658
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
6513
6659
  var import_node_path5 = require("node:path");
6514
- var import_node_process2 = __toESM(require("node:process"), 1);
6660
+ var import_node_process3 = __toESM(require("node:process"), 1);
6515
6661
  var DEFAULT_SKILLS_PATHS = [
6516
6662
  ".agent/skills"
6517
6663
  ];
6518
6664
  var DEFAULT_CODE_EXECUTION_TIMEOUT = 3e5;
6519
6665
  function getGlobalPlugins(skillsPaths) {
6520
- const resolvedPaths = skillsPaths.map((p2) => (0, import_node_path5.resolve)(import_node_process2.default.cwd(), p2));
6666
+ const resolvedPaths = skillsPaths.map((p2) => (0, import_node_path5.resolve)(import_node_process3.default.cwd(), p2));
6521
6667
  return [
6522
6668
  markdownLoaderPlugin(),
6523
6669
  createSkillsPlugin({
6524
6670
  paths: resolvedPaths
6525
- })
6671
+ }),
6672
+ createBashPlugin()
6526
6673
  ];
6527
6674
  }
6528
6675
  function getAgentPlugins() {
@@ -6551,7 +6698,7 @@ function getDefaultAgents() {
6551
6698
  }
6552
6699
 
6553
6700
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
6554
- var CLI_VERSION = "0.1.51";
6701
+ var CLI_VERSION = "0.1.52";
6555
6702
  function extractServerName(command, commandArgs) {
6556
6703
  for (const arg of commandArgs) {
6557
6704
  if (!arg.startsWith("-")) {
@@ -6611,7 +6758,7 @@ async function saveUserConfig(config, newAgentName) {
6611
6758
  async function createWrapConfig(args) {
6612
6759
  if (!args.mcpServers || args.mcpServers.length === 0) {
6613
6760
  console.error("Error: --wrap/--add requires at least one MCP server\nExample: mcpc --wrap --mcp-stdio 'npx -y @wonderwhy-er/desktop-commander'\nMultiple: mcpc --add --mcp-stdio 'npx -y server1' --mcp-http 'https://api.example.com'");
6614
- import_node_process3.default.exit(1);
6761
+ import_node_process4.default.exit(1);
6615
6762
  }
6616
6763
  const mcpServers = {};
6617
6764
  const serverNames = [];
@@ -6734,7 +6881,7 @@ function parseMcpServer(cmdString, transportType) {
6734
6881
  };
6735
6882
  }
6736
6883
  function parseCLIArgs() {
6737
- const args = parseArgs(import_node_process3.default.argv.slice(2), {
6884
+ const args = parseArgs(import_node_process4.default.argv.slice(2), {
6738
6885
  boolean: [
6739
6886
  "help",
6740
6887
  "version",
@@ -6823,15 +6970,15 @@ async function loadConfig() {
6823
6970
  const args = parseCLIArgs();
6824
6971
  if (args.version) {
6825
6972
  printVersion();
6826
- import_node_process3.default.exit(0);
6973
+ import_node_process4.default.exit(0);
6827
6974
  }
6828
6975
  if (args.help) {
6829
6976
  printHelp();
6830
- import_node_process3.default.exit(0);
6977
+ import_node_process4.default.exit(0);
6831
6978
  }
6832
6979
  if (args.cwd) {
6833
- const targetCwd = (0, import_node_path6.resolve)(import_node_process3.default.cwd(), args.cwd);
6834
- import_node_process3.default.chdir(targetCwd);
6980
+ const targetCwd = (0, import_node_path6.resolve)(import_node_process4.default.cwd(), args.cwd);
6981
+ import_node_process4.default.chdir(targetCwd);
6835
6982
  console.error(`Changed working directory to: ${targetCwd}`);
6836
6983
  }
6837
6984
  const mergeSkills = (config) => {
@@ -6843,7 +6990,7 @@ async function loadConfig() {
6843
6990
  ...args,
6844
6991
  saveConfig: true
6845
6992
  });
6846
- import_node_process3.default.exit(0);
6993
+ import_node_process4.default.exit(0);
6847
6994
  }
6848
6995
  if (args.wrap) {
6849
6996
  return mergeSkills(await createWrapConfig({
@@ -6860,16 +7007,16 @@ async function loadConfig() {
6860
7007
  throw error;
6861
7008
  }
6862
7009
  }
6863
- if (import_node_process3.default.env.MCPC_CONFIG) {
7010
+ if (import_node_process4.default.env.MCPC_CONFIG) {
6864
7011
  try {
6865
- const parsed = JSON.parse(import_node_process3.default.env.MCPC_CONFIG);
7012
+ const parsed = JSON.parse(import_node_process4.default.env.MCPC_CONFIG);
6866
7013
  return mergeSkills(applyModeOverride(normalizeConfig(parsed), args.mode));
6867
7014
  } catch (error) {
6868
7015
  console.error("Failed to parse MCPC_CONFIG environment variable:", error);
6869
7016
  throw error;
6870
7017
  }
6871
7018
  }
6872
- const configUrl = args.configUrl || import_node_process3.default.env.MCPC_CONFIG_URL;
7019
+ const configUrl = args.configUrl || import_node_process4.default.env.MCPC_CONFIG_URL;
6873
7020
  if (configUrl) {
6874
7021
  try {
6875
7022
  const headers = {
@@ -6890,7 +7037,7 @@ async function loadConfig() {
6890
7037
  throw error;
6891
7038
  }
6892
7039
  }
6893
- const configFile = args.configFile || import_node_process3.default.env.MCPC_CONFIG_FILE;
7040
+ const configFile = args.configFile || import_node_process4.default.env.MCPC_CONFIG_FILE;
6894
7041
  if (configFile) {
6895
7042
  try {
6896
7043
  const config = await loadConfigFromFile(configFile);
@@ -6915,7 +7062,7 @@ async function loadConfig() {
6915
7062
  throw error;
6916
7063
  }
6917
7064
  }
6918
- const defaultJsonConfigPath = (0, import_node_path6.resolve)(import_node_process3.default.cwd(), "mcpc.config.json");
7065
+ const defaultJsonConfigPath = (0, import_node_path6.resolve)(import_node_process4.default.cwd(), "mcpc.config.json");
6919
7066
  try {
6920
7067
  const config = await loadConfigFromFile(defaultJsonConfigPath);
6921
7068
  return mergeSkills(applyModeOverride(config, args.mode));
@@ -6930,7 +7077,7 @@ async function loadConfig() {
6930
7077
  }
6931
7078
  function replaceEnvVars2(str2) {
6932
7079
  return str2.replace(/\$([A-Z_][A-Z0-9_]*)/g, (_match, varName) => {
6933
- return import_node_process3.default.env[varName] || "";
7080
+ return import_node_process4.default.env[varName] || "";
6934
7081
  });
6935
7082
  }
6936
7083
  function isMarkdownFile2(path) {
@@ -9561,7 +9708,7 @@ var Client = class extends Protocol {
9561
9708
 
9562
9709
  // __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
9563
9710
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
9564
- var import_node_process4 = __toESM(require("node:process"), 1);
9711
+ var import_node_process5 = __toESM(require("node:process"), 1);
9565
9712
  var import_node_stream = require("node:stream");
9566
9713
 
9567
9714
  // __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
@@ -9593,7 +9740,7 @@ function serializeMessage(message) {
9593
9740
  }
9594
9741
 
9595
9742
  // __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
9596
- var DEFAULT_INHERITED_ENV_VARS = import_node_process4.default.platform === "win32" ? [
9743
+ var DEFAULT_INHERITED_ENV_VARS = import_node_process5.default.platform === "win32" ? [
9597
9744
  "APPDATA",
9598
9745
  "HOMEDRIVE",
9599
9746
  "HOMEPATH",
@@ -9613,7 +9760,7 @@ var DEFAULT_INHERITED_ENV_VARS = import_node_process4.default.platform === "win3
9613
9760
  function getDefaultEnvironment() {
9614
9761
  const env = {};
9615
9762
  for (const key of DEFAULT_INHERITED_ENV_VARS) {
9616
- const value = import_node_process4.default.env[key];
9763
+ const value = import_node_process5.default.env[key];
9617
9764
  if (value === void 0) {
9618
9765
  continue;
9619
9766
  }
@@ -9649,7 +9796,7 @@ var StdioClientTransport = class {
9649
9796
  },
9650
9797
  stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
9651
9798
  shell: false,
9652
- windowsHide: import_node_process4.default.platform === "win32" && isElectron(),
9799
+ windowsHide: import_node_process5.default.platform === "win32" && isElectron(),
9653
9800
  cwd: this._serverParams.cwd
9654
9801
  });
9655
9802
  this._process.on("error", (error) => {
@@ -9757,7 +9904,7 @@ var StdioClientTransport = class {
9757
9904
  }
9758
9905
  };
9759
9906
  function isElectron() {
9760
- return "type" in import_node_process4.default;
9907
+ return "type" in import_node_process5.default;
9761
9908
  }
9762
9909
 
9763
9910
  // __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
@@ -11681,8 +11828,8 @@ var InMemoryTransport = class _InMemoryTransport {
11681
11828
  };
11682
11829
 
11683
11830
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js
11684
- var import_node_process5 = __toESM(require("node:process"), 1);
11685
- var GEMINI_PREFERRED_FORMAT = import_node_process5.default.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
11831
+ var import_node_process6 = __toESM(require("node:process"), 1);
11832
+ var GEMINI_PREFERRED_FORMAT = import_node_process6.default.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
11686
11833
 
11687
11834
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js
11688
11835
  var import_jsonrepair2 = require("jsonrepair");
@@ -11754,8 +11901,8 @@ var cleanToolSchema = (schema) => {
11754
11901
  };
11755
11902
 
11756
11903
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
11757
- var import_node_process6 = require("node:process");
11758
- var import_node_process7 = __toESM(require("node:process"), 1);
11904
+ var import_node_process7 = require("node:process");
11905
+ var import_node_process8 = __toESM(require("node:process"), 1);
11759
11906
  var import_node_crypto = require("node:crypto");
11760
11907
  function createTransport(def) {
11761
11908
  const defAny = def;
@@ -11796,10 +11943,10 @@ function createTransport(def) {
11796
11943
  command: defAny.command,
11797
11944
  args: defAny.args,
11798
11945
  env: {
11799
- ...import_node_process7.default.env,
11946
+ ...import_node_process8.default.env,
11800
11947
  ...defAny.env ?? {}
11801
11948
  },
11802
- cwd: (0, import_node_process6.cwd)()
11949
+ cwd: (0, import_node_process7.cwd)()
11803
11950
  });
11804
11951
  }
11805
11952
  throw new Error(`Unsupported transport configuration: ${JSON.stringify(def)}`);
@@ -12446,7 +12593,7 @@ function endSpan(span, error) {
12446
12593
  }
12447
12594
 
12448
12595
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-executor.js
12449
- var import_node_process8 = __toESM(require("node:process"), 1);
12596
+ var import_node_process9 = __toESM(require("node:process"), 1);
12450
12597
  var AgenticExecutor = class {
12451
12598
  name;
12452
12599
  allToolNames;
@@ -12466,13 +12613,13 @@ var AgenticExecutor = class {
12466
12613
  this.logger = createLogger(`mcpc.agentic.${name}`, server);
12467
12614
  this.toolSchemaMap = new Map(toolNameToDetailList);
12468
12615
  try {
12469
- this.tracingEnabled = import_node_process8.default.env.MCPC_TRACING_ENABLED === "true";
12616
+ this.tracingEnabled = import_node_process9.default.env.MCPC_TRACING_ENABLED === "true";
12470
12617
  if (this.tracingEnabled) {
12471
12618
  initializeTracing({
12472
12619
  enabled: true,
12473
12620
  serviceName: `mcpc-agentic-${name}`,
12474
- exportTo: import_node_process8.default.env.MCPC_TRACING_EXPORT ?? "otlp",
12475
- otlpEndpoint: import_node_process8.default.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
12621
+ exportTo: import_node_process9.default.env.MCPC_TRACING_EXPORT ?? "otlp",
12622
+ otlpEndpoint: import_node_process9.default.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
12476
12623
  });
12477
12624
  }
12478
12625
  } catch {
@@ -15187,12 +15334,12 @@ var ComposableMCPServer = class extends Server {
15187
15334
  };
15188
15335
 
15189
15336
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/env.js
15190
- var import_node_process9 = __toESM(require("node:process"), 1);
15191
- var isSCF = () => Boolean(import_node_process9.default.env.SCF_RUNTIME || import_node_process9.default.env.PROD_SCF);
15337
+ var import_node_process10 = __toESM(require("node:process"), 1);
15338
+ var isSCF = () => Boolean(import_node_process10.default.env.SCF_RUNTIME || import_node_process10.default.env.PROD_SCF);
15192
15339
  if (isSCF()) {
15193
15340
  console.log({
15194
15341
  isSCF: isSCF(),
15195
- SCF_RUNTIME: import_node_process9.default.env.SCF_RUNTIME
15342
+ SCF_RUNTIME: import_node_process10.default.env.SCF_RUNTIME
15196
15343
  });
15197
15344
  }
15198
15345
 
@@ -15274,8 +15421,8 @@ var createApp = (config) => {
15274
15421
  };
15275
15422
 
15276
15423
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/server.ts
15277
- var import_node_process10 = __toESM(require("node:process"), 1);
15278
- var port = Number(import_node_process10.default.env.PORT || "3002");
15424
+ var import_node_process11 = __toESM(require("node:process"), 1);
15425
+ var port = Number(import_node_process11.default.env.PORT || "3002");
15279
15426
  var hostname = "0.0.0.0";
15280
15427
  async function main() {
15281
15428
  const config = await loadConfig();