@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/bin.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;
@@ -2649,7 +2649,7 @@ function parseArgs(args, options) {
2649
2649
  var import_promises4 = require("node:fs/promises");
2650
2650
  var import_node_os3 = require("node:os");
2651
2651
  var import_node_path6 = require("node:path");
2652
- var import_node_process4 = __toESM(require("node:process"), 1);
2652
+ var import_node_process5 = __toESM(require("node:process"), 1);
2653
2653
 
2654
2654
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/large-result.js
2655
2655
  var import_promises = require("node:fs/promises");
@@ -3210,6 +3210,152 @@ Skill path: ${meta.basePath}
3210
3210
  };
3211
3211
  }
3212
3212
 
3213
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/bash.js
3214
+ var import_node_child_process = require("node:child_process");
3215
+ var import_node_process2 = __toESM(require("node:process"), 1);
3216
+ var DEFAULT_MAX_BYTES = 1e5;
3217
+ var DEFAULT_MAX_LINES = 2e3;
3218
+ var DEFAULT_TIMEOUT_MS = 6e4;
3219
+ function truncateOutput(stdout, stderr, maxBytes = DEFAULT_MAX_BYTES, maxLines = DEFAULT_MAX_LINES) {
3220
+ const fullOutput = (stderr ? `STDERR:
3221
+ ${stderr}
3222
+
3223
+ STDOUT:
3224
+ ` : "") + stdout;
3225
+ const lines = fullOutput.split("\n");
3226
+ if (lines.length > maxLines) {
3227
+ const truncatedLines = lines.slice(-maxLines);
3228
+ return {
3229
+ output: `[OUTPUT TRUNCATED] Showing last ${maxLines} lines of ${lines.length} total
3230
+
3231
+ ` + truncatedLines.join("\n"),
3232
+ truncated: true
3233
+ };
3234
+ }
3235
+ if (fullOutput.length > maxBytes) {
3236
+ const truncatedBytes = fullOutput.slice(-maxBytes);
3237
+ return {
3238
+ output: `[OUTPUT TRUNCATED] Showing last ${maxBytes} bytes of ${fullOutput.length} total
3239
+
3240
+ ` + truncatedBytes,
3241
+ truncated: true
3242
+ };
3243
+ }
3244
+ return {
3245
+ output: fullOutput,
3246
+ truncated: false
3247
+ };
3248
+ }
3249
+ function executeBash(command, cwd2, timeoutMs) {
3250
+ return new Promise((resolve5) => {
3251
+ const stdout = [];
3252
+ const stderr = [];
3253
+ const proc = (0, import_node_child_process.spawn)("bash", [
3254
+ "-c",
3255
+ command
3256
+ ], {
3257
+ cwd: cwd2,
3258
+ stdio: [
3259
+ "ignore",
3260
+ "pipe",
3261
+ "pipe"
3262
+ ]
3263
+ });
3264
+ proc.stdout?.on("data", (data) => {
3265
+ stdout.push(data.toString());
3266
+ });
3267
+ proc.stderr?.on("data", (data) => {
3268
+ stderr.push(data.toString());
3269
+ });
3270
+ proc.on("close", (code) => {
3271
+ resolve5({
3272
+ stdout: stdout.join(""),
3273
+ stderr: stderr.join(""),
3274
+ exitCode: code
3275
+ });
3276
+ });
3277
+ proc.on("error", (err) => {
3278
+ resolve5({
3279
+ stdout: "",
3280
+ stderr: err.message,
3281
+ exitCode: null
3282
+ });
3283
+ });
3284
+ setTimeout(() => {
3285
+ proc.kill("SIGTERM");
3286
+ resolve5({
3287
+ stdout: stdout.join(""),
3288
+ stderr: stderr.join("") + "\n\n[TIMEOUT] Command execution timed out",
3289
+ exitCode: null
3290
+ });
3291
+ }, timeoutMs);
3292
+ });
3293
+ }
3294
+ function createBashPlugin(options = {}) {
3295
+ const { maxBytes, maxLines, timeoutMs } = {
3296
+ maxBytes: DEFAULT_MAX_BYTES,
3297
+ maxLines: DEFAULT_MAX_LINES,
3298
+ timeoutMs: DEFAULT_TIMEOUT_MS,
3299
+ ...options
3300
+ };
3301
+ let serverRef = null;
3302
+ return {
3303
+ name: "plugin-bash",
3304
+ version: "1.0.0",
3305
+ // Store server reference for tool registration
3306
+ configureServer: (server) => {
3307
+ serverRef = server;
3308
+ },
3309
+ // Register bash tool with agent name prefix
3310
+ composeStart: (context2) => {
3311
+ if (!serverRef) return;
3312
+ const agentName = context2.serverName;
3313
+ const toolName = `${agentName}__bash`;
3314
+ 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.", {
3315
+ type: "object",
3316
+ properties: {
3317
+ command: {
3318
+ type: "string",
3319
+ description: "The bash command to execute"
3320
+ },
3321
+ cwd: {
3322
+ type: "string",
3323
+ description: "Optional: Working directory for the command (defaults to current directory)"
3324
+ }
3325
+ },
3326
+ required: [
3327
+ "command"
3328
+ ]
3329
+ }, async (args) => {
3330
+ const cwd2 = args.cwd || import_node_process2.default.cwd();
3331
+ const result = await executeBash(args.command, cwd2, timeoutMs);
3332
+ const { output, truncated } = truncateOutput(result.stdout, result.stderr, maxBytes, maxLines);
3333
+ let finalOutput = output;
3334
+ if (result.exitCode !== null && result.exitCode !== 0) {
3335
+ finalOutput = `[EXIT CODE: ${result.exitCode}]
3336
+ ` + finalOutput;
3337
+ }
3338
+ if (truncated) {
3339
+ finalOutput += `
3340
+
3341
+ [Note: Output was truncated]`;
3342
+ }
3343
+ return {
3344
+ content: [
3345
+ {
3346
+ type: "text",
3347
+ text: finalOutput
3348
+ }
3349
+ ],
3350
+ isError: result.exitCode !== null && result.exitCode !== 0
3351
+ };
3352
+ }, {
3353
+ internal: true
3354
+ });
3355
+ }
3356
+ };
3357
+ }
3358
+
3213
3359
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
3214
3360
  var import_plugin_code_execution = require("@mcpc-tech/plugin-code-execution");
