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