@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.mjs CHANGED
@@ -509,7 +509,7 @@ var require_cross_spawn = __commonJS({
509
509
  var cp = __require("child_process");
510
510
  var parse2 = require_parse();
511
511
  var enoent = require_enoent();
512
- function spawn2(command, args, options) {
512
+ function spawn3(command, args, options) {
513
513
  const parsed = parse2(command, args, options);
514
514
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
515
515
  enoent.hookChildProcess(spawned, parsed);
@@ -521,8 +521,8 @@ var require_cross_spawn = __commonJS({
521
521
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
522
522
  return result;
523
523
  }
524
- module.exports = spawn2;
525
- module.exports.spawn = spawn2;
524
+ module.exports = spawn3;
525
+ module.exports.spawn = spawn3;
526
526
  module.exports.sync = spawnSync;
527
527
  module.exports._parse = parse2;
528
528
  module.exports._enoent = enoent;
@@ -2657,7 +2657,7 @@ function parseArgs(args, options) {
2657
2657
  import { mkdir, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
2658
2658
  import { homedir } from "node:os";
2659
2659
  import { dirname, join as join3, resolve as resolve4 } from "node:path";
2660
- import process5 from "node:process";
2660
+ import process6 from "node:process";
2661
2661
 
2662
2662
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/large-result.js
2663
2663
  import { mkdtemp, writeFile } from "node:fs/promises";
@@ -3218,6 +3218,152 @@ Skill path: ${meta.basePath}
3218
3218
  };
3219
3219
  }
3220
3220
 
3221
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/bash.js
3222
+ import { spawn } from "node:child_process";
3223
+ import process3 from "node:process";
3224
+ var DEFAULT_MAX_BYTES = 1e5;
3225
+ var DEFAULT_MAX_LINES = 2e3;
3226
+ var DEFAULT_TIMEOUT_MS = 6e4;
3227
+ function truncateOutput(stdout, stderr, maxBytes = DEFAULT_MAX_BYTES, maxLines = DEFAULT_MAX_LINES) {
3228
+ const fullOutput = (stderr ? `STDERR:
3229
+ ${stderr}
3230
+
3231
+ STDOUT:
3232
+ ` : "") + stdout;
3233
+ const lines = fullOutput.split("\n");
3234
+ if (lines.length > maxLines) {
3235
+ const truncatedLines = lines.slice(-maxLines);
3236
+ return {
3237
+ output: `[OUTPUT TRUNCATED] Showing last ${maxLines} lines of ${lines.length} total
3238
+
3239
+ ` + truncatedLines.join("\n"),
3240
+ truncated: true
3241
+ };
3242
+ }
3243
+ if (fullOutput.length > maxBytes) {
3244
+ const truncatedBytes = fullOutput.slice(-maxBytes);
3245
+ return {
3246
+ output: `[OUTPUT TRUNCATED] Showing last ${maxBytes} bytes of ${fullOutput.length} total
3247
+
3248
+ ` + truncatedBytes,
3249
+ truncated: true
3250
+ };
3251
+ }
3252
+ return {
3253
+ output: fullOutput,
3254
+ truncated: false
3255
+ };
3256
+ }
3257
+ function executeBash(command, cwd2, timeoutMs) {
3258
+ return new Promise((resolve5) => {
3259
+ const stdout = [];
3260
+ const stderr = [];
3261
+ const proc = spawn("bash", [
3262
+ "-c",
3263
+ command
3264
+ ], {
3265
+ cwd: cwd2,
3266
+ stdio: [
3267
+ "ignore",
3268
+ "pipe",
3269
+ "pipe"
3270
+ ]
3271
+ });
3272
+ proc.stdout?.on("data", (data) => {
3273
+ stdout.push(data.toString());
3274
+ });
3275
+ proc.stderr?.on("data", (data) => {
3276
+ stderr.push(data.toString());
3277
+ });
3278
+ proc.on("close", (code) => {
3279
+ resolve5({
3280
+ stdout: stdout.join(""),
3281
+ stderr: stderr.join(""),
3282
+ exitCode: code
3283
+ });
3284
+ });
3285
+ proc.on("error", (err) => {
3286
+ resolve5({
3287
+ stdout: "",
3288
+ stderr: err.message,
3289
+ exitCode: null
3290
+ });
3291
+ });
3292
+ setTimeout(() => {
3293
+ proc.kill("SIGTERM");
3294
+ resolve5({
3295
+ stdout: stdout.join(""),
3296
+ stderr: stderr.join("") + "\n\n[TIMEOUT] Command execution timed out",
3297
+ exitCode: null
3298
+ });
3299
+ }, timeoutMs);
3300
+ });
3301
+ }
3302
+ function createBashPlugin(options = {}) {
3303
+ const { maxBytes, maxLines, timeoutMs } = {
3304
+ maxBytes: DEFAULT_MAX_BYTES,
3305
+ maxLines: DEFAULT_MAX_LINES,
3306
+ timeoutMs: DEFAULT_TIMEOUT_MS,
3307
+ ...options
3308
+ };
3309
+ let serverRef = null;
3310
+ return {
3311
+ name: "plugin-bash",
3312
+ version: "1.0.0",
3313
+ // Store server reference for tool registration
3314
+ configureServer: (server) => {
3315
+ serverRef = server;
3316
+ },
3317
+ // Register bash tool with agent name prefix
3318
+ composeStart: (context2) => {
3319
+ if (!serverRef) return;
3320
+ const agentName = context2.serverName;
3321
+ const toolName = `${agentName}__bash`;
3322
+ 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.", {
3323
+ type: "object",
3324
+ properties: {
3325
+ command: {
3326
+ type: "string",
3327
+ description: "The bash command to execute"
3328
+ },
3329
+ cwd: {
3330
+ type: "string",
3331
+ description: "Optional: Working directory for the command (defaults to current directory)"
3332
+ }
3333
+ },
3334
+ required: [
3335
+ "command"
3336
+ ]
3337
+ }, async (args) => {
3338
+ const cwd2 = args.cwd || process3.cwd();
3339
+ const result = await executeBash(args.command, cwd2, timeoutMs);
3340
+ const { output, truncated } = truncateOutput(result.stdout, result.stderr, maxBytes, maxLines);
3341
+ let finalOutput = output;
3342
+ if (result.exitCode !== null && result.exitCode !== 0) {
3343
+ finalOutput = `[EXIT CODE: ${result.exitCode}]
3344
+ ` + finalOutput;
3345
+ }
3346
+ if (truncated) {
3347
+ finalOutput += `
3348
+
3349
+ [Note: Output was truncated]`;
3350
+ }
3351
+ return {
3352
+ content: [
3353
+ {
3354
+ type: "text",
3355
+ text: finalOutput
3356
+ }
3357
+ ],
3358
+ isError: result.exitCode !== null && result.exitCode !== 0
3359
+ };
3360
+ }, {
3361
+ internal: true
3362
+ });
3363
+ }
3364
+ };
3365
+ }
3366
+
3221
3367
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
3222
3368
  import { createCodeExecutionPlugin } from "@mcpc-tech/plugin-code-execution";
3223
3369
 
@@ -5197,10 +5343,10 @@ function parse(content, options = {}) {
5197
5343
  }
5198
5344
 
5199
5345
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/src/markdown-loader.js
5200
- import process3 from "node:process";
5346
+ import process4 from "node:process";
5201
5347
  function replaceEnvVars(str2) {
5202
5348
  return str2.replace(/\$([A-Za-z_][A-Za-z0-9_]*)(?!\s*\()/g, (match, varName) => {
5203
- const value = process3.env[varName];
5349
+ const value = process4.env[varName];
5204
5350
  if (value !== void 0) {
5205
5351
  return value;
5206
5352
  }
@@ -5299,18 +5445,19 @@ var defaultPlugin = markdownLoaderPlugin();
5299
5445
 
5300
5446
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
5301
5447
  import { resolve as resolve3 } from "node:path";
5302
- import process4 from "node:process";
5448
+ import process5 from "node:process";
5303
5449
  var DEFAULT_SKILLS_PATHS = [
5304
5450
  ".agent/skills"
5305
5451
  ];
5306
5452
  var DEFAULT_CODE_EXECUTION_TIMEOUT = 3e5;
5307
5453
  function getGlobalPlugins(skillsPaths) {
5308
- const resolvedPaths = skillsPaths.map((p2) => resolve3(process4.cwd(), p2));
5454
+ const resolvedPaths = skillsPaths.map((p2) => resolve3(process5.cwd(), p2));
5309
5455
  return [
5310
5456
  markdownLoaderPlugin(),
5311
5457
  createSkillsPlugin({
5312
5458
  paths: resolvedPaths
5313
- })
5459
+ }),
5460
+ createBashPlugin()
5314
5461
  ];
5315
5462
  }
5316
5463
  function getAgentPlugins() {
@@ -5339,7 +5486,7 @@ function getDefaultAgents() {
5339
5486
  }
5340
5487
 
5341
5488
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
5342
- var CLI_VERSION = "0.1.51";
5489
+ var CLI_VERSION = "0.1.52";
5343
5490
  function extractServerName(command, commandArgs) {
5344
5491
  for (const arg of commandArgs) {
5345
5492
  if (!arg.startsWith("-")) {
@@ -5399,7 +5546,7 @@ async function saveUserConfig(config, newAgentName) {
5399
5546
  async function createWrapConfig(args) {
5400
5547
  if (!args.mcpServers || args.mcpServers.length === 0) {
5401
5548
  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'");
5402
- process5.exit(1);
5549
+ process6.exit(1);
5403
5550
  }
5404
5551
  const mcpServers = {};
5405
5552
  const serverNames = [];
@@ -5522,7 +5669,7 @@ function parseMcpServer(cmdString, transportType) {
5522
5669
  };
5523
5670
  }
5524
5671
  function parseCLIArgs() {
5525
- const args = parseArgs(process5.argv.slice(2), {
5672
+ const args = parseArgs(process6.argv.slice(2), {
5526
5673
  boolean: [
5527
5674
  "help",
5528
5675
  "version",
@@ -5611,15 +5758,15 @@ async function loadConfig() {
5611
5758
  const args = parseCLIArgs();
5612
5759
  if (args.version) {
5613
5760
  printVersion();
5614
- process5.exit(0);
5761
+ process6.exit(0);
5615
5762
  }
5616
5763
  if (args.help) {
5617
5764
  printHelp();
5618
- process5.exit(0);
5765
+ process6.exit(0);
5619
5766
  }
5620
5767
  if (args.cwd) {
5621
- const targetCwd = resolve4(process5.cwd(), args.cwd);
5622
- process5.chdir(targetCwd);
5768
+ const targetCwd = resolve4(process6.cwd(), args.cwd);
5769
+ process6.chdir(targetCwd);
5623
5770
  console.error(`Changed working directory to: ${targetCwd}`);
5624
5771
  }
5625
5772
  const mergeSkills = (config) => {
@@ -5631,7 +5778,7 @@ async function loadConfig() {
5631
5778
  ...args,
5632
5779
  saveConfig: true
5633
5780
  });
5634
- process5.exit(0);
5781
+ process6.exit(0);
5635
5782
  }
5636
5783
  if (args.wrap) {
5637
5784
  return mergeSkills(await createWrapConfig({
@@ -5648,16 +5795,16 @@ async function loadConfig() {
5648
5795
  throw error;
5649
5796
  }
5650
5797
  }
5651
- if (process5.env.MCPC_CONFIG) {
5798
+ if (process6.env.MCPC_CONFIG) {
5652
5799
  try {
5653
- const parsed = JSON.parse(process5.env.MCPC_CONFIG);
5800
+ const parsed = JSON.parse(process6.env.MCPC_CONFIG);
5654
5801
  return mergeSkills(applyModeOverride(normalizeConfig(parsed), args.mode));
5655
5802
  } catch (error) {
5656
5803
  console.error("Failed to parse MCPC_CONFIG environment variable:", error);
5657
5804
  throw error;
5658
5805
  }
5659
5806
  }
5660
- const configUrl = args.configUrl || process5.env.MCPC_CONFIG_URL;
5807
+ const configUrl = args.configUrl || process6.env.MCPC_CONFIG_URL;
5661
5808
  if (configUrl) {
5662
5809
  try {
5663
5810
  const headers = {
@@ -5678,7 +5825,7 @@ async function loadConfig() {
5678
5825
  throw error;
5679
5826
  }
5680
5827
  }
5681
- const configFile = args.configFile || process5.env.MCPC_CONFIG_FILE;
5828
+ const configFile = args.configFile || process6.env.MCPC_CONFIG_FILE;
5682
5829
  if (configFile) {
5683
5830
  try {
5684
5831
  const config = await loadConfigFromFile(configFile);
@@ -5703,7 +5850,7 @@ async function loadConfig() {
5703
5850
  throw error;
5704
5851
  }
5705
5852
  }
5706
- const defaultJsonConfigPath = resolve4(process5.cwd(), "mcpc.config.json");
5853
+ const defaultJsonConfigPath = resolve4(process6.cwd(), "mcpc.config.json");
5707
5854
  try {
5708
5855
  const config = await loadConfigFromFile(defaultJsonConfigPath);
5709
5856
  return mergeSkills(applyModeOverride(config, args.mode));
@@ -5718,7 +5865,7 @@ async function loadConfig() {
5718
5865
  }
5719
5866
  function replaceEnvVars2(str2) {
5720
5867
  return str2.replace(/\$([A-Z_][A-Z0-9_]*)/g, (_match, varName) => {
5721
- return process5.env[varName] || "";
5868
+ return process6.env[varName] || "";
5722
5869
  });
5723
5870
  }
5724
5871
  function isMarkdownFile2(path) {
@@ -8288,9 +8435,9 @@ var Client = class extends Protocol {
8288
8435
 
8289
8436
  // __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
8290
8437
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
8291
- import process6 from "node:process";
8438
+ import process7 from "node:process";
8292
8439
  import { PassThrough } from "node:stream";
8293
- var DEFAULT_INHERITED_ENV_VARS = process6.platform === "win32" ? [
8440
+ var DEFAULT_INHERITED_ENV_VARS = process7.platform === "win32" ? [
8294
8441
  "APPDATA",
8295
8442
  "HOMEDRIVE",
8296
8443
  "HOMEPATH",
@@ -8310,7 +8457,7 @@ var DEFAULT_INHERITED_ENV_VARS = process6.platform === "win32" ? [
8310
8457
  function getDefaultEnvironment() {
8311
8458
  const env = {};
8312
8459
  for (const key of DEFAULT_INHERITED_ENV_VARS) {
8313
- const value = process6.env[key];
8460
+ const value = process7.env[key];
8314
8461
  if (value === void 0) {
8315
8462
  continue;
8316
8463
  }
@@ -8346,7 +8493,7 @@ var StdioClientTransport = class {
8346
8493
  },
8347
8494
  stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
8348
8495
  shell: false,
8349
- windowsHide: process6.platform === "win32" && isElectron(),
8496
+ windowsHide: process7.platform === "win32" && isElectron(),
8350
8497
  cwd: this._serverParams.cwd
8351
8498
  });
8352
8499
  this._process.on("error", (error) => {
@@ -8454,7 +8601,7 @@ var StdioClientTransport = class {
8454
8601
  }
8455
8602
  };
8456
8603
  function isElectron() {
8457
- return "type" in process6;
8604
+ return "type" in process7;
8458
8605
  }
8459
8606
 
8460
8607
  // __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
@@ -10378,8 +10525,8 @@ var InMemoryTransport = class _InMemoryTransport {
10378
10525
  };
10379
10526
 
10380
10527
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js
10381
- import process7 from "node:process";
10382
- var GEMINI_PREFERRED_FORMAT = process7.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
10528
+ import process8 from "node:process";
10529
+ var GEMINI_PREFERRED_FORMAT = process8.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
10383
10530
 
10384
10531
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js
10385
10532
  import { jsonrepair as jsonrepair2 } from "jsonrepair";
@@ -10452,7 +10599,7 @@ var cleanToolSchema = (schema) => {
10452
10599
 
10453
10600
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
10454
10601
  import { cwd } from "node:process";
10455
- import process8 from "node:process";
10602
+ import process9 from "node:process";
10456
10603
  import { createHash } from "node:crypto";
10457
10604
  function createTransport(def) {
10458
10605
  const defAny = def;
@@ -10493,7 +10640,7 @@ function createTransport(def) {
10493
10640
  command: defAny.command,
10494
10641
  args: defAny.args,
10495
10642
  env: {
10496
- ...process8.env,
10643
+ ...process9.env,
10497
10644
  ...defAny.env ?? {}
10498
10645
  },
10499
10646
  cwd: cwd()
@@ -11143,7 +11290,7 @@ function endSpan(span, error) {
11143
11290
  }
11144
11291
 
11145
11292
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-executor.js
11146
- import process9 from "node:process";
11293
+ import process10 from "node:process";
11147
11294
  var AgenticExecutor = class {
11148
11295
  name;
11149
11296
  allToolNames;
@@ -11163,13 +11310,13 @@ var AgenticExecutor = class {
11163
11310
  this.logger = createLogger(`mcpc.agentic.${name}`, server);
11164
11311
  this.toolSchemaMap = new Map(toolNameToDetailList);
11165
11312
  try {
11166
- this.tracingEnabled = process9.env.MCPC_TRACING_ENABLED === "true";
11313
+ this.tracingEnabled = process10.env.MCPC_TRACING_ENABLED === "true";
11167
11314
  if (this.tracingEnabled) {
11168
11315
  initializeTracing({
11169
11316
  enabled: true,
11170
11317
  serviceName: `mcpc-agentic-${name}`,
11171
- exportTo: process9.env.MCPC_TRACING_EXPORT ?? "otlp",
11172
- otlpEndpoint: process9.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
11318
+ exportTo: process10.env.MCPC_TRACING_EXPORT ?? "otlp",
11319
+ otlpEndpoint: process10.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
11173
11320
  });
11174
11321
  }
11175
11322
  } catch {
@@ -13883,12 +14030,12 @@ var ComposableMCPServer = class extends Server {
13883
14030
  };
13884
14031
 
13885
14032
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/env.js
13886
- import process10 from "node:process";
13887
- var isSCF = () => Boolean(process10.env.SCF_RUNTIME || process10.env.PROD_SCF);
14033
+ import process11 from "node:process";
14034
+ var isSCF = () => Boolean(process11.env.SCF_RUNTIME || process11.env.PROD_SCF);
13888
14035
  if (isSCF()) {
13889
14036
  console.log({
13890
14037
  isSCF: isSCF(),
13891
- SCF_RUNTIME: process10.env.SCF_RUNTIME
14038
+ SCF_RUNTIME: process11.env.SCF_RUNTIME
13892
14039
  });
13893
14040
  }
13894
14041