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