3215
3361
 
@@ -5189,10 +5335,10 @@ function parse(content, options = {}) {
5189
5335
  }
5190
5336
 
5191
5337
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/src/markdown-loader.js
5192
- var import_node_process2 = __toESM(require("node:process"), 1);
5338
+ var import_node_process3 = __toESM(require("node:process"), 1);
5193
5339
  function replaceEnvVars(str2) {
5194
5340
  return str2.replace(/\$([A-Za-z_][A-Za-z0-9_]*)(?!\s*\()/g, (match, varName) => {
5195
- const value = import_node_process2.default.env[varName];
5341
+ const value = import_node_process3.default.env[varName];
5196
5342
  if (value !== void 0) {
5197
5343
  return value;
5198
5344
  }
@@ -5291,18 +5437,19 @@ var defaultPlugin = markdownLoaderPlugin();
5291
5437
 
5292
5438
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
5293
5439
  var import_node_path5 = require("node:path");
5294
- var import_node_process3 = __toESM(require("node:process"), 1);
5440
+ var import_node_process4 = __toESM(require("node:process"), 1);
5295
5441
  var DEFAULT_SKILLS_PATHS = [
5296
5442
  ".agent/skills"
5297
5443
  ];
5298
5444
  var DEFAULT_CODE_EXECUTION_TIMEOUT = 3e5;
5299
5445
  function getGlobalPlugins(skillsPaths) {
5300
- const resolvedPaths = skillsPaths.map((p2) => (0, import_node_path5.resolve)(import_node_process3.default.cwd(), p2));
5446
+ const resolvedPaths = skillsPaths.map((p2) => (0, import_node_path5.resolve)(import_node_process4.default.cwd(), p2));
5301
5447
  return [
5302
5448
  markdownLoaderPlugin(),
5303
5449
  createSkillsPlugin({
5304
5450
  paths: resolvedPaths
5305
- })
5451
+ }),
5452
+ createBashPlugin()
5306
5453
  ];
5307
5454
  }
5308
5455
  function getAgentPlugins() {
@@ -5331,7 +5478,7 @@ function getDefaultAgents() {
5331
5478
  }
5332
5479
 
5333
5480
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
5334
- var CLI_VERSION = "0.1.51";
5481
+ var CLI_VERSION = "0.1.52";
5335
5482
  function extractServerName(command, commandArgs) {
5336
5483
  for (const arg of commandArgs) {
5337
5484
  if (!arg.startsWith("-")) {
@@ -5391,7 +5538,7 @@ async function saveUserConfig(config, newAgentName) {
5391
5538
  async function createWrapConfig(args) {
5392
5539
  if (!args.mcpServers || args.mcpServers.length === 0) {
5393
5540
  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'");
5394
- import_node_process4.default.exit(1);
5541
+ import_node_process5.default.exit(1);
5395
5542
  }
5396
5543
  const mcpServers = {};
5397
5544
  const serverNames = [];
@@ -5514,7 +5661,7 @@ function parseMcpServer(cmdString, transportType) {
5514
5661
  };
5515
5662
  }
5516
5663
  function parseCLIArgs() {
5517
- const args = parseArgs(import_node_process4.default.argv.slice(2), {
5664
+ const args = parseArgs(import_node_process5.default.argv.slice(2), {
5518
5665
  boolean: [
5519
5666
  "help",
5520
5667
  "version",
@@ -5603,15 +5750,15 @@ async function loadConfig() {
5603
5750
  const args = parseCLIArgs();
5604
5751
  if (args.version) {
5605
5752
  printVersion();
5606
- import_node_process4.default.exit(0);
5753
+ import_node_process5.default.exit(0);
5607
5754
  }
5608
5755
  if (args.help) {
5609
5756
  printHelp();
5610
- import_node_process4.default.exit(0);
5757
+ import_node_process5.default.exit(0);
5611
5758
  }
5612
5759
  if (args.cwd) {
5613
- const targetCwd = (0, import_node_path6.resolve)(import_node_process4.default.cwd(), args.cwd);
5614
- import_node_process4.default.chdir(targetCwd);
5760
+ const targetCwd = (0, import_node_path6.resolve)(import_node_process5.default.cwd(), args.cwd);
5761
+ import_node_process5.default.chdir(targetCwd);
5615
5762
  console.error(`Changed working directory to: ${targetCwd}`);
5616
5763
  }
5617
5764
  const mergeSkills = (config) => {
@@ -5623,7 +5770,7 @@ async function loadConfig() {
5623
5770
  ...args,
5624
5771
  saveConfig: true
5625
5772
  });
5626
- import_node_process4.default.exit(0);
5773
+ import_node_process5.default.exit(0);
5627
5774
  }
5628
5775
  if (args.wrap) {
5629
5776
  return mergeSkills(await createWrapConfig({
@@ -5640,16 +5787,16 @@ async function loadConfig() {
5640
5787
  throw error;
5641
5788
  }
5642
5789
  }
5643
- if (import_node_process4.default.env.MCPC_CONFIG) {
5790
+ if (import_node_process5.default.env.MCPC_CONFIG) {
5644
5791
  try {
5645
- const parsed = JSON.parse(import_node_process4.default.env.MCPC_CONFIG);
5792
+ const parsed = JSON.parse(import_node_process5.default.env.MCPC_CONFIG);
5646
5793
  return mergeSkills(applyModeOverride(normalizeConfig(parsed), args.mode));
5647
5794
  } catch (error) {
5648
5795
  console.error("Failed to parse MCPC_CONFIG environment variable:", error);
5649
5796
  throw error;
5650
5797
  }
5651
5798
  }
5652
- const configUrl = args.configUrl || import_node_process4.default.env.MCPC_CONFIG_URL;
5799
+ const configUrl = args.configUrl || import_node_process5.default.env.MCPC_CONFIG_URL;
5653
5800
  if (configUrl) {
5654
5801
  try {
5655
5802
  const headers = {
@@ -5670,7 +5817,7 @@ async function loadConfig() {
5670
5817
  throw error;
5671
5818
  }
5672
5819
  }
5673
- const configFile = args.configFile || import_node_process4.default.env.MCPC_CONFIG_FILE;
5820
+ const configFile = args.configFile || import_node_process5.default.env.MCPC_CONFIG_FILE;
5674
5821
  if (configFile) {
5675
5822
  try {
5676
5823
  const config = await loadConfigFromFile(configFile);
@@ -5695,7 +5842,7 @@ async function loadConfig() {
5695
5842
  throw error;
5696
5843
  }
5697
5844
  }
5698
- const defaultJsonConfigPath = (0, import_node_path6.resolve)(import_node_process4.default.cwd(), "mcpc.config.json");
5845
+ const defaultJsonConfigPath = (0, import_node_path6.resolve)(import_node_process5.default.cwd(), "mcpc.config.json");
5699
5846
  try {
5700
5847
  const config = await loadConfigFromFile(defaultJsonConfigPath);
5701
5848
  return mergeSkills(applyModeOverride(config, args.mode));
@@ -5710,7 +5857,7 @@ async function loadConfig() {
5710
5857
  }
5711
5858
  function replaceEnvVars2(str2) {
5712
5859
  return str2.replace(/\$([A-Z_][A-Z0-9_]*)/g, (_match, varName) => {
5713
- return import_node_process4.default.env[varName] || "";
5860
+ return import_node_process5.default.env[varName] || "";
5714
5861
  });
5715
5862
  }
5716
5863
  function isMarkdownFile2(path) {
@@ -8280,9 +8427,9 @@ var Client = class extends Protocol {
8280
8427
 
8281
8428
  // __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
8282
8429
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
8283
- var import_node_process5 = __toESM(require("node:process"), 1);
8430
+ var import_node_process6 = __toESM(require("node:process"), 1);
8284
8431
  var import_node_stream = require("node:stream");
8285
- var DEFAULT_INHERITED_ENV_VARS = import_node_process5.default.platform === "win32" ? [
8432
+ var DEFAULT_INHERITED_ENV_VARS = import_node_process6.default.platform === "win32" ? [
8286
8433
  "APPDATA",
8287
8434
  "HOMEDRIVE",
8288
8435
  "HOMEPATH",
@@ -8302,7 +8449,7 @@ var DEFAULT_INHERITED_ENV_VARS = import_node_process5.default.platform === "win3
8302
8449
  function getDefaultEnvironment() {
8303
8450
  const env = {};
8304
8451
  for (const key of DEFAULT_INHERITED_ENV_VARS) {
8305
- const value = import_node_process5.default.env[key];
8452
+ const value = import_node_process6.default.env[key];
8306
8453
  if (value === void 0) {
8307
8454
  continue;
8308
8455
  }
@@ -8338,7 +8485,7 @@ var StdioClientTransport = class {
8338
8485
  },
8339
8486
  stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
8340
8487
  shell: false,
8341
- windowsHide: import_node_process5.default.platform === "win32" && isElectron(),
8488
+ windowsHide: import_node_process6.default.platform === "win32" && isElectron(),
8342
8489
  cwd: this._serverParams.cwd
8343
8490
  });
8344
8491
  this._process.on("error", (error) => {
@@ -8446,7 +8593,7 @@ var StdioClientTransport = class {
8446
8593
  }
8447
8594
  };
8448
8595
  function isElectron() {
8449
- return "type" in import_node_process5.default;
8596
+ return "type" in import_node_process6.default;
8450
8597
  }
8451
8598
 
8452
8599
  // __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
@@ -10370,8 +10517,8 @@ var InMemoryTransport = class _InMemoryTransport {
10370
10517
  };
10371
10518
 
10372
10519
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js
10373
- var import_node_process6 = __toESM(require("node:process"), 1);
10374
- var GEMINI_PREFERRED_FORMAT = import_node_process6.default.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
10520
+ var import_node_process7 = __toESM(require("node:process"), 1);
10521
+ var GEMINI_PREFERRED_FORMAT = import_node_process7.default.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
10375
10522
 
10376
10523
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js
10377
10524
  var import_jsonrepair2 = require("jsonrepair");
@@ -10443,8 +10590,8 @@ var cleanToolSchema = (schema) => {
10443
10590
  };
10444
10591
 
10445
10592
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
10446
- var import_node_process7 = require("node:process");
10447
- var import_node_process8 = __toESM(require("node:process"), 1);
10593
+ var import_node_process8 = require("node:process");
10594
+ var import_node_process9 = __toESM(require("node:process"), 1);
10448
10595
  var import_node_crypto = require("node:crypto");
10449
10596
  function createTransport(def) {
10450
10597
  const defAny = def;
@@ -10485,10 +10632,10 @@ function createTransport(def) {
10485
10632
  command: defAny.command,
10486
10633
  args: defAny.args,
10487
10634
  env: {
10488
- ...import_node_process8.default.env,
10635
+ ...import_node_process9.default.env,
10489
10636
  ...defAny.env ?? {}
10490
10637
  },
10491
- cwd: (0, import_node_process7.cwd)()
10638
+ cwd: (0, import_node_process8.cwd)()
10492
10639
  });
10493
10640
  }
10494
10641
  throw new Error(`Unsupported transport configuration: ${JSON.stringify(def)}`);
@@ -11135,7 +11282,7 @@ function endSpan(span, error) {
11135
11282
  }
11136
11283
 
11137
11284
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-executor.js
11138
- var import_node_process9 = __toESM(require("node:process"), 1);
11285
+ var import_node_process10 = __toESM(require("node:process"), 1);
11139
11286
  var AgenticExecutor = class {
11140
11287
  name;
11141
11288
  allToolNames;
@@ -11155,13 +11302,13 @@ var AgenticExecutor = class {
11155
11302
  this.logger = createLogger(`mcpc.agentic.${name}`, server);
11156
11303
  this.toolSchemaMap = new Map(toolNameToDetailList);
11157
11304
  try {
11158
- this.tracingEnabled = import_node_process9.default.env.MCPC_TRACING_ENABLED === "true";
11305
+ this.tracingEnabled = import_node_process10.default.env.MCPC_TRACING_ENABLED === "true";
11159
11306
  if (this.tracingEnabled) {
11160
11307
  initializeTracing({
11161
11308
  enabled: true,
11162
11309
  serviceName: `mcpc-agentic-${name}`,
11163
- exportTo: import_node_process9.default.env.MCPC_TRACING_EXPORT ?? "otlp",
11164
- otlpEndpoint: import_node_process9.default.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
11310
+ exportTo: import_node_process10.default.env.MCPC_TRACING_EXPORT ?? "otlp",
11311
+ otlpEndpoint: import_node_process10.default.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
11165
11312
  });
11166
11313
  }
11167
11314
  } catch {
@@ -13876,12 +14023,12 @@ var ComposableMCPServer = class extends Server {
13876
14023
  };
13877
14024
 
13878
14025
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/env.js
13879
- var import_node_process10 = __toESM(require("node:process"), 1);
13880
- var isSCF = () => Boolean(import_node_process10.default.env.SCF_RUNTIME || import_node_process10.default.env.PROD_SCF);
14026
+ var import_node_process11 = __toESM(require("node:process"), 1);
14027
+ var isSCF = () => Boolean(import_node_process11.default.env.SCF_RUNTIME || import_node_process11.default.env.PROD_SCF);
13881
14028
  if (isSCF()) {
13882
14029
  console.log({
13883
14030
  isSCF: isSCF(),
13884
- SCF_RUNTIME: import_node_process10.default.env.SCF_RUNTIME
14031
+ SCF_RUNTIME: import_node_process11.default.env.SCF_RUNTIME
13885
14032
  });
13886
14033
  }
13887
14034