@mcpc-tech/cli 0.1.20 → 0.1.21

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.
Files changed (3) hide show
  1. package/bin/mcpc.cjs +4899 -0
  2. package/bin/mcpc.mjs +132 -128
  3. package/package.json +11 -5
package/bin/mcpc.mjs CHANGED
@@ -80,7 +80,7 @@ function getUserConfigDir() {
80
80
  function getUserConfigPath() {
81
81
  return join(getUserConfigDir(), "config.json");
82
82
  }
83
- async function saveUserConfig(config2, newAgentName) {
83
+ async function saveUserConfig(config, newAgentName) {
84
84
  const configPath = getUserConfigPath();
85
85
  const configDir = dirname(configPath);
86
86
  try {
@@ -99,7 +99,7 @@ async function saveUserConfig(config2, newAgentName) {
99
99
  `);
100
100
  return;
101
101
  }
102
- existingConfig.agents.push(...config2.agents);
102
+ existingConfig.agents.push(...config.agents);
103
103
  await writeFile(configPath, JSON.stringify(existingConfig, null, 2), "utf-8");
104
104
  console.error(`
105
105
  \u2713 Added agent "${newAgentName}" (total: ${existingConfig.agents.length})
@@ -111,7 +111,7 @@ async function saveUserConfig(config2, newAgentName) {
111
111
  await mkdir(configDir, {
112
112
  recursive: true
113
113
  });
114
- await writeFile(configPath, JSON.stringify(config2, null, 2), "utf-8");
114
+ await writeFile(configPath, JSON.stringify(config, null, 2), "utf-8");
115
115
  console.error(`
116
116
  \u2713 Configuration saved to: ${configPath}
117
117
  Run: mcpc
@@ -142,7 +142,7 @@ async function createWrapConfig(args) {
142
142
  Command: ${spec.command} ${spec.args.join(" ")}`);
143
143
  }
144
144
  const agentName = args.name || `${serverNames.join("__")}--orchestrator`;
145
- const config2 = {
145
+ const config = {
146
146
  name: "mcpc-wrap-config",
147
147
  version: "0.1.0",
148
148
  capabilities: {
@@ -168,9 +168,9 @@ Mode: ${args.mode}` : "";
168
168
  console.error(`
169
169
  Created configuration for ${serverNames.length} MCP server(s)${modeInfo}`);
170
170
  if (args.saveConfig) {
171
- await saveUserConfig(config2, agentName);
171
+ await saveUserConfig(config, agentName);
172
172
  }
173
- return config2;
173
+ return config;
174
174
  }
175
175
  function printHelp() {
176
176
  console.log(`
@@ -447,25 +447,25 @@ function replaceEnvVarsInConfig(obj) {
447
447
  }
448
448
  return obj;
449
449
  }
450
- function applyModeOverride(config2, mode) {
451
- if (!mode) return config2;
452
- config2.agents.forEach((agent) => {
450
+ function applyModeOverride(config, mode) {
451
+ if (!mode) return config;
452
+ config.agents.forEach((agent) => {
453
453
  if (!agent.options) agent.options = {};
454
454
  agent.options.mode = mode;
455
455
  });
456
- return config2;
456
+ return config;
457
457
  }
458
- function normalizeConfig(config2) {
459
- config2 = replaceEnvVarsInConfig(config2);
460
- if (Array.isArray(config2)) {
458
+ function normalizeConfig(config) {
459
+ config = replaceEnvVarsInConfig(config);
460
+ if (Array.isArray(config)) {
461
461
  return {
462
462
  name: "mcpc-server",
463
463
  version: "0.1.0",
464
- agents: normalizeAgents(config2)
464
+ agents: normalizeAgents(config)
465
465
  };
466
466
  }
467
- if (config2 && typeof config2 === "object") {
468
- const cfg = config2;
467
+ if (config && typeof config === "object") {
468
+ const cfg = config;
469
469
  return {
470
470
  name: cfg.name || "mcpc-server",
471
471
  version: cfg.version || "0.1.0",
@@ -767,13 +767,13 @@ async function getOrCreateMcpClient(defKey, def) {
767
767
  if (entry) entry.refCount += 1;
768
768
  return client;
769
769
  }
770
- const transport2 = createTransport(def);
770
+ const transport = createTransport(def);
771
771
  const connecting = (async () => {
772
772
  const client = new Client({
773
773
  name: `mcp_${shortHash(defSignature(def))}`,
774
774
  version: "1.0.0"
775
775
  });
776
- await client.connect(transport2, {
776
+ await client.connect(transport, {
777
777
  timeout: 6e4 * 10
778
778
  });
779
779
  return client;
@@ -920,10 +920,10 @@ var createConfigPlugin = () => ({
920
920
  version: "1.0.0",
921
921
  enforce: "pre",
922
922
  transformTool: (tool, context2) => {
923
- const server2 = context2.server;
924
- const config2 = server2.findToolConfig?.(context2.toolName);
925
- if (config2?.description) {
926
- tool.description = config2.description;
923
+ const server = context2.server;
924
+ const config = server.findToolConfig?.(context2.toolName);
925
+ if (config?.description) {
926
+ tool.description = config.description;
927
927
  }
928
928
  return tool;
929
929
  }
@@ -936,19 +936,19 @@ var createToolNameMappingPlugin = () => ({
936
936
  version: "1.0.0",
937
937
  enforce: "pre",
938
938
  transformTool: (tool, context2) => {
939
- const server2 = context2.server;
939
+ const server = context2.server;
940
940
  const toolName = context2.toolName;
941
941
  const originalName = tool._originalName || toolName;
942
942
  const dotNotation = originalName.replace(/_/g, ".");
943
943
  const underscoreNotation = originalName.replace(/\./g, "_");
944
- if (dotNotation !== originalName && server2.toolNameMapping) {
945
- server2.toolNameMapping.set(dotNotation, toolName);
944
+ if (dotNotation !== originalName && server.toolNameMapping) {
945
+ server.toolNameMapping.set(dotNotation, toolName);
946
946
  }
947
- if (underscoreNotation !== originalName && server2.toolNameMapping) {
948
- server2.toolNameMapping.set(underscoreNotation, toolName);
947
+ if (underscoreNotation !== originalName && server.toolNameMapping) {
948
+ server.toolNameMapping.set(underscoreNotation, toolName);
949
949
  }
950
- if (originalName !== toolName && server2.toolNameMapping) {
951
- server2.toolNameMapping.set(originalName, toolName);
950
+ if (originalName !== toolName && server.toolNameMapping) {
951
+ server.toolNameMapping.set(originalName, toolName);
952
952
  }
953
953
  return tool;
954
954
  }
@@ -970,12 +970,12 @@ var MCPLogger = class _MCPLogger {
970
970
  server;
971
971
  loggerName;
972
972
  minLevel = "debug";
973
- constructor(loggerName = "mcpc", server2) {
973
+ constructor(loggerName = "mcpc", server) {
974
974
  this.loggerName = loggerName;
975
- this.server = server2;
975
+ this.server = server;
976
976
  }
977
- setServer(server2) {
978
- this.server = server2;
977
+ setServer(server) {
978
+ this.server = server;
979
979
  }
980
980
  setLevel(level) {
981
981
  this.minLevel = level;
@@ -1032,8 +1032,8 @@ var MCPLogger = class _MCPLogger {
1032
1032
  }
1033
1033
  };
1034
1034
  var logger = new MCPLogger("mcpc");
1035
- function createLogger(name, server2) {
1036
- return new MCPLogger(name, server2);
1035
+ function createLogger(name, server) {
1036
+ return new MCPLogger(name, server);
1037
1037
  }
1038
1038
 
1039
1039
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/built-in/logging-plugin.js
@@ -1053,10 +1053,10 @@ var createLoggingPlugin = (options = {}) => {
1053
1053
  await logger2.info(`[${context2.toolName}] Composition complete`);
1054
1054
  await logger2.info(` \u251C\u2500 Plugins: ${context2.pluginNames.join(", ")}`);
1055
1055
  const { stats } = context2;
1056
- const server2 = context2.server;
1057
- const publicTools = Array.from(new Set(server2.getPublicToolNames().map(String)));
1058
- const internalTools = Array.from(new Set(server2.getInternalToolNames().map(String)));
1059
- const hiddenTools = Array.from(new Set(server2.getHiddenToolNames().map(String)));
1056
+ const server = context2.server;
1057
+ const publicTools = Array.from(new Set(server.getPublicToolNames().map(String)));
1058
+ const internalTools = Array.from(new Set(server.getInternalToolNames().map(String)));
1059
+ const hiddenTools = Array.from(new Set(server.getHiddenToolNames().map(String)));
1060
1060
  const normalInternal = internalTools.filter((name) => !hiddenTools.includes(name));
1061
1061
  if (publicTools.length > 0) {
1062
1062
  await logger2.info(` \u251C\u2500 Public: ${publicTools.join(", ")}`);
@@ -1471,11 +1471,11 @@ import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from "@opentelemetry/semantic
1471
1471
  var tracerProvider = null;
1472
1472
  var tracer = null;
1473
1473
  var isInitialized = false;
1474
- function initializeTracing(config2 = {}) {
1474
+ function initializeTracing(config = {}) {
1475
1475
  if (isInitialized) {
1476
1476
  return;
1477
1477
  }
1478
- const { enabled = true, serviceName = "mcpc-sampling", serviceVersion = "0.2.0", exportTo = "console", otlpEndpoint = "http://localhost:4318/v1/traces", otlpHeaders = {} } = config2;
1478
+ const { enabled = true, serviceName = "mcpc-sampling", serviceVersion = "0.2.0", exportTo = "console", otlpEndpoint = "http://localhost:4318/v1/traces", otlpHeaders = {} } = config;
1479
1479
  if (!enabled) {
1480
1480
  isInitialized = true;
1481
1481
  return;
@@ -1538,14 +1538,14 @@ var AgenticExecutor = class {
1538
1538
  USE_TOOL_KEY;
1539
1539
  logger;
1540
1540
  tracingEnabled;
1541
- constructor(name, allToolNames, toolNameToDetailList, server2, USE_TOOL_KEY = "useTool") {
1541
+ constructor(name, allToolNames, toolNameToDetailList, server, USE_TOOL_KEY = "useTool") {
1542
1542
  this.name = name;
1543
1543
  this.allToolNames = allToolNames;
1544
1544
  this.toolNameToDetailList = toolNameToDetailList;
1545
- this.server = server2;
1545
+ this.server = server;
1546
1546
  this.USE_TOOL_KEY = USE_TOOL_KEY;
1547
1547
  this.tracingEnabled = false;
1548
- this.logger = createLogger(`mcpc.agentic.${name}`, server2);
1548
+ this.logger = createLogger(`mcpc.agentic.${name}`, server);
1549
1549
  try {
1550
1550
  this.tracingEnabled = process5.env.MCPC_TRACING_ENABLED === "true";
1551
1551
  if (this.tracingEnabled) {
@@ -2151,9 +2151,9 @@ NOTE: The \`steps\` has been predefined` : `**You MUST execute this tool with fo
2151
2151
  }
2152
2152
 
2153
2153
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-tool-registrar.js
2154
- function registerAgenticTool(server2, { description, name, allToolNames, depGroups, toolNameToDetailList }) {
2154
+ function registerAgenticTool(server, { description, name, allToolNames, depGroups, toolNameToDetailList }) {
2155
2155
  const createArgsDef = createArgsDefFactory(name, allToolNames, depGroups, void 0, void 0);
2156
- const agenticExecutor = new AgenticExecutor(name, allToolNames, toolNameToDetailList, server2);
2156
+ const agenticExecutor = new AgenticExecutor(name, allToolNames, toolNameToDetailList, server);
2157
2157
  description = CompiledPrompts.autonomousExecution({
2158
2158
  toolName: name,
2159
2159
  description
@@ -2164,7 +2164,7 @@ function registerAgenticTool(server2, { description, name, allToolNames, depGrou
2164
2164
  type: "object",
2165
2165
  properties: {}
2166
2166
  };
2167
- server2.tool(name, description, jsonSchema(createModelCompatibleJSONSchema(schema)), async (args) => {
2167
+ server.tool(name, description, jsonSchema(createModelCompatibleJSONSchema(schema)), async (args) => {
2168
2168
  return await agenticExecutor.execute(args, schema);
2169
2169
  });
2170
2170
  }
@@ -2367,12 +2367,12 @@ var WorkflowExecutor = class {
2367
2367
  predefinedSteps;
2368
2368
  ensureStepActions;
2369
2369
  toolNameToIdMapping;
2370
- constructor(name, allToolNames, toolNameToDetailList, createArgsDef, server2, predefinedSteps, ensureStepActions, toolNameToIdMapping) {
2370
+ constructor(name, allToolNames, toolNameToDetailList, createArgsDef, server, predefinedSteps, ensureStepActions, toolNameToIdMapping) {
2371
2371
  this.name = name;
2372
2372
  this.allToolNames = allToolNames;
2373
2373
  this.toolNameToDetailList = toolNameToDetailList;
2374
2374
  this.createArgsDef = createArgsDef;
2375
- this.server = server2;
2375
+ this.server = server;
2376
2376
  this.predefinedSteps = predefinedSteps;
2377
2377
  this.ensureStepActions = ensureStepActions;
2378
2378
  this.toolNameToIdMapping = toolNameToIdMapping;
@@ -2667,9 +2667,9 @@ ${this.formatProgress(state)}`
2667
2667
  };
2668
2668
 
2669
2669
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/workflow/workflow-tool-registrar.js
2670
- function registerAgenticWorkflowTool(server2, { description, name, allToolNames, depGroups, toolNameToDetailList, predefinedSteps, ensureStepActions, toolNameToIdMapping }) {
2670
+ function registerAgenticWorkflowTool(server, { description, name, allToolNames, depGroups, toolNameToDetailList, predefinedSteps, ensureStepActions, toolNameToIdMapping }) {
2671
2671
  const createArgsDef = createArgsDefFactory(name, allToolNames, depGroups, predefinedSteps, ensureStepActions);
2672
- const workflowExecutor = new WorkflowExecutor(name, allToolNames, toolNameToDetailList, createArgsDef, server2, predefinedSteps, ensureStepActions, toolNameToIdMapping);
2672
+ const workflowExecutor = new WorkflowExecutor(name, allToolNames, toolNameToDetailList, createArgsDef, server, predefinedSteps, ensureStepActions, toolNameToIdMapping);
2673
2673
  const workflowState = new WorkflowState();
2674
2674
  const planningInstructions = predefinedSteps ? "- Set `init: true` (steps are predefined)" : "- Set `init: true` and define complete `steps` array";
2675
2675
  const baseDescription = CompiledPrompts.workflowExecution({
@@ -2679,7 +2679,7 @@ function registerAgenticWorkflowTool(server2, { description, name, allToolNames,
2679
2679
  });
2680
2680
  const argsDef = createArgsDef.forTool();
2681
2681
  const toolDescription = createArgsDef.forToolDescription(baseDescription, workflowState);
2682
- server2.tool(name, toolDescription, jsonSchema(createModelCompatibleJSONSchema(argsDef)), async (args) => {
2682
+ server.tool(name, toolDescription, jsonSchema(createModelCompatibleJSONSchema(argsDef)), async (args) => {
2683
2683
  try {
2684
2684
  return await workflowExecutor.execute(args, workflowState);
2685
2685
  } catch (error) {
@@ -2733,24 +2733,24 @@ var BaseSamplingExecutor = class {
2733
2733
  logger;
2734
2734
  tracingEnabled;
2735
2735
  summarize;
2736
- constructor(name, description, allToolNames, toolNameToDetailList, server2, config2) {
2736
+ constructor(name, description, allToolNames, toolNameToDetailList, server, config) {
2737
2737
  this.name = name;
2738
2738
  this.description = description;
2739
2739
  this.allToolNames = allToolNames;
2740
2740
  this.toolNameToDetailList = toolNameToDetailList;
2741
- this.server = server2;
2741
+ this.server = server;
2742
2742
  this.conversationHistory = [];
2743
2743
  this.maxIterations = 55;
2744
2744
  this.currentIteration = 0;
2745
2745
  this.tracingEnabled = false;
2746
2746
  this.summarize = true;
2747
- if (config2?.maxIterations) {
2748
- this.maxIterations = config2.maxIterations;
2747
+ if (config?.maxIterations) {
2748
+ this.maxIterations = config.maxIterations;
2749
2749
  }
2750
- if (config2?.summarize !== void 0) {
2751
- this.summarize = config2.summarize;
2750
+ if (config?.summarize !== void 0) {
2751
+ this.summarize = config.summarize;
2752
2752
  }
2753
- this.logger = createLogger(`mcpc.sampling.${name}`, server2);
2753
+ this.logger = createLogger(`mcpc.sampling.${name}`, server);
2754
2754
  try {
2755
2755
  const tracingConfig = {
2756
2756
  enabled: process6.env.MCPC_TRACING_ENABLED === "true",
@@ -3085,9 +3085,9 @@ VALID: {"key":"value"}` }) {
3085
3085
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/sampling/agentic-sampling-executor.js
3086
3086
  var SamplingExecutor = class extends BaseSamplingExecutor {
3087
3087
  agenticExecutor;
3088
- constructor(name, description, allToolNames, toolNameToDetailList, server2, config2) {
3089
- super(name, description, allToolNames, toolNameToDetailList, server2, config2);
3090
- this.agenticExecutor = new AgenticExecutor(name, allToolNames, toolNameToDetailList, server2);
3088
+ constructor(name, description, allToolNames, toolNameToDetailList, server, config) {
3089
+ super(name, description, allToolNames, toolNameToDetailList, server, config);
3090
+ this.agenticExecutor = new AgenticExecutor(name, allToolNames, toolNameToDetailList, server);
3091
3091
  }
3092
3092
  buildDepGroups() {
3093
3093
  const depGroups = {};
@@ -3188,9 +3188,9 @@ When you need to use a tool, specify the tool name in 'action' and provide tool-
3188
3188
  };
3189
3189
 
3190
3190
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-sampling-registrar.js
3191
- function registerAgenticSamplingTool(server2, { description, name, allToolNames, depGroups, toolNameToDetailList, samplingConfig }) {
3191
+ function registerAgenticSamplingTool(server, { description, name, allToolNames, depGroups, toolNameToDetailList, samplingConfig }) {
3192
3192
  const createArgsDef = createArgsDefFactory(name, allToolNames, depGroups, void 0, void 0);
3193
- const samplingExecutor = new SamplingExecutor(name, description, allToolNames, toolNameToDetailList, server2, samplingConfig);
3193
+ const samplingExecutor = new SamplingExecutor(name, description, allToolNames, toolNameToDetailList, server, samplingConfig);
3194
3194
  description = CompiledPrompts.samplingExecution({
3195
3195
  toolName: name,
3196
3196
  description,
@@ -3201,7 +3201,7 @@ function registerAgenticSamplingTool(server2, { description, name, allToolNames,
3201
3201
  type: "object",
3202
3202
  properties: {}
3203
3203
  };
3204
- server2.tool(name, description, jsonSchema(createModelCompatibleJSONSchema(schema)), async (args) => {
3204
+ server.tool(name, description, jsonSchema(createModelCompatibleJSONSchema(schema)), async (args) => {
3205
3205
  return await samplingExecutor.executeSampling(args, schema);
3206
3206
  });
3207
3207
  }
@@ -3231,9 +3231,9 @@ var WorkflowSamplingExecutor = class extends BaseSamplingExecutor {
3231
3231
  createArgsDef;
3232
3232
  predefinedSteps;
3233
3233
  workflowExecutor;
3234
- constructor(name, description, allToolNames, toolNameToDetailList, createArgsDef, server2, predefinedSteps, config2) {
3235
- super(name, description, allToolNames, toolNameToDetailList, server2, config2), this.createArgsDef = createArgsDef, this.predefinedSteps = predefinedSteps;
3236
- this.workflowExecutor = new WorkflowExecutor(name, allToolNames, toolNameToDetailList, createArgsDef, server2, predefinedSteps);
3234
+ constructor(name, description, allToolNames, toolNameToDetailList, createArgsDef, server, predefinedSteps, config) {
3235
+ super(name, description, allToolNames, toolNameToDetailList, server, config), this.createArgsDef = createArgsDef, this.predefinedSteps = predefinedSteps;
3236
+ this.workflowExecutor = new WorkflowExecutor(name, allToolNames, toolNameToDetailList, createArgsDef, server, predefinedSteps);
3237
3237
  }
3238
3238
  async executeWorkflowSampling(args, schema, state) {
3239
3239
  const validationResult = validateSchema(args, schema);
@@ -3301,9 +3301,9 @@ Current Task: <user_request>${args.userRequest}</user_request>${contextInfo}`;
3301
3301
  };
3302
3302
 
3303
3303
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/workflow/workflow-sampling-registrar.js
3304
- function registerWorkflowSamplingTool(server2, { description, name, allToolNames, depGroups, toolNameToDetailList, predefinedSteps, samplingConfig, ensureStepActions, toolNameToIdMapping: _toolNameToIdMapping }) {
3304
+ function registerWorkflowSamplingTool(server, { description, name, allToolNames, depGroups, toolNameToDetailList, predefinedSteps, samplingConfig, ensureStepActions, toolNameToIdMapping: _toolNameToIdMapping }) {
3305
3305
  const createArgsDef = createArgsDefFactory(name, allToolNames, depGroups, predefinedSteps, ensureStepActions);
3306
- const workflowSamplingExecutor = new WorkflowSamplingExecutor(name, description, allToolNames, toolNameToDetailList, createArgsDef, server2, predefinedSteps, samplingConfig);
3306
+ const workflowSamplingExecutor = new WorkflowSamplingExecutor(name, description, allToolNames, toolNameToDetailList, createArgsDef, server, predefinedSteps, samplingConfig);
3307
3307
  const workflowState = new WorkflowState();
3308
3308
  const baseDescription = CompiledPrompts.samplingExecution({
3309
3309
  toolName: name,
@@ -3315,7 +3315,7 @@ function registerWorkflowSamplingTool(server2, { description, name, allToolNames
3315
3315
  type: "object",
3316
3316
  properties: {}
3317
3317
  };
3318
- server2.tool(name, baseDescription, jsonSchema(createModelCompatibleJSONSchema(schema)), async (args) => {
3318
+ server.tool(name, baseDescription, jsonSchema(createModelCompatibleJSONSchema(schema)), async (args) => {
3319
3319
  try {
3320
3320
  return await workflowSamplingExecutor.executeWorkflowSampling(args, schema, workflowState);
3321
3321
  } catch (error) {
@@ -3565,11 +3565,11 @@ var PluginManager = class {
3565
3565
  server;
3566
3566
  plugins;
3567
3567
  logger;
3568
- constructor(server2) {
3569
- this.server = server2;
3568
+ constructor(server) {
3569
+ this.server = server;
3570
3570
  this.plugins = [];
3571
3571
  this.logger = createLogger("mcpc.plugin-manager");
3572
- this.logger.setServer(server2);
3572
+ this.logger.setServer(server);
3573
3573
  }
3574
3574
  /**
3575
3575
  * Get all registered plugins
@@ -3795,27 +3795,27 @@ var ToolManager = class {
3795
3795
  * Check if a tool is public (exposed to MCP clients)
3796
3796
  */
3797
3797
  isPublic(name) {
3798
- const config2 = this.toolConfigs.get(name);
3799
- return config2?.visibility?.public === true;
3798
+ const config = this.toolConfigs.get(name);
3799
+ return config?.visibility?.public === true;
3800
3800
  }
3801
3801
  /**
3802
3802
  * Check if a tool is hidden from agent context
3803
3803
  */
3804
3804
  isHidden(name) {
3805
- const config2 = this.toolConfigs.get(name);
3806
- return config2?.visibility?.hidden === true;
3805
+ const config = this.toolConfigs.get(name);
3806
+ return config?.visibility?.hidden === true;
3807
3807
  }
3808
3808
  /**
3809
3809
  * Get all public tool names (exposed to MCP clients)
3810
3810
  */
3811
3811
  getPublicToolNames() {
3812
- return Array.from(this.toolConfigs.entries()).filter(([_name, config2]) => config2.visibility?.public === true).map(([name]) => this.resolveToolName(name) ?? name);
3812
+ return Array.from(this.toolConfigs.entries()).filter(([_name, config]) => config.visibility?.public === true).map(([name]) => this.resolveToolName(name) ?? name);
3813
3813
  }
3814
3814
  /**
3815
3815
  * Get all hidden tool names
3816
3816
  */
3817
3817
  getHiddenToolNames() {
3818
- return Array.from(this.toolConfigs.entries()).filter(([_name, config2]) => config2.visibility?.hidden === true).map(([name]) => this.resolveToolName(name) ?? name);
3818
+ return Array.from(this.toolConfigs.entries()).filter(([_name, config]) => config.visibility?.hidden === true).map(([name]) => this.resolveToolName(name) ?? name);
3819
3819
  }
3820
3820
  /**
3821
3821
  * Get all public tools
@@ -3867,8 +3867,8 @@ var ToolManager = class {
3867
3867
  /**
3868
3868
  * Configure tool behavior
3869
3869
  */
3870
- configTool(toolName, config2) {
3871
- this.toolConfigs.set(toolName, config2);
3870
+ configTool(toolName, config) {
3871
+ this.toolConfigs.set(toolName, config);
3872
3872
  }
3873
3873
  /**
3874
3874
  * Get tool configuration
@@ -3907,8 +3907,8 @@ var ToolManager = class {
3907
3907
  */
3908
3908
  getHiddenToolSchema(name) {
3909
3909
  const tool = this.toolRegistry.get(name);
3910
- const config2 = this.toolConfigs.get(name);
3911
- if (tool && config2?.visibility?.hidden && tool.schema) {
3910
+ const config = this.toolConfigs.get(name);
3911
+ if (tool && config?.visibility?.hidden && tool.schema) {
3912
3912
  return {
3913
3913
  description: tool.description,
3914
3914
  schema: tool.schema
@@ -3991,9 +3991,9 @@ function updateRefPaths(schema, wrapperPath) {
3991
3991
  }
3992
3992
 
3993
3993
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/compose-helpers.js
3994
- async function processToolsWithPlugins(server2, _externalTools, mode) {
3995
- const toolManager = server2.toolManager;
3996
- const pluginManager = server2.pluginManager;
3994
+ async function processToolsWithPlugins(server, _externalTools, mode) {
3995
+ const toolManager = server.toolManager;
3996
+ const pluginManager = server.pluginManager;
3997
3997
  for (const [toolId, toolData] of toolManager.getToolEntries()) {
3998
3998
  const defaultSchema = {
3999
3999
  type: "object",
@@ -4008,7 +4008,7 @@ async function processToolsWithPlugins(server2, _externalTools, mode) {
4008
4008
  };
4009
4009
  const processedTool = await pluginManager.applyTransformToolHooks(tempTool, {
4010
4010
  toolName: toolId,
4011
- server: server2,
4011
+ server,
4012
4012
  mode,
4013
4013
  originalTool: {
4014
4014
  ...tempTool
@@ -4018,9 +4018,9 @@ async function processToolsWithPlugins(server2, _externalTools, mode) {
4018
4018
  toolManager.registerTool(toolId, processedTool.description || toolData.description, processedTool.inputSchema, processedTool.execute);
4019
4019
  }
4020
4020
  }
4021
- function buildDependencyGroups(toolNameToDetailList, hiddenToolNames, publicToolNames, server2) {
4021
+ function buildDependencyGroups(toolNameToDetailList, hiddenToolNames, publicToolNames, server) {
4022
4022
  const depGroups = {};
4023
- const toolManager = server2.toolManager;
4023
+ const toolManager = server.toolManager;
4024
4024
  toolNameToDetailList.forEach(([toolName, tool]) => {
4025
4025
  const resolvedName = toolManager.resolveToolName(toolName);
4026
4026
  if (hiddenToolNames.includes(resolvedName ?? "") || publicToolNames.includes(resolvedName ?? "")) {
@@ -4236,8 +4236,8 @@ var ComposableMCPServer = class extends Server {
4236
4236
  /**
4237
4237
  * Configure tool behavior
4238
4238
  */
4239
- configTool(toolName, config2) {
4240
- this.toolManager.configTool(toolName, config2);
4239
+ configTool(toolName, config) {
4240
+ this.toolManager.configTool(toolName, config);
4241
4241
  }
4242
4242
  /**
4243
4243
  * Get tool configuration
@@ -4480,27 +4480,27 @@ function parseMcpcConfigs(conf) {
4480
4480
  return conf ?? [];
4481
4481
  }
4482
4482
  async function mcpc(serverConf, composeConf, setupCallback) {
4483
- const server2 = new ComposableMCPServer(...serverConf);
4483
+ const server = new ComposableMCPServer(...serverConf);
4484
4484
  const parsed = parseMcpcConfigs(composeConf);
4485
- await server2.initBuiltInPlugins();
4485
+ await server.initBuiltInPlugins();
4486
4486
  for (const mcpcConfig of parsed) {
4487
4487
  if (mcpcConfig.plugins) {
4488
4488
  for (const plugin of mcpcConfig.plugins) {
4489
4489
  if (typeof plugin === "string") {
4490
- await server2.loadPluginFromPath(plugin);
4490
+ await server.loadPluginFromPath(plugin);
4491
4491
  } else {
4492
- await server2.addPlugin(plugin);
4492
+ await server.addPlugin(plugin);
4493
4493
  }
4494
4494
  }
4495
4495
  }
4496
4496
  }
4497
4497
  if (setupCallback) {
4498
- await setupCallback(server2);
4498
+ await setupCallback(server);
4499
4499
  }
4500
4500
  for (const mcpcConfig of parsed) {
4501
- await server2.compose(mcpcConfig.name, mcpcConfig.description ?? "", mcpcConfig.deps, mcpcConfig.options);
4501
+ await server.compose(mcpcConfig.name, mcpcConfig.description ?? "", mcpcConfig.deps, mcpcConfig.options);
4502
4502
  }
4503
- return server2;
4503
+ return server;
4504
4504
  }
4505
4505
 
4506
4506
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/large-result.js
@@ -4523,8 +4523,8 @@ function createSearchPlugin(options = {}) {
4523
4523
  return {
4524
4524
  name: "plugin-search",
4525
4525
  version: "1.0.0",
4526
- configureServer: (server2) => {
4527
- server2.tool("search-tool-result", `Search for text patterns in files and directories. Use this to find specific content, code, or information within files. Provide a simple literal string or a regular expression. If your pattern is a regex, ensure it's valid; otherwise use quotes or escape special characters to treat it as a literal string.
4526
+ configureServer: (server) => {
4527
+ server.tool("search-tool-result", `Search for text patterns in files and directories. Use this to find specific content, code, or information within files. Provide a simple literal string or a regular expression. If your pattern is a regex, ensure it's valid; otherwise use quotes or escape special characters to treat it as a literal string.
4528
4528
  Only search within the allowed directory: ${allowedSearchDir}`, jsonSchema({
4529
4529
  type: "object",
4530
4530
  properties: {
@@ -4750,11 +4750,11 @@ function createLargeResultPlugin(options = {}) {
4750
4750
  name: "plugin-large-result-handler",
4751
4751
  version: "1.0.0",
4752
4752
  dependencies: [],
4753
- configureServer: async (server2) => {
4754
- if (!configuredServers.has(server2)) {
4753
+ configureServer: async (server) => {
4754
+ if (!configuredServers.has(server)) {
4755
4755
  const searchPlugin = createSearchPlugin(searchConfig);
4756
- await server2.addPlugin(searchPlugin);
4757
- configuredServers.set(server2, true);
4756
+ await server.addPlugin(searchPlugin);
4757
+ configuredServers.set(server, true);
4758
4758
  }
4759
4759
  },
4760
4760
  transformTool: (tool, context2) => {
@@ -4816,8 +4816,8 @@ var defaultLargeResultPlugin = createLargeResultPlugin({
4816
4816
 
4817
4817
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/app.js
4818
4818
  import { codeExecutionPlugin } from "@mcpc-tech/plugin-code-execution";
4819
- var createServer = async (config2) => {
4820
- const serverConfig = config2 || {
4819
+ var createServer = async (config) => {
4820
+ const serverConfig = config || {
4821
4821
  name: "mcpc-server",
4822
4822
  version: "0.1.0",
4823
4823
  agents: [
@@ -4851,24 +4851,28 @@ var createServer = async (config2) => {
4851
4851
 
4852
4852
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/bin.ts
4853
4853
  import { createCodeExecutionPlugin } from "@mcpc-tech/plugin-code-execution";
4854
- var config = await loadConfig();
4855
- config?.agents.forEach((agent) => {
4856
- if (agent.plugins?.length ?? true) {
4857
- agent.plugins = [];
4858
- }
4859
- agent.plugins?.push(
4860
- createCodeExecutionPlugin({
4861
- sandbox: {
4862
- timeout: 3e5
4863
- }
4864
- })
4865
- );
4866
- });
4867
- if (config) {
4868
- console.error(`Loaded configuration with ${config.agents.length} agent(s)`);
4869
- } else {
4870
- console.error("No configuration found, using default example configuration");
4871
- }
4872
- var server = await createServer(config || void 0);
4873
- var transport = new StdioServerTransport();
4874
- await server.connect(transport);
4854
+ (async () => {
4855
+ const config = await loadConfig();
4856
+ config?.agents.forEach((agent) => {
4857
+ if (agent.plugins?.length ?? true) {
4858
+ agent.plugins = [];
4859
+ }
4860
+ agent.plugins?.push(
4861
+ createCodeExecutionPlugin({
4862
+ sandbox: {
4863
+ timeout: 3e5
4864
+ }
4865
+ })
4866
+ );
4867
+ });
4868
+ if (config) {
4869
+ console.error(`Loaded configuration with ${config.agents.length} agent(s)`);
4870
+ } else {
4871
+ console.error(
4872
+ "No configuration found, using default example configuration"
4873
+ );
4874
+ }
4875
+ const server = await createServer(config || void 0);
4876
+ const transport = new StdioServerTransport();
4877
+ await server.connect(transport);
4878
+ })();
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@mcpc-tech/cli",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "homepage": "https://jsr.io/@mcpc/cli",
5
- "type": "module",
6
5
  "dependencies": {
7
6
  "@hono/zod-openapi": "^0.19.2",
8
7
  "@mcpc-tech/plugin-code-execution": "^0.0.8",
@@ -24,8 +23,14 @@
24
23
  "jsonrepair": "^3.13.0"
25
24
  },
26
25
  "exports": {
27
- "./bin/mcpc": "./bin/mcpc.mjs",
28
- ".": "./bin/mcpc.mjs"
26
+ "./bin/mcpc": {
27
+ "import": "./bin/mcpc.mjs",
28
+ "require": "./bin/mcpc.cjs"
29
+ },
30
+ ".": {
31
+ "import": "./bin/mcpc.mjs",
32
+ "require": "./bin/mcpc.cjs"
33
+ }
29
34
  },
30
35
  "repository": {
31
36
  "type": "git",
@@ -37,5 +42,6 @@
37
42
  "bin": {
38
43
  "mcpc": "./bin/mcpc.mjs"
39
44
  },
40
- "main": "./bin/mcpc.mjs"
45
+ "main": "./bin/mcpc.cjs",
46
+ "module": "./bin/mcpc.mjs"
41
47
  }