@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.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;
@@ -3874,7 +3874,7 @@ function parseArgs(args, options) {
3874
3874
  import { mkdir, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
3875
3875
  import { homedir } from "node:os";
3876
3876
  import { dirname, join as join3, resolve as resolve4 } from "node:path";
3877
- import process4 from "node:process";
3877
+ import process5 from "node:process";
3878
3878
 
3879
3879
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/large-result.js
3880
3880
  import { mkdtemp, writeFile } from "node:fs/promises";
@@ -4435,6 +4435,152 @@ Skill path: ${meta.basePath}
4435
4435
  };
4436
4436
  }
4437
4437
 
4438
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/bash.js
4439
+ import { spawn } from "node:child_process";
4440
+ import process2 from "node:process";
4441
+ var DEFAULT_MAX_BYTES = 1e5;
4442
+ var DEFAULT_MAX_LINES = 2e3;
4443
+ var DEFAULT_TIMEOUT_MS = 6e4;
4444
+ function truncateOutput(stdout, stderr, maxBytes = DEFAULT_MAX_BYTES, maxLines = DEFAULT_MAX_LINES) {
4445
+ const fullOutput = (stderr ? `STDERR:
4446
+ ${stderr}
4447
+
4448
+ STDOUT:
4449
+ ` : "") + stdout;
4450
+ const lines = fullOutput.split("\n");
4451
+ if (lines.length > maxLines) {
4452
+ const truncatedLines = lines.slice(-maxLines);
4453
+ return {
4454
+ output: `[OUTPUT TRUNCATED] Showing last ${maxLines} lines of ${lines.length} total
4455
+
4456
+ ` + truncatedLines.join("\n"),
4457
+ truncated: true
4458
+ };
4459
+ }
4460
+ if (fullOutput.length > maxBytes) {
4461
+ const truncatedBytes = fullOutput.slice(-maxBytes);
4462
+ return {
4463
+ output: `[OUTPUT TRUNCATED] Showing last ${maxBytes} bytes of ${fullOutput.length} total
4464
+
4465
+ ` + truncatedBytes,
4466
+ truncated: true
4467
+ };
4468
+ }
4469
+ return {
4470
+ output: fullOutput,
4471
+ truncated: false
4472
+ };
4473
+ }
4474
+ function executeBash(command, cwd2, timeoutMs) {
4475
+ return new Promise((resolve5) => {
4476
+ const stdout = [];
4477
+ const stderr = [];
4478
+ const proc = spawn("bash", [
4479
+ "-c",
4480
+ command
4481
+ ], {
4482
+ cwd: cwd2,
4483
+ stdio: [
4484
+ "ignore",
4485
+ "pipe",
4486
+ "pipe"
4487
+ ]
4488
+ });
4489
+ proc.stdout?.on("data", (data) => {
4490
+ stdout.push(data.toString());
4491
+ });
4492
+ proc.stderr?.on("data", (data) => {
4493
+ stderr.push(data.toString());
4494
+ });
4495
+ proc.on("close", (code) => {
4496
+ resolve5({
4497
+ stdout: stdout.join(""),
4498
+ stderr: stderr.join(""),
4499
+ exitCode: code
4500
+ });
4501
+ });
4502
+ proc.on("error", (err) => {
4503
+ resolve5({
4504
+ stdout: "",
4505
+ stderr: err.message,
4506
+ exitCode: null
4507
+ });
4508
+ });
4509
+ setTimeout(() => {
4510
+ proc.kill("SIGTERM");
4511
+ resolve5({
4512
+ stdout: stdout.join(""),
4513
+ stderr: stderr.join("") + "\n\n[TIMEOUT] Command execution timed out",
4514
+ exitCode: null
4515
+ });
4516
+ }, timeoutMs);
4517
+ });
4518
+ }
4519
+ function createBashPlugin(options = {}) {
4520
+ const { maxBytes, maxLines, timeoutMs } = {
4521
+ maxBytes: DEFAULT_MAX_BYTES,
4522
+ maxLines: DEFAULT_MAX_LINES,
4523
+ timeoutMs: DEFAULT_TIMEOUT_MS,
4524
+ ...options
4525
+ };
4526
+ let serverRef = null;
4527
+ return {
4528
+ name: "plugin-bash",
4529
+ version: "1.0.0",
4530
+ // Store server reference for tool registration
4531
+ configureServer: (server) => {
4532
+ serverRef = server;
4533
+ },
4534
+ // Register bash tool with agent name prefix
4535
+ composeStart: (context2) => {
4536
+ if (!serverRef) return;
4537
+ const agentName = context2.serverName;
4538
+ const toolName = `${agentName}__bash`;
4539
+ 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.", {
4540
+ type: "object",
4541
+ properties: {
4542
+ command: {
4543
+ type: "string",
4544
+ description: "The bash command to execute"
4545
+ },
4546
+ cwd: {
4547
+ type: "string",
4548
+ description: "Optional: Working directory for the command (defaults to current directory)"
4549
+ }
4550
+ },
4551
+ required: [
4552
+ "command"
4553
+ ]
4554
+ }, async (args) => {
4555
+ const cwd2 = args.cwd || process2.cwd();
4556
+ const result = await executeBash(args.command, cwd2, timeoutMs);
4557
+ const { output, truncated } = truncateOutput(result.stdout, result.stderr, maxBytes, maxLines);
4558
+ let finalOutput = output;
4559
+ if (result.exitCode !== null && result.exitCode !== 0) {
4560
+ finalOutput = `[EXIT CODE: ${result.exitCode}]
4561
+ ` + finalOutput;
4562
+ }
4563
+ if (truncated) {
4564
+ finalOutput += `
4565
+
4566
+ [Note: Output was truncated]`;
4567
+ }
4568
+ return {
4569
+ content: [
4570
+ {
4571
+ type: "text",
4572
+ text: finalOutput
4573
+ }
4574
+ ],
4575
+ isError: result.exitCode !== null && result.exitCode !== 0
4576
+ };
4577
+ }, {
4578
+ internal: true
4579
+ });
4580
+ }
4581
+ };
4582
+ }
4583
+
4438
4584
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
4439
4585
  import { createCodeExecutionPlugin } from "@mcpc-tech/plugin-code-execution";
