@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/index.cjs CHANGED
@@ -506,7 +506,7 @@ var require_cross_spawn = __commonJS({
506
506
  var cp = require("child_process");
507
507
  var parse2 = require_parse();
508
508
  var enoent = require_enoent();
509
- function spawn2(command, args, options) {
509
+ function spawn3(command, args, options) {
510
510
  const parsed = parse2(command, args, options);
511
511
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
512
512
  enoent.hookChildProcess(spawned, parsed);
@@ -518,8 +518,8 @@ var require_cross_spawn = __commonJS({
518
518
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
519
519
  return result;
520
520
  }
521
- module2.exports = spawn2;
522
- module2.exports.spawn = spawn2;
521
+ module2.exports = spawn3;
522
+ module2.exports.spawn = spawn3;
523
523
  module2.exports.sync = spawnSync;
524
524
  module2.exports._parse = parse2;
525
525
  module2.exports._enoent = enoent;
@@ -3881,7 +3881,7 @@ function parseArgs(args, options) {
3881
3881
  var import_promises4 = require("node:fs/promises");
3882
3882
  var import_node_os3 = require("node:os");
3883
3883
  var import_node_path6 = require("node:path");
3884
- var import_node_process3 = __toESM(require("node:process"), 1);
3884
+ var import_node_process4 = __toESM(require("node:process"), 1);
3885
3885
 
3886
3886
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/large-result.js
3887
3887
  var import_promises = require("node:fs/promises");
@@ -4442,6 +4442,152 @@ Skill path: ${meta.basePath}
4442
4442
  };
4443
4443
  }
4444
4444
 
4445
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/bash.js
4446
+ var import_node_child_process = require("node:child_process");
4447
+ var import_node_process = __toESM(require("node:process"), 1);
4448
+ var DEFAULT_MAX_BYTES = 1e5;
4449
+ var DEFAULT_MAX_LINES = 2e3;
4450
+ var DEFAULT_TIMEOUT_MS = 6e4;
4451
+ function truncateOutput(stdout, stderr, maxBytes = DEFAULT_MAX_BYTES, maxLines = DEFAULT_MAX_LINES) {
4452
+ const fullOutput = (stderr ? `STDERR:
4453
+ ${stderr}
4454
+
4455
+ STDOUT:
4456
+ ` : "") + stdout;
4457
+ const lines = fullOutput.split("\n");
4458
+ if (lines.length > maxLines) {
4459
+ const truncatedLines = lines.slice(-maxLines);
4460
+ return {
4461
+ output: `[OUTPUT TRUNCATED] Showing last ${maxLines} lines of ${lines.length} total
4462
+
4463
+ ` + truncatedLines.join("\n"),
4464
+ truncated: true
4465
+ };
4466
+ }
4467
+ if (fullOutput.length > maxBytes) {
4468
+ const truncatedBytes = fullOutput.slice(-maxBytes);
4469
+ return {
4470
+ output: `[OUTPUT TRUNCATED] Showing last ${maxBytes} bytes of ${fullOutput.length} total
4471
+
4472
+ ` + truncatedBytes,
4473
+ truncated: true
4474
+ };
4475
+ }
4476
+ return {
4477
+ output: fullOutput,
4478
+ truncated: false
4479
+ };
4480
+ }
4481
+ function executeBash(command, cwd2, timeoutMs) {
4482
+ return new Promise((resolve5) => {
4483
+ const stdout = [];
4484
+ const stderr = [];
4485
+ const proc = (0, import_node_child_process.spawn)("bash", [
4486
+ "-c",
4487
+ command
4488
+ ], {
4489
+ cwd: cwd2,
4490
+ stdio: [
4491
+ "ignore",
4492
+ "pipe",
4493
+ "pipe"
4494
+ ]
4495
+ });
4496
+ proc.stdout?.on("data", (data) => {
4497
+ stdout.push(data.toString());
4498
+ });
4499
+ proc.stderr?.on("data", (data) => {
4500
+ stderr.push(data.toString());
4501
+ });
4502
+ proc.on("close", (code) => {
4503
+ resolve5({
4504
+ stdout: stdout.join(""),
4505
+ stderr: stderr.join(""),
4506
+ exitCode: code
4507
+ });
4508
+ });
4509
+ proc.on("error", (err) => {
4510
+ resolve5({
4511
+ stdout: "",
4512
+ stderr: err.message,
4513
+ exitCode: null
4514
+ });
4515
+ });
4516
+ setTimeout(() => {
4517
+ proc.kill("SIGTERM");
4518
+ resolve5({
4519
+ stdout: stdout.join(""),
4520
+ stderr: stderr.join("") + "\n\n[TIMEOUT] Command execution timed out",
4521
+ exitCode: null
4522
+ });
4523
+ }, timeoutMs);
4524
+ });
4525
+ }
4526
+ function createBashPlugin(options = {}) {
4527
+ const { maxBytes, maxLines, timeoutMs } = {
4528
+ maxBytes: DEFAULT_MAX_BYTES,
4529
+ maxLines: DEFAULT_MAX_LINES,
4530
+ timeoutMs: DEFAULT_TIMEOUT_MS,
4531
+ ...options
4532
+ };
4533
+ let serverRef = null;
4534
+ return {
4535
+ name: "plugin-bash",
4536
+ version: "1.0.0",
4537
+ // Store server reference for tool registration
4538
+ configureServer: (server) => {
4539
+ serverRef = server;
4540
+ },
4541
+ // Register bash tool with agent name prefix
4542
+ composeStart: (context2) => {
4543
+ if (!serverRef) return;
4544
+ const agentName = context2.serverName;
4545
+ const toolName = `${agentName}__bash`;
4546
+ 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.", {
4547
+ type: "object",
4548
+ properties: {
4549
+ command: {
4550
+ type: "string",
4551
+ description: "The bash command to execute"
4552
+ },
4553
+ cwd: {
4554
+ type: "string",
4555
+ description: "Optional: Working directory for the command (defaults to current directory)"
4556
+ }
4557
+ },
4558
+ required: [
4559
+ "command"
4560
+ ]
4561
+ }, async (args) => {
4562
+ const cwd2 = args.cwd || import_node_process.default.cwd();
4563
+ const result = await executeBash(args.command, cwd2, timeoutMs);
4564
+ const { output, truncated } = truncateOutput(result.stdout, result.stderr, maxBytes, maxLines);
4565
+ let finalOutput = output;
4566
+ if (result.exitCode !== null && result.exitCode !== 0) {
4567
+ finalOutput = `[EXIT CODE: ${result.exitCode}]
4568
+ ` + finalOutput;
4569
+ }
4570
+ if (truncated) {
4571
+ finalOutput += `
4572
+
4573
+ [Note: Output was truncated]`;
4574
+ }
4575
+ return {
4576
+ content: [
4577
+ {
4578
+ type: "text",
4579
+ text: finalOutput
4580
+ }
4581
+ ],
4582
+ isError: result.exitCode !== null && result.exitCode !== 0
4583
+ };
4584
+ }, {
4585
+ internal: true
4586
+ });
4587
+ }
4588
+ };
4589
+ }
4590
+
4445
4591
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
4446
4592
  var import_plugin_code_execution = require("@mcpc-tech/plugin-code-execution");
4447
4593
 
@@ -6421,10 +6567,10 @@ function parse(content, options = {}) {
6421
6567
  }
6422
6568
 
6423
6569
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/src/markdown-loader.js
6424
- var import_node_process = __toESM(require("node:process"), 1);
6570
+ var import_node_process2 = __toESM(require("node:process"), 1);
6425
6571
  function replaceEnvVars(str2) {
6426
6572
  return str2.replace(/\$([A-Za-z_][A-Za-z0-9_]*)(?!\s*\()/g, (match, varName) => {
6427
- const value = import_node_process.default.env[varName];
6573
+ const value = import_node_process2.default.env[varName];
6428
6574
  if (value !== void 0) {
6429
6575
  return value;
6430
6576
  }
@@ -6523,18 +6669,19 @@ var defaultPlugin = markdownLoaderPlugin();
6523
6669
 
6524
6670
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
6525
6671
  var import_node_path5 = require("node:path");
6526
- var import_node_process2 = __toESM(require("node:process"), 1);
6672
+ var import_node_process3 = __toESM(require("node:process"), 1);
6527
6673
  var DEFAULT_SKILLS_PATHS = [
6528
6674
  ".agent/skills"
6529
6675
  ];
6530
6676
  var DEFAULT_CODE_EXECUTION_TIMEOUT = 3e5;
6531
6677
  function getGlobalPlugins(skillsPaths) {
6532
- const resolvedPaths = skillsPaths.map((p2) => (0, import_node_path5.resolve)(import_node_process2.default.cwd(), p2));
6678
+ const resolvedPaths = skillsPaths.map((p2) => (0, import_node_path5.resolve)(import_node_process3.default.cwd(), p2));
6533
6679
  return [
6534
6680
  markdownLoaderPlugin(),
6535
6681
  createSkillsPlugin({
6536
6682
  paths: resolvedPaths
6537
- })
6683
+ }),
6684
+ createBashPlugin()
6538
6685
  ];
6539
6686
  }
6540
6687
  function getAgentPlugins() {
@@ -6563,7 +6710,7 @@ function getDefaultAgents() {
6563
6710
  }
6564
6711
 
6565
6712
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
6566
- var CLI_VERSION = "0.1.51";
6713
+ var CLI_VERSION = "0.1.52";
6567
6714
  function extractServerName(command, commandArgs) {
6568
6715
  for (const arg of commandArgs) {
6569
6716
  if (!arg.startsWith("-")) {
@@ -6623,7 +6770,7 @@ async function saveUserConfig(config, newAgentName) {
6623
6770
  async function createWrapConfig(args) {
6624
6771
  if (!args.mcpServers || args.mcpServers.length === 0) {
6625
6772
  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'");
6626
- import_node_process3.default.exit(1);
6773
+ import_node_process4.default.exit(1);
6627
6774
  }
6628
6775
  const mcpServers = {};
6629
6776
  const serverNames = [];
@@ -6746,7 +6893,7 @@ function parseMcpServer(cmdString, transportType) {
6746
6893
  };
6747
6894
  }
6748
6895
  function parseCLIArgs() {
6749
- const args = parseArgs(import_node_process3.default.argv.slice(2), {
6896
+ const args = parseArgs(import_node_process4.default.argv.slice(2), {
6750
6897
  boolean: [
6751
6898
  "help",
6752
6899
  "version",
@@ -6835,15 +6982,15 @@ async function loadConfig() {
6835
6982
  const args = parseCLIArgs();
6836
6983
  if (args.version) {
6837
6984
  printVersion();
6838
- import_node_process3.default.exit(0);
6985
+ import_node_process4.default.exit(0);
6839
6986
  }
6840
6987
  if (args.help) {
6841
6988
  printHelp();
6842
- import_node_process3.default.exit(0);
6989
+ import_node_process4.default.exit(0);
6843
6990
  }
6844
6991
  if (args.cwd) {
6845
- const targetCwd = (0, import_node_path6.resolve)(import_node_process3.default.cwd(), args.cwd);
6846
- import_node_process3.default.chdir(targetCwd);
6992
+ const targetCwd = (0, import_node_path6.resolve)(import_node_process4.default.cwd(), args.cwd);
6993
+ import_node_process4.default.chdir(targetCwd);
6847
6994
  console.error(`Changed working directory to: ${targetCwd}`);
6848
6995
  }
6849
6996
  const mergeSkills = (config) => {
@@ -6855,7 +7002,7 @@ async function loadConfig() {
6855
7002
  ...args,
6856
7003
  saveConfig: true
6857
7004
  });
6858
- import_node_process3.default.exit(0);
7005
+ import_node_process4.default.exit(0);
6859
7006
  }
6860
7007
  if (args.wrap) {
6861
7008
  return mergeSkills(await createWrapConfig({
@@ -6872,16 +7019,16 @@ async function loadConfig() {
6872
7019
  throw error;
6873
7020
  }
6874
7021
  }
6875
- if (import_node_process3.default.env.MCPC_CONFIG) {
7022
+ if (import_node_process4.default.env.MCPC_CONFIG) {
6876
7023
  try {
6877
- const parsed = JSON.parse(import_node_process3.default.env.MCPC_CONFIG);
7024
+ const parsed = JSON.parse(import_node_process4.default.env.MCPC_CONFIG);
6878
7025
  return mergeSkills(applyModeOverride(normalizeConfig(parsed), args.mode));
6879
7026
  } catch (error) {
6880
7027
  console.error("Failed to parse MCPC_CONFIG environment variable:", error);
6881
7028
  throw error;
6882
7029
  }
6883
7030
  }
6884
- const configUrl = args.configUrl || import_node_process3.default.env.MCPC_CONFIG_URL;
7031
+ const configUrl = args.configUrl || import_node_process4.default.env.MCPC_CONFIG_URL;
6885
7032
  if (configUrl) {
6886
7033
  try {
6887
7034
  const headers = {
@@ -6902,7 +7049,7 @@ async function loadConfig() {
6902
7049
  throw error;
6903
7050
  }
6904
7051
  }
6905
- const configFile = args.configFile || import_node_process3.default.env.MCPC_CONFIG_FILE;
7052
+ const configFile = args.configFile || import_node_process4.default.env.MCPC_CONFIG_FILE;
6906
7053
  if (configFile) {
6907
7054
  try {
6908
7055
  const config = await loadConfigFromFile(configFile);
@@ -6927,7 +7074,7 @@ async function loadConfig() {
6927
7074
  throw error;
6928
7075
  }
6929
7076
  }
6930
- const defaultJsonConfigPath = (0, import_node_path6.resolve)(import_node_process3.default.cwd(), "mcpc.config.json");
7077
+ const defaultJsonConfigPath = (0, import_node_path6.resolve)(import_node_process4.default.cwd(), "mcpc.config.json");
6931
7078
  try {
6932
7079
  const config = await loadConfigFromFile(defaultJsonConfigPath);
6933
7080
  return mergeSkills(applyModeOverride(config, args.mode));
@@ -6942,7 +7089,7 @@ async function loadConfig() {
6942
7089
  }
6943
7090
  function replaceEnvVars2(str2) {
6944
7091
  return str2.replace(/\$([A-Z_][A-Z0-9_]*)/g, (_match, varName) => {
6945
- return import_node_process3.default.env[varName] || "";
7092
+ return import_node_process4.default.env[varName] || "";
6946
7093
  });
6947
7094
  }
6948
7095
  function isMarkdownFile2(path) {
@@ -9584,7 +9731,7 @@ var Client = class extends Protocol {
9584
9731
 
9585
9732
  // __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
9586
9733
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
9587
- var import_node_process4 = __toESM(require("node:process"), 1);
9734
+ var import_node_process5 = __toESM(require("node:process"), 1);
9588
9735
  var import_node_stream = require("node:stream");
9589
9736
 
9590
9737
  // __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
@@ -9616,7 +9763,7 @@ function serializeMessage(message) {
9616
9763
  }
9617
9764
 
9618
9765
  // __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
9619
- var DEFAULT_INHERITED_ENV_VARS = import_node_process4.default.platform === "win32" ? [
9766
+ var DEFAULT_INHERITED_ENV_VARS = import_node_process5.default.platform === "win32" ? [
9620
9767
  "APPDATA",
9621
9768
  "HOMEDRIVE",
9622
9769
  "HOMEPATH",
@@ -9636,7 +9783,7 @@ var DEFAULT_INHERITED_ENV_VARS = import_node_process4.default.platform === "win3
9636
9783
  function getDefaultEnvironment() {
9637
9784
  const env = {};
9638
9785
  for (const key of DEFAULT_INHERITED_ENV_VARS) {
9639
- const value = import_node_process4.default.env[key];
9786
+ const value = import_node_process5.default.env[key];
9640
9787
  if (value === void 0) {
9641
9788
  continue;
9642
9789
  }
@@ -9672,7 +9819,7 @@ var StdioClientTransport = class {
9672
9819
  },
9673
9820
  stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
9674
9821
  shell: false,
9675
- windowsHide: import_node_process4.default.platform === "win32" && isElectron(),
9822
+ windowsHide: import_node_process5.default.platform === "win32" && isElectron(),
9676
9823
  cwd: this._serverParams.cwd
9677
9824
  });
9678
9825
  this._process.on("error", (error) => {
@@ -9780,7 +9927,7 @@ var StdioClientTransport = class {
9780
9927
  }
9781
9928
  };
9782
9929
  function isElectron() {
9783
- return "type" in import_node_process4.default;
9930
+ return "type" in import_node_process5.default;
9784
9931
  }
9785
9932
 
9786
9933
  // __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
@@ -11704,8 +11851,8 @@ var InMemoryTransport = class _InMemoryTransport {
11704
11851
  };
11705
11852
 
11706
11853
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js
11707
- var import_node_process5 = __toESM(require("node:process"), 1);
11708
- var GEMINI_PREFERRED_FORMAT = import_node_process5.default.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
11854
+ var import_node_process6 = __toESM(require("node:process"), 1);
11855
+ var GEMINI_PREFERRED_FORMAT = import_node_process6.default.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
11709
11856
 
11710
11857
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js
11711
11858
  var import_jsonrepair2 = require("jsonrepair");
@@ -11777,8 +11924,8 @@ var cleanToolSchema = (schema) => {
11777
11924
  };
11778
11925
 
11779
11926
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
11780
- var import_node_process6 = require("node:process");
11781
- var import_node_process7 = __toESM(require("node:process"), 1);
11927
+ var import_node_process7 = require("node:process");
11928
+ var import_node_process8 = __toESM(require("node:process"), 1);
11782
11929
  var import_node_crypto = require("node:crypto");
11783
11930
  function createTransport(def) {
11784
11931
  const defAny = def;
@@ -11819,10 +11966,10 @@ function createTransport(def) {
11819
11966
  command: defAny.command,
11820
11967
  args: defAny.args,
11821
11968
  env: {
11822
- ...import_node_process7.default.env,
11969
+ ...import_node_process8.default.env,
11823
11970
  ...defAny.env ?? {}
11824
11971
  },
11825
- cwd: (0, import_node_process6.cwd)()
11972
+ cwd: (0, import_node_process7.cwd)()
11826
11973
  });
11827
11974
  }
11828
11975
  throw new Error(`Unsupported transport configuration: ${JSON.stringify(def)}`);
@@ -12469,7 +12616,7 @@ function endSpan(span, error) {
12469
12616
  }
12470
12617
 
12471
12618
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-executor.js
12472
- var import_node_process8 = __toESM(require("node:process"), 1);
12619
+ var import_node_process9 = __toESM(require("node:process"), 1);
12473
12620
  var AgenticExecutor = class {
12474
12621
  name;
12475
12622
  allToolNames;
@@ -12489,13 +12636,13 @@ var AgenticExecutor = class {
12489
12636
  this.logger = createLogger(`mcpc.agentic.${name}`, server);
12490
12637
  this.toolSchemaMap = new Map(toolNameToDetailList);
12491
12638
  try {
12492
- this.tracingEnabled = import_node_process8.default.env.MCPC_TRACING_ENABLED === "true";
12639
+ this.tracingEnabled = import_node_process9.default.env.MCPC_TRACING_ENABLED === "true";
12493
12640
  if (this.tracingEnabled) {
12494
12641
  initializeTracing({
12495
12642
  enabled: true,
12496
12643
  serviceName: `mcpc-agentic-${name}`,
12497
- exportTo: import_node_process8.default.env.MCPC_TRACING_EXPORT ?? "otlp",
12498
- otlpEndpoint: import_node_process8.default.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
12644
+ exportTo: import_node_process9.default.env.MCPC_TRACING_EXPORT ?? "otlp",
12645
+ otlpEndpoint: import_node_process9.default.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
12499
12646
  });
12500
12647
  }
12501
12648
  } catch {
@@ -15210,12 +15357,12 @@ var ComposableMCPServer = class extends Server {
15210
15357
  };
15211
15358
 
15212
15359
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/env.js
15213
- var import_node_process9 = __toESM(require("node:process"), 1);
15214
- var isSCF = () => Boolean(import_node_process9.default.env.SCF_RUNTIME || import_node_process9.default.env.PROD_SCF);
15360
+ var import_node_process10 = __toESM(require("node:process"), 1);
15361
+ var isSCF = () => Boolean(import_node_process10.default.env.SCF_RUNTIME || import_node_process10.default.env.PROD_SCF);
15215
15362
  if (isSCF()) {
15216
15363
  console.log({
15217
15364
  isSCF: isSCF(),
15218
- SCF_RUNTIME: import_node_process9.default.env.SCF_RUNTIME
15365
+ SCF_RUNTIME: import_node_process10.default.env.SCF_RUNTIME
15219
15366
  });
15220
15367
  }
15221
15368
 
@@ -15298,8 +15445,8 @@ var createApp = (config) => {
15298
15445
 
15299
15446
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/server.js
15300
15447
  var import_zod_openapi4 = require("@hono/zod-openapi");
15301
- var import_node_process10 = __toESM(require("node:process"), 1);
15302
- var port = Number(import_node_process10.default.env.PORT || "3002");
15448
+ var import_node_process11 = __toESM(require("node:process"), 1);
15449
+ var port = Number(import_node_process11.default.env.PORT || "3002");
15303
15450
  var hostname = "0.0.0.0";
15304
15451
  async function main() {
15305
15452
  const config = await loadConfig();