@mcpc-tech/cli 0.1.13 → 0.1.14

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
@@ -4391,12 +4391,81 @@ var createServer = async (config2) => {
4391
4391
  import { readFile } from "node:fs/promises";
4392
4392
  import { resolve as resolve2 } from "node:path";
4393
4393
  import process7 from "node:process";
4394
+ function createProxyConfig(args) {
4395
+ if (!args.proxyCommand || args.proxyCommand.length === 0) {
4396
+ console.error("Error: --proxy requires a command after --");
4397
+ console.error("Example: mcpc --proxy --transport-type stdio -- npx -y @wonderwhy-er/desktop-commander");
4398
+ process7.exit(1);
4399
+ }
4400
+ if (!args.transportType) {
4401
+ console.error("Error: --proxy requires --transport-type to be specified");
4402
+ console.error("Supported types: stdio, streamable-http, sse");
4403
+ console.error("Example: mcpc --proxy --transport-type stdio -- npx -y @wonderwhy-er/desktop-commander");
4404
+ process7.exit(1);
4405
+ }
4406
+ const validTransports = [
4407
+ "stdio",
4408
+ "streamable-http",
4409
+ "sse"
4410
+ ];
4411
+ if (!validTransports.includes(args.transportType)) {
4412
+ console.error(`Error: Invalid transport type '${args.transportType}'`);
4413
+ console.error(`Supported types: ${validTransports.join(", ")}`);
4414
+ process7.exit(1);
4415
+ }
4416
+ const command = args.proxyCommand[0];
4417
+ const commandArgs = args.proxyCommand.slice(1);
4418
+ let serverName = "mcp-server";
4419
+ const npmPackageMatch = command.match(/@[\w-]+\/([\w-]+)/) || commandArgs.join(" ").match(/@[\w-]+\/([\w-]+)/);
4420
+ if (npmPackageMatch) {
4421
+ serverName = npmPackageMatch[1];
4422
+ } else {
4423
+ const baseName = command.split("/").pop()?.replace(/\.js$/, "");
4424
+ if (baseName && baseName !== "npx" && baseName !== "node") {
4425
+ serverName = baseName;
4426
+ }
4427
+ }
4428
+ const config2 = {
4429
+ name: `${serverName}-proxy`,
4430
+ version: "0.1.0",
4431
+ capabilities: {
4432
+ tools: {},
4433
+ sampling: {}
4434
+ },
4435
+ agents: [
4436
+ {
4437
+ name: serverName,
4438
+ description: `Agentic tool to orchestrate ${serverName} MCP server tools:
4439
+ <tool name="${serverName}.__ALL__"/>`,
4440
+ deps: {
4441
+ mcpServers: {
4442
+ [serverName]: {
4443
+ command,
4444
+ args: commandArgs,
4445
+ transportType: args.transportType
4446
+ }
4447
+ }
4448
+ },
4449
+ options: {
4450
+ mode: args.mode || "agentic"
4451
+ }
4452
+ }
4453
+ ]
4454
+ };
4455
+ console.error(`Created proxy configuration for ${serverName}`);
4456
+ console.error(`Transport: ${args.transportType}`);
4457
+ console.error(`Command: ${command} ${commandArgs.join(" ")}`);
4458
+ if (args.mode) {
4459
+ console.error(`Mode: ${args.mode}`);
4460
+ }
4461
+ return config2;
4462
+ }
4394
4463
  function printHelp() {
4395
4464
  console.log(`
4396
4465
  MCPC CLI - Model Context Protocol Composer
4397
4466
 
4398
4467
  USAGE:
4399
- npx -y deno run -A jsr:@mcpc/cli/bin [OPTIONS]
4468
+ mcpc [OPTIONS]
4400
4469
 
4401
4470
  OPTIONS:
4402
4471
  --help, -h Show this help message
@@ -4407,6 +4476,18 @@ OPTIONS:
4407
4476
  Add custom HTTP header for URL fetching
4408
4477
  Format: "Key: Value" or "Key=Value"
4409
4478
  Can be used multiple times
4479
+ --mode <mode> Set execution mode for all agents
4480
+ Supported modes:
4481
+ - agentic: Fully autonomous agent mode (default)
4482
+ - agentic_workflow: Agent workflow mode with dynamic or predefined steps
4483
+ - agentic_sampling: Autonomous sampling mode for agentic execution
4484
+ - agentic_workflow_sampling: Autonomous sampling mode for workflow execution
4485
+ - code_execution: Code execution mode for most efficient token usage
4486
+ --proxy Proxy mode: automatically configure MCPC to wrap an MCP server
4487
+ Use with --transport-type to specify the transport
4488
+ Example: --proxy --transport-type stdio -- npx -y @wonderwhy-er/desktop-commander
4489
+ --transport-type <type> Transport type for proxy mode
4490
+ Supported types: stdio, streamable-http, sse
4410
4491
 
4411
4492
  ENVIRONMENT VARIABLES:
4412
4493
  MCPC_CONFIG Inline JSON configuration (same as --config)
@@ -4415,27 +4496,39 @@ ENVIRONMENT VARIABLES:
4415
4496
 
4416
4497
  EXAMPLES:
4417
4498
  # Show help
4418
- npx -y deno run -A jsr:@mcpc/cli/bin --help
4499
+ mcpc --help
4500
+
4501
+ # Proxy mode - wrap an existing MCP server (stdio)
4502
+ mcpc --proxy --transport-type stdio -- npx -y @wonderwhy-er/desktop-commander
4503
+
4504
+ # Proxy mode - wrap an MCP server (streamable-http)
4505
+ mcpc --proxy --transport-type streamable-http -- https://api.example.com/mcp
4506
+
4507
+ # Proxy mode - wrap an MCP server (sse)
4508
+ mcpc --proxy --transport-type sse -- https://api.example.com/sse
4419
4509
 
4420
4510
  # Load from URL
4421
- npx -y deno run -A jsr:@mcpc/cli/bin --config-url \\
4511
+ mcpc --config-url \\
4422
4512
  "https://raw.githubusercontent.com/mcpc-tech/mcpc/main/packages/cli/examples/configs/codex-fork.json"
4423
4513
 
4424
4514
  # Load from URL with custom headers
4425
- npx -y deno run -A jsr:@mcpc/cli/bin \\
4515
+ mcpc \\
4426
4516
  --config-url "https://api.example.com/config.json" \\
4427
4517
  -H "Authorization: Bearer token123" \\
4428
4518
  -H "X-Custom-Header: value"
4429
4519
 
4430
4520
  # Load from file
4431
- npx -y deno run -A jsr:@mcpc/cli/bin --config-file ./my-config.json
4521
+ mcpc --config-file ./my-config.json
4522
+
4523
+ # Override execution mode for all agents
4524
+ mcpc --config-file ./my-config.json --mode agentic_workflow
4432
4525
 
4433
4526
  # Using environment variable
4434
4527
  export MCPC_CONFIG='[{"name":"agent","description":"..."}]'
4435
- npx -y deno run -A jsr:@mcpc/cli/bin
4528
+ mcpc
4436
4529
 
4437
4530
  # Use default configuration (./mcpc.config.json)
4438
- npx -y deno run -A jsr:@mcpc/cli/bin
4531
+ mcpc
4439
4532
 
4440
4533
  CONFIGURATION:
4441
4534
  Configuration files support environment variable substitution using $VAR_NAME syntax.
@@ -4476,6 +4569,15 @@ function parseArgs() {
4476
4569
  }
4477
4570
  } else if (arg === "--help" || arg === "-h") {
4478
4571
  result.help = true;
4572
+ } else if (arg === "--proxy") {
4573
+ result.proxy = true;
4574
+ } else if (arg === "--transport-type" && i + 1 < args.length) {
4575
+ result.transportType = args[++i];
4576
+ } else if (arg === "--mode" && i + 1 < args.length) {
4577
+ result.mode = args[++i];
4578
+ } else if (arg === "--") {
4579
+ result.proxyCommand = args.slice(i + 1);
4580
+ break;
4479
4581
  }
4480
4582
  }
4481
4583
  return result;
@@ -4486,10 +4588,13 @@ async function loadConfig() {
4486
4588
  printHelp();
4487
4589
  process7.exit(0);
4488
4590
  }
4591
+ if (args.proxy) {
4592
+ return createProxyConfig(args);
4593
+ }
4489
4594
  if (args.config) {
4490
4595
  try {
4491
4596
  const parsed = JSON.parse(args.config);
4492
- return normalizeConfig(parsed);
4597
+ return applyModeOverride(normalizeConfig(parsed), args.mode);
4493
4598
  } catch (error) {
4494
4599
  console.error("Failed to parse --config argument:", error);
4495
4600
  throw error;
@@ -4498,7 +4603,7 @@ async function loadConfig() {
4498
4603
  if (process7.env.MCPC_CONFIG) {
4499
4604
  try {
4500
4605
  const parsed = JSON.parse(process7.env.MCPC_CONFIG);
4501
- return normalizeConfig(parsed);
4606
+ return applyModeOverride(normalizeConfig(parsed), args.mode);
4502
4607
  } catch (error) {
4503
4608
  console.error("Failed to parse MCPC_CONFIG environment variable:", error);
4504
4609
  throw error;
@@ -4519,7 +4624,7 @@ async function loadConfig() {
4519
4624
  }
4520
4625
  const content = await response.text();
4521
4626
  const parsed = JSON.parse(content);
4522
- return normalizeConfig(parsed);
4627
+ return applyModeOverride(normalizeConfig(parsed), args.mode);
4523
4628
  } catch (error) {
4524
4629
  console.error(`Failed to fetch config from ${configUrl}:`, error);
4525
4630
  throw error;
@@ -4530,7 +4635,7 @@ async function loadConfig() {
4530
4635
  try {
4531
4636
  const content = await readFile(configFile, "utf-8");
4532
4637
  const parsed = JSON.parse(content);
4533
- return normalizeConfig(parsed);
4638
+ return applyModeOverride(normalizeConfig(parsed), args.mode);
4534
4639
  } catch (error) {
4535
4640
  if (error.code === "ENOENT") {
4536
4641
  console.error(`Config file not found: ${configFile}`);
@@ -4545,7 +4650,7 @@ async function loadConfig() {
4545
4650
  try {
4546
4651
  const content = await readFile(defaultConfigPath, "utf-8");
4547
4652
  const parsed = JSON.parse(content);
4548
- return normalizeConfig(parsed);
4653
+ return applyModeOverride(normalizeConfig(parsed), args.mode);
4549
4654
  } catch (error) {
4550
4655
  if (error.code === "ENOENT") {
4551
4656
  return null;
@@ -4576,6 +4681,14 @@ function replaceEnvVarsInConfig(obj) {
4576
4681
  }
4577
4682
  return obj;
4578
4683
  }
4684
+ function applyModeOverride(config2, mode) {
4685
+ if (!mode) return config2;
4686
+ config2.agents.forEach((agent) => {
4687
+ if (!agent.options) agent.options = {};
4688
+ agent.options.mode = mode;
4689
+ });
4690
+ return config2;
4691
+ }
4579
4692
  function normalizeConfig(config2) {
4580
4693
  config2 = replaceEnvVarsInConfig(config2);
4581
4694
  if (Array.isArray(config2)) {
@@ -4606,7 +4719,14 @@ function normalizeAgents(agents) {
4606
4719
  }
4607
4720
 
4608
4721
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/bin.ts
4722
+ import { createCodeExecutionPlugin } from "@mcpc-tech/plugin-code-execution";
4609
4723
  var config = await loadConfig();
4724
+ config?.agents.forEach((agent) => {
4725
+ if (agent.plugins?.length ?? true) {
4726
+ agent.plugins = [];
4727
+ }
4728
+ agent.plugins?.push(createCodeExecutionPlugin());
4729
+ });
4610
4730
  if (config) {
4611
4731
  console.error(`Loaded configuration with ${config.agents.length} agent(s)`);
4612
4732
  } else {
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@mcpc-tech/cli",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "homepage": "https://jsr.io/@mcpc/cli",
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "@hono/zod-openapi": "^0.19.2",
8
+ "@mcpc-tech/plugin-code-execution": "^0.0.4",
8
9
  "@modelcontextprotocol/sdk": "^1.8.0",
9
10
  "zod": "^3.24.2",
10
11
  "@mcpc-tech/ripgrep-napi": "^0.0.4",
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sources":["../../../src/config/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CC,GAED,cAAc,iBAAiB,0BAAgC;AAK/D,iBAAiB;EACf;;GAEC,GACD,OAAO,MAAM;EACb;;GAEC,GACD,UAAU,MAAM;EAChB;;GAEC,GACD;IACE,QAAQ,OAAO,MAAM,EAAE,OAAO;IAC9B,WAAW,OAAO,MAAM,EAAE,OAAO;;EAEnC;;GAEC,GACD,QAAQ;;AAwHV;;;CAGC,GACD,OAAO,iBAAe,cAAc,QAAQ,aAAa,IAAI;AAoK7D;;CAEC,GACD,OAAO,iBAAS,eAAe,QAAQ,UAAU,GAAG,IAAI"}
1
+ {"version":3,"file":"loader.d.ts","sources":["../../../src/config/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CC,GAED,cAAc,iBAAiB,0BAAgC;AAK/D,iBAAiB;EACf;;GAEC,GACD,OAAO,MAAM;EACb;;GAEC,GACD,UAAU,MAAM;EAChB;;GAEC,GACD;IACE,QAAQ,OAAO,MAAM,EAAE,OAAO;IAC9B,WAAW,OAAO,MAAM,EAAE,OAAO;;EAEnC;;GAEC,GACD,QAAQ;;AAgQV;;;CAGC,GACD,OAAO,iBAAe,cAAc,QAAQ,aAAa,IAAI;AAqL7D;;CAEC,GACD,OAAO,iBAAS,eAAe,QAAQ,UAAU,GAAG,IAAI"}