4440
4586
 
@@ -6414,10 +6560,10 @@ function parse(content, options = {}) {
6414
6560
  }
6415
6561
 
6416
6562
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/src/markdown-loader.js
6417
- import process2 from "node:process";
6563
+ import process3 from "node:process";
6418
6564
  function replaceEnvVars(str2) {
6419
6565
  return str2.replace(/\$([A-Za-z_][A-Za-z0-9_]*)(?!\s*\()/g, (match, varName) => {
6420
- const value = process2.env[varName];
6566
+ const value = process3.env[varName];
6421
6567
  if (value !== void 0) {
6422
6568
  return value;
6423
6569
  }
@@ -6516,18 +6662,19 @@ var defaultPlugin = markdownLoaderPlugin();
6516
6662
 
6517
6663
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
6518
6664
  import { resolve as resolve3 } from "node:path";
6519
- import process3 from "node:process";
6665
+ import process4 from "node:process";
6520
6666
  var DEFAULT_SKILLS_PATHS = [
6521
6667
  ".agent/skills"
6522
6668
  ];
6523
6669
  var DEFAULT_CODE_EXECUTION_TIMEOUT = 3e5;
6524
6670
  function getGlobalPlugins(skillsPaths) {
6525
- const resolvedPaths = skillsPaths.map((p2) => resolve3(process3.cwd(), p2));
6671
+ const resolvedPaths = skillsPaths.map((p2) => resolve3(process4.cwd(), p2));
6526
6672
  return [
6527
6673
  markdownLoaderPlugin(),
6528
6674
  createSkillsPlugin({
6529
6675
  paths: resolvedPaths
6530
- })
6676
+ }),
6677
+ createBashPlugin()
6531
6678
  ];
6532
6679
  }
6533
6680
  function getAgentPlugins() {
@@ -6556,7 +6703,7 @@ function getDefaultAgents() {
6556
6703
  }
6557
6704
 
6558
6705
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
6559
- var CLI_VERSION = "0.1.51";
6706
+ var CLI_VERSION = "0.1.52";
6560
6707
  function extractServerName(command, commandArgs) {
6561
6708
  for (const arg of commandArgs) {
6562
6709
  if (!arg.startsWith("-")) {
@@ -6616,7 +6763,7 @@ async function saveUserConfig(config, newAgentName) {
6616
6763
  async function createWrapConfig(args) {
6617
6764
  if (!args.mcpServers || args.mcpServers.length === 0) {
6618
6765
  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'");
6619
- process4.exit(1);
6766
+ process5.exit(1);
6620
6767
  }
6621
6768
  const mcpServers = {};
6622
6769
  const serverNames = [];
@@ -6739,7 +6886,7 @@ function parseMcpServer(cmdString, transportType) {
6739
6886
  };
6740
6887
  }
6741
6888
  function parseCLIArgs() {
6742
- const args = parseArgs(process4.argv.slice(2), {
6889
+ const args = parseArgs(process5.argv.slice(2), {
6743
6890
  boolean: [
6744
6891
  "help",
6745
6892
  "version",
@@ -6828,15 +6975,15 @@ async function loadConfig() {
6828
6975
  const args = parseCLIArgs();
6829
6976
  if (args.version) {
6830
6977
  printVersion();
6831
- process4.exit(0);
6978
+ process5.exit(0);
6832
6979
  }
6833
6980
  if (args.help) {
6834
6981
  printHelp();
6835
- process4.exit(0);
6982
+ process5.exit(0);
6836
6983
  }
6837
6984
  if (args.cwd) {
6838
- const targetCwd = resolve4(process4.cwd(), args.cwd);
6839
- process4.chdir(targetCwd);
6985
+ const targetCwd = resolve4(process5.cwd(), args.cwd);
6986
+ process5.chdir(targetCwd);
6840
6987
  console.error(`Changed working directory to: ${targetCwd}`);
6841
6988
  }
6842
6989
  const mergeSkills = (config) => {
@@ -6848,7 +6995,7 @@ async function loadConfig() {
6848
6995
  ...args,
6849
6996
  saveConfig: true
6850
6997
  });
6851
- process4.exit(0);
6998
+ process5.exit(0);
6852
6999
  }
6853
7000
  if (args.wrap) {
6854
7001
  return mergeSkills(await createWrapConfig({
@@ -6865,16 +7012,16 @@ async function loadConfig() {
6865
7012
  throw error;
6866
7013
  }
6867
7014
  }
6868
- if (process4.env.MCPC_CONFIG) {
7015
+ if (process5.env.MCPC_CONFIG) {
6869
7016
  try {
6870
- const parsed = JSON.parse(process4.env.MCPC_CONFIG);
7017
+ const parsed = JSON.parse(process5.env.MCPC_CONFIG);
6871
7018
  return mergeSkills(applyModeOverride(normalizeConfig(parsed), args.mode));
6872
7019
  } catch (error) {
6873
7020
  console.error("Failed to parse MCPC_CONFIG environment variable:", error);
6874
7021
  throw error;
6875
7022
  }
6876
7023
  }
6877
- const configUrl = args.configUrl || process4.env.MCPC_CONFIG_URL;
7024
+ const configUrl = args.configUrl || process5.env.MCPC_CONFIG_URL;
6878
7025
  if (configUrl) {
6879
7026
  try {
6880
7027
  const headers = {
@@ -6895,7 +7042,7 @@ async function loadConfig() {
6895
7042
  throw error;
6896
7043
  }
6897
7044
  }
6898
- const configFile = args.configFile || process4.env.MCPC_CONFIG_FILE;
7045
+ const configFile = args.configFile || process5.env.MCPC_CONFIG_FILE;
6899
7046
  if (configFile) {
6900
7047
  try {
6901
7048
  const config = await loadConfigFromFile(configFile);
@@ -6920,7 +7067,7 @@ async function loadConfig() {
6920
7067
  throw error;
6921
7068
  }
6922
7069
  }
6923
- const defaultJsonConfigPath = resolve4(process4.cwd(), "mcpc.config.json");
7070
+ const defaultJsonConfigPath = resolve4(process5.cwd(), "mcpc.config.json");
6924
7071
  try {
6925
7072
  const config = await loadConfigFromFile(defaultJsonConfigPath);
6926
7073
  return mergeSkills(applyModeOverride(config, args.mode));
@@ -6935,7 +7082,7 @@ async function loadConfig() {
6935
7082
  }
6936
7083
  function replaceEnvVars2(str2) {
6937
7084
  return str2.replace(/\$([A-Z_][A-Z0-9_]*)/g, (_match, varName) => {
6938
- return process4.env[varName] || "";
7085
+ return process5.env[varName] || "";
6939
7086
  });
6940
7087
  }
6941
7088
  function isMarkdownFile2(path) {
@@ -9577,7 +9724,7 @@ var Client = class extends Protocol {
9577
9724
 
9578
9725
  // __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
9579
9726
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
9580
- import process5 from "node:process";
9727
+ import process6 from "node:process";
9581
9728
  import { PassThrough } from "node:stream";
9582
9729
 
9583
9730
  // __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
@@ -9609,7 +9756,7 @@ function serializeMessage(message) {
9609
9756
  }
9610
9757
 
9611
9758
  // __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
9612
- var DEFAULT_INHERITED_ENV_VARS = process5.platform === "win32" ? [
9759
+ var DEFAULT_INHERITED_ENV_VARS = process6.platform === "win32" ? [
9613
9760
  "APPDATA",
9614
9761
  "HOMEDRIVE",
9615
9762
  "HOMEPATH",
@@ -9629,7 +9776,7 @@ var DEFAULT_INHERITED_ENV_VARS = process5.platform === "win32" ? [
9629
9776
  function getDefaultEnvironment() {
9630
9777
  const env = {};
9631
9778
  for (const key of DEFAULT_INHERITED_ENV_VARS) {
9632
- const value = process5.env[key];
9779
+ const value = process6.env[key];
9633
9780
  if (value === void 0) {
9634
9781
  continue;
9635
9782
  }
@@ -9665,7 +9812,7 @@ var StdioClientTransport = class {
9665
9812
  },
9666
9813
  stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
9667
9814
  shell: false,
9668
- windowsHide: process5.platform === "win32" && isElectron(),
9815
+ windowsHide: process6.platform === "win32" && isElectron(),
9669
9816
  cwd: this._serverParams.cwd
9670
9817
  });
9671
9818
  this._process.on("error", (error) => {
@@ -9773,7 +9920,7 @@ var StdioClientTransport = class {
9773
9920
  }
9774
9921
  };
9775
9922
  function isElectron() {
9776
- return "type" in process5;
9923
+ return "type" in process6;
9777
9924
  }
9778
9925
 
9779
9926
  // __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
@@ -11697,8 +11844,8 @@ var InMemoryTransport = class _InMemoryTransport {
11697
11844
  };
11698
11845
 
11699
11846
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js
11700
- import process6 from "node:process";
11701
- var GEMINI_PREFERRED_FORMAT = process6.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
11847
+ import process7 from "node:process";
11848
+ var GEMINI_PREFERRED_FORMAT = process7.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
11702
11849
 
11703
11850
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js
11704
11851
  import { jsonrepair as jsonrepair2 } from "jsonrepair";
@@ -11771,7 +11918,7 @@ var cleanToolSchema = (schema) => {
11771
11918
 
11772
11919
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
11773
11920
  import { cwd } from "node:process";
11774
- import process7 from "node:process";
11921
+ import process8 from "node:process";
11775
11922
  import { createHash } from "node:crypto";
11776
11923
  function createTransport(def) {
11777
11924
  const defAny = def;
@@ -11812,7 +11959,7 @@ function createTransport(def) {
11812
11959
  command: defAny.command,
11813
11960
  args: defAny.args,
11814
11961
  env: {
11815
- ...process7.env,
11962
+ ...process8.env,
11816
11963
  ...defAny.env ?? {}
11817
11964
  },
11818
11965
  cwd: cwd()
@@ -12462,7 +12609,7 @@ function endSpan(span, error) {
12462
12609
  }
12463
12610
 
12464
12611
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-executor.js
12465
- import process8 from "node:process";
12612
+ import process9 from "node:process";
12466
12613
  var AgenticExecutor = class {
12467
12614
  name;
12468
12615
  allToolNames;
@@ -12482,13 +12629,13 @@ var AgenticExecutor = class {
12482
12629
  this.logger = createLogger(`mcpc.agentic.${name}`, server);
12483
12630
  this.toolSchemaMap = new Map(toolNameToDetailList);
12484
12631
  try {
12485
- this.tracingEnabled = process8.env.MCPC_TRACING_ENABLED === "true";
12632
+ this.tracingEnabled = process9.env.MCPC_TRACING_ENABLED === "true";
12486
12633
  if (this.tracingEnabled) {
12487
12634
  initializeTracing({
12488
12635
  enabled: true,
12489
12636
  serviceName: `mcpc-agentic-${name}`,
12490
- exportTo: process8.env.MCPC_TRACING_EXPORT ?? "otlp",
12491
- otlpEndpoint: process8.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
12637
+ exportTo: process9.env.MCPC_TRACING_EXPORT ?? "otlp",
12638
+ otlpEndpoint: process9.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
12492
12639
  });
12493
12640
  }
12494
12641
  } catch {
@@ -15202,12 +15349,12 @@ var ComposableMCPServer = class extends Server {
15202
15349
  };
15203
15350
 
15204
15351
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/env.js
15205
- import process9 from "node:process";
15206
- var isSCF = () => Boolean(process9.env.SCF_RUNTIME || process9.env.PROD_SCF);
15352
+ import process10 from "node:process";
15353
+ var isSCF = () => Boolean(process10.env.SCF_RUNTIME || process10.env.PROD_SCF);
15207
15354
  if (isSCF()) {
15208
15355
  console.log({
15209
15356
  isSCF: isSCF(),
15210
- SCF_RUNTIME: process9.env.SCF_RUNTIME
15357
+ SCF_RUNTIME: process10.env.SCF_RUNTIME
15211
15358
  });
15212
15359
  }
15213
15360
 
@@ -15290,8 +15437,8 @@ var createApp = (config) => {
15290
15437
 
15291
15438
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/server.js
15292
15439
  import { OpenAPIHono as OpenAPIHono2 } from "@hono/zod-openapi";
15293
- import process10 from "node:process";
15294
- var port = Number(process10.env.PORT || "3002");
15440
+ import process11 from "node:process";
15441
+ var port = Number(process11.env.PORT || "3002");
15295
15442
  var hostname = "0.0.0.0";
15296
15443
  async function main() {
15297
15444
  const config = await loadConfig();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpc-tech/cli",
3
- "version": "0.1.51",
3
+ "version": "0.1.52",
4
4
  "homepage": "https://jsr.io/@mcpc/cli",
5
5
  "dependencies": {
6
6
  "@hono/zod-openapi": "^0.19.2",