@mcpc-tech/cli 0.1.3 → 0.1.5

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/README.md CHANGED
@@ -1,11 +1,20 @@
1
1
  # MCPC CLI
2
2
 
3
+ [![NPM Version](https://img.shields.io/npm/v/@mcpc-tech/cli)](https://www.npmjs.com/package/@mcpc-tech/cli)
4
+ [![JSR](https://jsr.io/badges/@mcpc/cli)](https://jsr.io/@mcpc/cli)
5
+
3
6
  CLI server for MCPC with configuration support.
4
7
 
8
+ > **Note:** This package is published as `@mcpc-tech/cli` on npm and `@mcpc/cli`
9
+ > on JSR.
10
+
5
11
  ## Quick Start
6
12
 
7
13
  ```bash
8
- # Show help
14
+ # Using npm
15
+ npx -y @mcpc-tech/cli --help
16
+
17
+ # Using JSR
9
18
  npx -y deno run -A jsr:@mcpc/cli/bin --help
10
19
 
11
20
  # Load configuration from URL
package/bin/mcpc.mjs CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env node
2
+ import { createRequire } from 'node:module';
3
+ const require = createRequire(import.meta.url);
2
4
  var __defProp = Object.defineProperty;
3
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
6
  var __esm = (fn, res) => function __init() {
@@ -9,7 +11,7 @@ var __export = (target, all) => {
9
11
  __defProp(target, name, { get: all[name], enumerable: true });
10
12
  };
11
13
 
12
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/schema.js
14
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/schema.js
13
15
  function jsonSchema(schema, options = {}) {
14
16
  if (isWrappedSchema(schema)) {
15
17
  return schema;
@@ -33,19 +35,19 @@ function extractJsonSchema(schema) {
33
35
  }
34
36
  var schemaSymbol, validatorSymbol;
35
37
  var init_schema = __esm({
36
- "../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/schema.js"() {
38
+ "__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/schema.js"() {
37
39
  schemaSymbol = Symbol.for("mcpc.schema");
38
40
  validatorSymbol = Symbol.for("mcpc.validator");
39
41
  }
40
42
  });
41
43
 
42
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/logger.js
44
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/logger.js
43
45
  function createLogger(name, server2) {
44
46
  return new MCPLogger(name, server2);
45
47
  }
46
48
  var LOG_LEVELS, MCPLogger, logger;
47
49
  var init_logger = __esm({
48
- "../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/logger.js"() {
50
+ "__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/logger.js"() {
49
51
  LOG_LEVELS = {
50
52
  debug: 0,
51
53
  info: 1,
@@ -133,10 +135,10 @@ var init_logger = __esm({
133
135
  }
134
136
  });
135
137
 
136
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/built-in/config-plugin.js
138
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/built-in/config-plugin.js
137
139
  var createConfigPlugin, config_plugin_default;
138
140
  var init_config_plugin = __esm({
139
- "../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/built-in/config-plugin.js"() {
141
+ "__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/built-in/config-plugin.js"() {
140
142
  createConfigPlugin = () => ({
141
143
  name: "built-in-config",
142
144
  version: "1.0.0",
@@ -154,10 +156,10 @@ var init_config_plugin = __esm({
154
156
  }
155
157
  });
156
158
 
157
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/built-in/tool-name-mapping-plugin.js
159
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/built-in/tool-name-mapping-plugin.js
158
160
  var createToolNameMappingPlugin, tool_name_mapping_plugin_default;
159
161
  var init_tool_name_mapping_plugin = __esm({
160
- "../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/built-in/tool-name-mapping-plugin.js"() {
162
+ "__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/built-in/tool-name-mapping-plugin.js"() {
161
163
  createToolNameMappingPlugin = () => ({
162
164
  name: "built-in-tool-name-mapping",
163
165
  version: "1.0.0",
@@ -182,10 +184,10 @@ var init_tool_name_mapping_plugin = __esm({
182
184
  }
183
185
  });
184
186
 
185
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/built-in/logging-plugin.js
187
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/built-in/logging-plugin.js
186
188
  var createLoggingPlugin, logging_plugin_default;
187
189
  var init_logging_plugin = __esm({
188
- "../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/built-in/logging-plugin.js"() {
190
+ "__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/built-in/logging-plugin.js"() {
189
191
  init_logger();
190
192
  createLoggingPlugin = (options = {}) => {
191
193
  const { enabled = true, verbose = false, compact: compact2 = true } = options;
@@ -224,7 +226,7 @@ var init_logging_plugin = __esm({
224
226
  }
225
227
  });
226
228
 
227
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/built-in/index.js
229
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/built-in/index.js
228
230
  var built_in_exports = {};
229
231
  __export(built_in_exports, {
230
232
  createConfigPlugin: () => createConfigPlugin,
@@ -240,7 +242,7 @@ function getBuiltInPlugins() {
240
242
  ];
241
243
  }
242
244
  var init_built_in = __esm({
243
- "../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/built-in/index.js"() {
245
+ "__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/built-in/index.js"() {
244
246
  init_config_plugin();
245
247
  init_tool_name_mapping_plugin();
246
248
  init_logging_plugin();
@@ -250,7 +252,7 @@ var init_built_in = __esm({
250
252
  }
251
253
  });
252
254
 
253
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugin-utils.js
255
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugin-utils.js
254
256
  var plugin_utils_exports = {};
255
257
  __export(plugin_utils_exports, {
256
258
  checkCircularDependencies: () => checkCircularDependencies,
@@ -457,12 +459,12 @@ function validatePlugins(plugins) {
457
459
  }
458
460
  var pluginCache;
459
461
  var init_plugin_utils = __esm({
460
- "../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugin-utils.js"() {
462
+ "__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugin-utils.js"() {
461
463
  pluginCache = /* @__PURE__ */ new Map();
462
464
  }
463
465
  });
464
466
 
465
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/schema.js
467
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/schema.js
466
468
  import traverse from "json-schema-traverse";
467
469
  function updateRefPaths(schema, wrapperPath) {
468
470
  if (!schema || typeof schema !== "object") {
@@ -494,11 +496,11 @@ function updateRefPaths(schema, wrapperPath) {
494
496
  return clonedSchema;
495
497
  }
496
498
  var init_schema2 = __esm({
497
- "../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/schema.js"() {
499
+ "__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/schema.js"() {
498
500
  }
499
501
  });
500
502
 
501
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/compose-helpers.js
503
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/compose-helpers.js
502
504
  var compose_helpers_exports = {};
503
505
  __export(compose_helpers_exports, {
504
506
  buildDependencyGroups: () => buildDependencyGroups,
@@ -586,26 +588,26 @@ function registerGlobalTools(globalToolNames, tools, server2) {
586
588
  });
587
589
  }
588
590
  var init_compose_helpers = __esm({
589
- "../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/compose-helpers.js"() {
591
+ "__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/compose-helpers.js"() {
590
592
  init_schema2();
591
593
  init_schema();
592
594
  }
593
595
  });
594
596
 
595
- // ../__mcpc__cli_latest/node_modules/@mcpc/cli/src/bin.ts
597
+ // __mcpc__cli_latest/node_modules/@mcpc/cli/src/bin.ts
596
598
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
597
599
 
598
- // ../__mcpc__cli_latest/node_modules/@mcpc/cli/src/app.js
600
+ // __mcpc__cli_latest/node_modules/@mcpc/cli/src/app.js
599
601
  import { OpenAPIHono } from "@hono/zod-openapi";
600
602
 
601
- // ../__mcpc__cli_latest/node_modules/@mcpc/cli/src/controllers/messages.controller.js
603
+ // __mcpc__cli_latest/node_modules/@mcpc/cli/src/controllers/messages.controller.js
602
604
  import { createRoute } from "@hono/zod-openapi";
603
605
  import { z } from "zod";
604
606
 
605
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__utils/src/transport/sse.js
607
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__utils/src/transport/sse.js
606
608
  import { JSONRPCMessageSchema } from "@modelcontextprotocol/sdk/types.js";
607
609
 
608
- // ../__mcpc__cli_latest/node_modules/@jsr/std__http/server_sent_event_stream.js
610
+ // __mcpc__cli_latest/node_modules/@jsr/std__http/server_sent_event_stream.js
609
611
  var NEWLINE_REGEXP = /\r\n|\r|\n/;
610
612
  var encoder = new TextEncoder();
611
613
  function assertHasNoNewline(value, varName, errPrefix) {
@@ -643,15 +645,15 @@ var ServerSentEventStream = class extends TransformStream {
643
645
  }
644
646
  };
645
647
 
646
- // ../__mcpc__cli_latest/node_modules/@mcpc/cli/src/controllers/sse.controller.js
648
+ // __mcpc__cli_latest/node_modules/@mcpc/cli/src/controllers/sse.controller.js
647
649
  import { createRoute as createRoute2, z as z2 } from "@hono/zod-openapi";
648
650
 
649
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/compose.js
651
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/compose.js
650
652
  init_schema();
651
653
  import { CallToolRequestSchema, ListToolsRequestSchema, SetLevelRequestSchema } from "@modelcontextprotocol/sdk/types.js";
652
654
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
653
655
 
654
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__utils/src/json.js
656
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__utils/src/json.js
655
657
  import { jsonrepair } from "jsonrepair";
656
658
  function stripMarkdownAndText(text) {
657
659
  text = text.trim();
@@ -686,7 +688,7 @@ function parseJSON(text, throwError) {
686
688
  }
687
689
  }
688
690
 
689
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__utils/src/ai.js
691
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__utils/src/ai.js
690
692
  var p = (template, options = {}) => {
691
693
  const { missingVariableHandling = "warn" } = options;
692
694
  const names = /* @__PURE__ */ new Set();
@@ -722,7 +724,7 @@ var p = (template, options = {}) => {
722
724
  };
723
725
  };
724
726
 
725
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__utils/src/tool-tags.js
727
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__utils/src/tool-tags.js
726
728
  import { load } from "cheerio";
727
729
  function parseTags(htmlString, tags) {
728
730
  const $ = load(htmlString, {
@@ -741,13 +743,13 @@ function parseTags(htmlString, tags) {
741
743
  };
742
744
  }
743
745
 
744
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
746
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
745
747
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
746
748
  import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
747
749
  import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
748
750
  import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
749
751
 
750
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/registory.js
752
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/registory.js
751
753
  function connectToSmitheryServer(smitheryConfig) {
752
754
  const serverUrl = new URL(smitheryConfig.deploymentUrl);
753
755
  serverUrl.searchParams.set("config", btoa(JSON.stringify(smitheryConfig.config)));
@@ -772,7 +774,7 @@ function smitheryToolNameCompatibale(name, scope) {
772
774
  };
773
775
  }
774
776
 
775
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
777
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
776
778
  import { cwd } from "node:process";
777
779
  import process2 from "node:process";
778
780
  import { createHash } from "node:crypto";
@@ -935,18 +937,17 @@ async function composeMcpDepTools(mcpConfig, filterIn) {
935
937
  };
936
938
  }
937
939
 
938
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-tool-registrar.js
940
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-tool-registrar.js
939
941
  init_schema();
940
942
 
941
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js
943
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js
942
944
  import process3 from "node:process";
943
945
  var GEMINI_PREFERRED_FORMAT = process3.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
944
946
 
945
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js
947
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js
946
948
  import { jsonrepair as jsonrepair2 } from "jsonrepair";
947
- import { inspect } from "node:util";
948
949
 
949
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/provider.js
950
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/provider.js
950
951
  var createGoogleCompatibleJSONSchema = (schema) => {
951
952
  if (!GEMINI_PREFERRED_FORMAT) {
952
953
  return schema;
@@ -970,7 +971,7 @@ var createGoogleCompatibleJSONSchema = (schema) => {
970
971
  return removeAdditionalProperties(cleanSchema);
971
972
  };
972
973
 
973
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/prompts/index.js
974
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/prompts/index.js
974
975
  var SystemPrompts = {
975
976
  /**
976
977
  * Base system prompt for autonomous MCP execution
@@ -1312,13 +1313,13 @@ ${JSON.stringify(steps, null, 2)}`;
1312
1313
  }
1313
1314
  };
1314
1315
 
1315
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-executor.js
1316
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-executor.js
1316
1317
  import { Ajv } from "ajv";
1317
1318
  import { AggregateAjvError } from "@segment/ajv-human-errors";
1318
1319
  import addFormats from "ajv-formats";
1319
1320
  init_logger();
1320
1321
 
1321
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/tracing.js
1322
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/tracing.js
1322
1323
  import { context, SpanStatusCode, trace } from "@opentelemetry/api";
1323
1324
  import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
1324
1325
  import { BatchSpanProcessor, ConsoleSpanExporter, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
@@ -1385,7 +1386,7 @@ function endSpan(span, error) {
1385
1386
  span.end();
1386
1387
  }
1387
1388
 
1388
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-executor.js
1389
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-executor.js
1389
1390
  import process4 from "node:process";
1390
1391
  var ajv = new Ajv({
1391
1392
  allErrors: true,
@@ -1640,7 +1641,7 @@ var AgenticExecutor = class {
1640
1641
  }
1641
1642
  };
1642
1643
 
1643
- // ../__mcpc__cli_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/function/partial.js
1644
+ // __mcpc__cli_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/function/partial.js
1644
1645
  function partial(func, ...partialArgs) {
1645
1646
  return partialImpl(func, placeholderSymbol, ...partialArgs);
1646
1647
  }
@@ -1659,7 +1660,7 @@ function partialImpl(func, placeholder, ...partialArgs) {
1659
1660
  var placeholderSymbol = Symbol("partial.placeholder");
1660
1661
  partial.placeholder = placeholderSymbol;
1661
1662
 
1662
- // ../__mcpc__cli_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/function/partialRight.js
1663
+ // __mcpc__cli_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/function/partialRight.js
1663
1664
  function partialRight(func, ...partialArgs) {
1664
1665
  return partialRightImpl(func, placeholderSymbol2, ...partialArgs);
1665
1666
  }
@@ -1680,10 +1681,10 @@ function partialRightImpl(func, placeholder, ...partialArgs) {
1680
1681
  var placeholderSymbol2 = Symbol("partialRight.placeholder");
1681
1682
  partialRight.placeholder = placeholderSymbol2;
1682
1683
 
1683
- // ../__mcpc__cli_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/function/retry.js
1684
+ // __mcpc__cli_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/function/retry.js
1684
1685
  var DEFAULT_RETRIES = Number.POSITIVE_INFINITY;
1685
1686
 
1686
- // ../__mcpc__cli_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/object/pick.js
1687
+ // __mcpc__cli_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/object/pick.js
1687
1688
  function pick(obj, keys) {
1688
1689
  const result = {};
1689
1690
  for (let i = 0; i < keys.length; i++) {
@@ -1695,7 +1696,7 @@ function pick(obj, keys) {
1695
1696
  return result;
1696
1697
  }
1697
1698
 
1698
- // ../__mcpc__cli_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/string/deburr.js
1699
+ // __mcpc__cli_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/string/deburr.js
1699
1700
  var deburrMap = new Map(
1700
1701
  // eslint-disable-next-line no-restricted-syntax
1701
1702
  Object.entries({
@@ -1731,7 +1732,7 @@ var deburrMap = new Map(
1731
1732
  })
1732
1733
  );
1733
1734
 
1734
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/factories/args-def-factory.js
1735
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/factories/args-def-factory.js
1735
1736
  var DECISION_OPTIONS = {
1736
1737
  RETRY: "retry",
1737
1738
  PROCEED: "proceed",
@@ -1962,7 +1963,7 @@ NOTE: The \`steps\` has been predefined` : `**You MUST execute this tool with fo
1962
1963
  };
1963
1964
  }
1964
1965
 
1965
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/sampling/base-sampling-executor.js
1966
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/sampling/base-sampling-executor.js
1966
1967
  import { Ajv as Ajv2 } from "ajv";
1967
1968
  import { AggregateAjvError as AggregateAjvError2 } from "@segment/ajv-human-errors";
1968
1969
  import addFormats2 from "ajv-formats";
@@ -2330,7 +2331,7 @@ VALID: {"key":"value"}` }) {
2330
2331
  }
2331
2332
  };
2332
2333
 
2333
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/sampling/agentic-sampling-executor.js
2334
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/sampling/agentic-sampling-executor.js
2334
2335
  var SamplingExecutor = class extends BaseSamplingExecutor {
2335
2336
  agenticExecutor;
2336
2337
  constructor(name, description, allToolNames, toolNameToDetailList, server2, config2) {
@@ -2436,7 +2437,7 @@ When the task is complete, I should use "action": "complete".`;
2436
2437
  }
2437
2438
  };
2438
2439
 
2439
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-tool-registrar.js
2440
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-tool-registrar.js
2440
2441
  function registerAgenticTool(server2, { description, name, allToolNames, depGroups, toolNameToDetailList, sampling = false }) {
2441
2442
  const createArgsDef = createArgsDefFactory(name, allToolNames, depGroups, void 0, void 0);
2442
2443
  const isSamplingMode = sampling === true || typeof sampling === "object";
@@ -2466,10 +2467,10 @@ function registerAgenticTool(server2, { description, name, allToolNames, depGrou
2466
2467
  });
2467
2468
  }
2468
2469
 
2469
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/workflow/workflow-tool-registrar.js
2470
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/workflow/workflow-tool-registrar.js
2470
2471
  init_schema();
2471
2472
 
2472
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/state.js
2473
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/state.js
2473
2474
  var WorkflowState = class {
2474
2475
  currentStepIndex = -1;
2475
2476
  steps = [];
@@ -2638,7 +2639,7 @@ var WorkflowState = class {
2638
2639
  }
2639
2640
  };
2640
2641
 
2641
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/workflow/workflow-executor.js
2642
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/workflow/workflow-executor.js
2642
2643
  import { Ajv as Ajv3 } from "ajv";
2643
2644
  import { AggregateAjvError as AggregateAjvError3 } from "@segment/ajv-human-errors";
2644
2645
  import addFormats3 from "ajv-formats";
@@ -2965,7 +2966,7 @@ ${this.formatProgress(state)}`
2965
2966
  }
2966
2967
  };
2967
2968
 
2968
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/sampling/workflow-sampling-executor.js
2969
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/sampling/workflow-sampling-executor.js
2969
2970
  var WorkflowSamplingExecutor = class extends BaseSamplingExecutor {
2970
2971
  createArgsDef;
2971
2972
  predefinedSteps;
@@ -3039,7 +3040,7 @@ Current Task: <user_request>${args.userRequest}</user_request>${contextInfo}`;
3039
3040
  }
3040
3041
  };
3041
3042
 
3042
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/workflow/workflow-tool-registrar.js
3043
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/workflow/workflow-tool-registrar.js
3043
3044
  function registerAgenticWorkflowTool(server2, { description, name, allToolNames, depGroups, toolNameToDetailList, predefinedSteps, sampling = false, ensureStepActions, toolNameToIdMapping }) {
3044
3045
  const createArgsDef = createArgsDefFactory(name, allToolNames, depGroups, predefinedSteps, ensureStepActions);
3045
3046
  const isSamplingMode = sampling === true || typeof sampling === "object";
@@ -3081,7 +3082,7 @@ function registerAgenticWorkflowTool(server2, { description, name, allToolNames,
3081
3082
  });
3082
3083
  }
3083
3084
 
3084
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/tool-tag-processor.js
3085
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/tool-tag-processor.js
3085
3086
  var ALL_TOOLS_PLACEHOLDER = "__ALL__";
3086
3087
  function findToolId(toolName, tools, toolNameMapping) {
3087
3088
  const mappedId = toolNameMapping?.get(toolName);
@@ -3115,12 +3116,12 @@ function processToolTags({ description, tagToResults, $, tools, toolOverrides, t
3115
3116
  return $.root().html() ?? description;
3116
3117
  }
3117
3118
 
3118
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/compose.js
3119
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/compose.js
3119
3120
  init_built_in();
3120
3121
  init_logger();
3121
3122
  init_plugin_utils();
3122
3123
 
3123
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/plugin-manager.js
3124
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/plugin-manager.js
3124
3125
  init_plugin_utils();
3125
3126
  init_logger();
3126
3127
  var PluginManager = class {
@@ -3288,7 +3289,7 @@ var PluginManager = class {
3288
3289
  }
3289
3290
  };
3290
3291
 
3291
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/tool-manager.js
3292
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/tool-manager.js
3292
3293
  var ToolManager = class {
3293
3294
  toolRegistry = /* @__PURE__ */ new Map();
3294
3295
  toolConfigs = /* @__PURE__ */ new Map();
@@ -3475,7 +3476,7 @@ var ToolManager = class {
3475
3476
  }
3476
3477
  };
3477
3478
 
3478
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/compose.js
3479
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/compose.js
3479
3480
  init_compose_helpers();
3480
3481
  var ALL_TOOLS_PLACEHOLDER2 = "__ALL__";
3481
3482
  var ComposableMCPServer = class extends Server {
@@ -3857,7 +3858,7 @@ var ComposableMCPServer = class extends Server {
3857
3858
  }
3858
3859
  };
3859
3860
 
3860
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/env.js
3861
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/env.js
3861
3862
  import process6 from "node:process";
3862
3863
  var isSCF = () => Boolean(process6.env.SCF_RUNTIME || process6.env.PROD_SCF);
3863
3864
  if (isSCF()) {
@@ -3867,7 +3868,7 @@ if (isSCF()) {
3867
3868
  });
3868
3869
  }
3869
3870
 
3870
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/set-up-mcp-compose.js
3871
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/set-up-mcp-compose.js
3871
3872
  function parseMcpcConfigs(conf) {
3872
3873
  const mcpcConfigs = conf ?? [];
3873
3874
  const newMcpcConfigs = [];
@@ -3908,10 +3909,322 @@ async function mcpc(serverConf, composeConf, setupCallback) {
3908
3909
  return server2;
3909
3910
  }
3910
3911
 
3911
- // ../__mcpc__cli_latest/node_modules/@jsr/mcpc__core/mod.js
3912
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/mod.js
3912
3913
  init_schema();
3913
3914
 
3914
- // ../__mcpc__cli_latest/node_modules/@mcpc/cli/src/app.js
3915
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/large-result.js
3916
+ import { mkdtemp, writeFile } from "node:fs/promises";
3917
+ import { join } from "node:path";
3918
+ import { tmpdir as tmpdir2 } from "node:os";
3919
+
3920
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/search-tool.js
3921
+ init_schema();
3922
+ import rg from "@mcpc-tech/ripgrep-napi";
3923
+ import { tmpdir } from "node:os";
3924
+ import { resolve } from "node:path";
3925
+ import { relative } from "node:path";
3926
+ function createSearchPlugin(options = {}) {
3927
+ const maxResults = options.maxResults || 20;
3928
+ const maxOutputSize = options.maxOutputSize || 5e3;
3929
+ const allowedSearchDir = options.allowedDir || tmpdir();
3930
+ const timeoutMs = options.timeoutMs || 3e4;
3931
+ const global = options.global ?? true;
3932
+ const activeTimeouts = /* @__PURE__ */ new Set();
3933
+ return {
3934
+ name: "plugin-search",
3935
+ version: "1.0.0",
3936
+ configureServer: (server2) => {
3937
+ 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.
3938
+ Only search within the allowed directory: ${allowedSearchDir}`, jsonSchema({
3939
+ type: "object",
3940
+ properties: {
3941
+ pattern: {
3942
+ type: "string",
3943
+ description: "Text to search for. Can be a plain string or a regular expression. For regexes, don't include delimiters (e.g. use `^foo` not `/^foo/`). If you get a regex parse error, try escaping special chars or using a simpler literal search."
3944
+ },
3945
+ path: {
3946
+ type: "string",
3947
+ description: "File or folder path to limit the search (optional). Must be within the allowed directory."
3948
+ },
3949
+ maxResults: {
3950
+ type: "number",
3951
+ description: "Maximum number of matches to return (optional). Lower this to reduce output size and runtime."
3952
+ }
3953
+ },
3954
+ required: [
3955
+ "pattern"
3956
+ ]
3957
+ }), async (args) => {
3958
+ const isBroad = (raw) => {
3959
+ const t = (raw ?? "").trim();
3960
+ if (!t) return true;
3961
+ if (/^[*.\s]{2,}$/.test(t)) return true;
3962
+ if (t === ".*" || t === "." || t === "^.*$") return true;
3963
+ if (/^\^?\.\*\$?$/.test(t)) return true;
3964
+ if (/^\\s?\*+$/.test(t)) return true;
3965
+ return false;
3966
+ };
3967
+ const appendMatchSafely = (current, addition, limit) => {
3968
+ if ((current + addition).length > limit) {
3969
+ return {
3970
+ current,
3971
+ added: false
3972
+ };
3973
+ }
3974
+ return {
3975
+ current: current + addition,
3976
+ added: true
3977
+ };
3978
+ };
3979
+ let timeoutId;
3980
+ try {
3981
+ const requestedPath = args.path || allowedSearchDir;
3982
+ const limit = args.maxResults || maxResults;
3983
+ if (args.path) {
3984
+ const resolvedRequested = resolve(args.path);
3985
+ const resolvedAllowed = resolve(allowedSearchDir);
3986
+ const relativePath = relative(resolvedAllowed, resolvedRequested);
3987
+ if (relativePath && relativePath.startsWith("..")) {
3988
+ return {
3989
+ content: [
3990
+ {
3991
+ type: "text",
3992
+ text: `\u274C Path "${args.path}" not allowed. Must be within: ${allowedSearchDir}`
3993
+ }
3994
+ ],
3995
+ isError: true
3996
+ };
3997
+ }
3998
+ }
3999
+ const searchPath = requestedPath;
4000
+ const rawPattern = args.pattern ?? "";
4001
+ if (isBroad(rawPattern)) {
4002
+ return {
4003
+ content: [
4004
+ {
4005
+ type: "text",
4006
+ text: `\u274C Search pattern too broad: "${rawPattern}"
4007
+ Provide a more specific pattern (e.g. include a filename fragment, a keyword, or limit with the "path" parameter). Avoid patterns that only contain wildcards like "*" or ".*".`
4008
+ }
4009
+ ],
4010
+ isError: true
4011
+ };
4012
+ }
4013
+ const timeoutPromise = new Promise((_, reject) => {
4014
+ timeoutId = setTimeout(() => {
4015
+ reject(new Error(`Search timeout after ${timeoutMs}ms`));
4016
+ }, timeoutMs);
4017
+ activeTimeouts.add(timeoutId);
4018
+ });
4019
+ const searchPromise = new Promise((resolve3, reject) => {
4020
+ try {
4021
+ const result2 = rg.search(args.pattern, [
4022
+ searchPath
4023
+ ]);
4024
+ resolve3(result2);
4025
+ } catch (error) {
4026
+ reject(error);
4027
+ }
4028
+ });
4029
+ const result = await Promise.race([
4030
+ searchPromise,
4031
+ timeoutPromise
4032
+ ]);
4033
+ if (timeoutId) {
4034
+ clearTimeout(timeoutId);
4035
+ activeTimeouts.delete(timeoutId);
4036
+ }
4037
+ if (!result.success || !result.matches?.length) {
4038
+ return {
4039
+ content: [
4040
+ {
4041
+ type: "text",
4042
+ text: `No matches found for: "${args.pattern}"
4043
+
4044
+ Try:
4045
+ - **Simpler pattern** or \`*\`
4046
+ - Check if files exist in: ${searchPath}
4047
+ - Use specific file path`
4048
+ }
4049
+ ]
4050
+ };
4051
+ }
4052
+ const matches = result.matches.slice(0, limit);
4053
+ let output = `Found ${result.matches.length} matches (showing up to ${matches.length}):
4054
+
4055
+ `;
4056
+ let matchesIncluded = 0;
4057
+ for (const match of matches) {
4058
+ const baseMatchText = `**${match.path}:${match.lineNumber}**
4059
+ `;
4060
+ const fullMatchText = `${baseMatchText}\`\`\`
4061
+ ${match.line}
4062
+ \`\`\`
4063
+
4064
+ `;
4065
+ const res = appendMatchSafely(output, fullMatchText, maxOutputSize);
4066
+ if (!res.added) {
4067
+ if (matchesIncluded === 0) {
4068
+ const remainingSpace = maxOutputSize - output.length - 100;
4069
+ if (remainingSpace > 50) {
4070
+ const truncatedLine = match.line.slice(0, remainingSpace);
4071
+ output += `${baseMatchText}\`\`\`
4072
+ ${truncatedLine}...
4073
+ \`\`\`
4074
+
4075
+ `;
4076
+ output += `\u26A0\uFE0F Content truncated
4077
+ `;
4078
+ matchesIncluded++;
4079
+ } else {
4080
+ output += `\u26A0\uFE0F Content too large, use specific file path
4081
+ `;
4082
+ }
4083
+ }
4084
+ break;
4085
+ }
4086
+ output = res.current;
4087
+ matchesIncluded++;
4088
+ }
4089
+ if (matchesIncluded < matches.length) {
4090
+ output += `
4091
+ \u26A0\uFE0F Showing ${matchesIncluded}/${matches.length} matches (size limit)
4092
+ `;
4093
+ output += `
4094
+ For more results:
4095
+ `;
4096
+ output += `- Use specific pattern: "${args.pattern} keyword"
4097
+ `;
4098
+ output += `- Search specific file: {"pattern": "${args.pattern}", "path": "/file.txt"}
4099
+ `;
4100
+ output += `- Use fewer results: {"maxResults": 5}`;
4101
+ }
4102
+ return {
4103
+ content: [
4104
+ {
4105
+ type: "text",
4106
+ text: output
4107
+ }
4108
+ ]
4109
+ };
4110
+ } catch (error) {
4111
+ if (timeoutId) {
4112
+ clearTimeout(timeoutId);
4113
+ activeTimeouts.delete(timeoutId);
4114
+ }
4115
+ const errorMsg = error instanceof Error ? error.message : String(error);
4116
+ const isTimeout = errorMsg.includes("timeout");
4117
+ return {
4118
+ content: [
4119
+ {
4120
+ type: "text",
4121
+ text: `Search error: ${errorMsg}
4122
+
4123
+ ${isTimeout ? `Timeout after ${timeoutMs}ms. Try simpler pattern or smaller directory.` : `Check pattern syntax or directory exists.`}`
4124
+ }
4125
+ ]
4126
+ };
4127
+ }
4128
+ }, {
4129
+ internal: !global
4130
+ });
4131
+ },
4132
+ dispose: () => {
4133
+ for (const timeoutId of activeTimeouts) {
4134
+ clearTimeout(timeoutId);
4135
+ }
4136
+ activeTimeouts.clear();
4137
+ }
4138
+ };
4139
+ }
4140
+ var defaultSearchPlugin = createSearchPlugin({
4141
+ global: true,
4142
+ maxResults: 20,
4143
+ maxOutputSize: 5e3,
4144
+ caseSensitive: false,
4145
+ timeoutMs: 3e4
4146
+ });
4147
+
4148
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/large-result.js
4149
+ function createLargeResultPlugin(options = {}) {
4150
+ const maxSize = options.maxSize || 8e3;
4151
+ const previewSize = options.previewSize || 4e3;
4152
+ let tempDir = options.tempDir || null;
4153
+ const configuredServers = /* @__PURE__ */ new Map();
4154
+ const searchConfig = {
4155
+ maxResults: options.search?.maxResults || 15,
4156
+ maxOutputSize: options.search?.maxOutputSize || 4e3,
4157
+ global: true
4158
+ };
4159
+ return {
4160
+ name: "plugin-large-result-handler",
4161
+ version: "1.0.0",
4162
+ dependencies: [],
4163
+ configureServer: async (server2) => {
4164
+ if (!configuredServers.has(server2)) {
4165
+ const searchPlugin = createSearchPlugin(searchConfig);
4166
+ await server2.addPlugin(searchPlugin);
4167
+ configuredServers.set(server2, true);
4168
+ }
4169
+ },
4170
+ transformTool: (tool, context2) => {
4171
+ const originalExecute = tool.execute;
4172
+ tool.execute = async (args) => {
4173
+ try {
4174
+ const result = await originalExecute(args);
4175
+ const resultText = JSON.stringify(result);
4176
+ if (resultText.length <= maxSize) {
4177
+ return result;
4178
+ }
4179
+ if (!tempDir) {
4180
+ tempDir = await mkdtemp(join(tmpdir2(), "mcpc-results-"));
4181
+ }
4182
+ const safeToolName = encodeURIComponent(context2.toolName ?? "tool");
4183
+ const fileName = `${safeToolName}-${Date.now()}.txt`;
4184
+ const filePath = join(tempDir, fileName);
4185
+ await writeFile(filePath, resultText);
4186
+ const preview = resultText.slice(0, previewSize);
4187
+ const sizeKB = (resultText.length / 1024).toFixed(1);
4188
+ return {
4189
+ content: [
4190
+ {
4191
+ type: "text",
4192
+ text: `**Result too large (${resultText.length} chars), saved to file**
4193
+
4194
+ \u{1F4C1} **File:** ${filePath}
4195
+ \u{1F4CA} **Size:** ${sizeKB} KB
4196
+
4197
+ **Preview (${previewSize} chars):**
4198
+ \`\`\`
4199
+ ${preview}
4200
+ \`\`\`
4201
+
4202
+ **To read/understand the full content:**
4203
+ - Use the \`search-tool-result\` tool with pattern: \`search-tool-result {"pattern": "your-search-term"}\`
4204
+ - Search supports regex patterns for advanced queries`
4205
+ }
4206
+ ]
4207
+ };
4208
+ } catch (error) {
4209
+ const errorMsg = error instanceof Error ? error.message : String(error);
4210
+ console.error(`Large result plugin error for ${context2.toolName}: ${errorMsg}`);
4211
+ throw error;
4212
+ }
4213
+ };
4214
+ return tool;
4215
+ },
4216
+ dispose: () => {
4217
+ configuredServers.clear();
4218
+ tempDir = null;
4219
+ }
4220
+ };
4221
+ }
4222
+ var defaultLargeResultPlugin = createLargeResultPlugin({
4223
+ maxSize: 8e3,
4224
+ previewSize: 4e3
4225
+ });
4226
+
4227
+ // __mcpc__cli_latest/node_modules/@mcpc/cli/src/app.js
3915
4228
  var createServer = async (config2) => {
3916
4229
  const serverConfig = config2 || {
3917
4230
  name: "large-result-plugin-example",
@@ -3921,7 +4234,7 @@ var createServer = async (config2) => {
3921
4234
  name: null,
3922
4235
  description: "",
3923
4236
  plugins: [
3924
- "./plugins/large-result.ts?maxSize=8000&previewSize=4000"
4237
+ createLargeResultPlugin({})
3925
4238
  ]
3926
4239
  }
3927
4240
  ]
@@ -3941,9 +4254,9 @@ var createServer = async (config2) => {
3941
4254
  ], serverConfig.agents);
3942
4255
  };
3943
4256
 
3944
- // ../__mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
4257
+ // __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
3945
4258
  import { readFile } from "node:fs/promises";
3946
- import { resolve } from "node:path";
4259
+ import { resolve as resolve2 } from "node:path";
3947
4260
  import process7 from "node:process";
3948
4261
  function printHelp() {
3949
4262
  console.log(`
@@ -4095,7 +4408,7 @@ async function loadConfig() {
4095
4408
  }
4096
4409
  }
4097
4410
  }
4098
- const defaultConfigPath = resolve(process7.cwd(), "mcpc.config.json");
4411
+ const defaultConfigPath = resolve2(process7.cwd(), "mcpc.config.json");
4099
4412
  try {
4100
4413
  const content = await readFile(defaultConfigPath, "utf-8");
4101
4414
  const parsed = JSON.parse(content);
@@ -4159,7 +4472,7 @@ function normalizeAgents(agents) {
4159
4472
  });
4160
4473
  }
4161
4474
 
4162
- // ../__mcpc__cli_latest/node_modules/@mcpc/cli/src/bin.ts
4475
+ // __mcpc__cli_latest/node_modules/@mcpc/cli/src/bin.ts
4163
4476
  var config = await loadConfig();
4164
4477
  if (config) {
4165
4478
  console.error(`Loaded configuration with ${config.agents.length} agent(s)`);
package/package.json CHANGED
@@ -1,12 +1,26 @@
1
1
  {
2
2
  "name": "@mcpc-tech/cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "homepage": "https://jsr.io/@mcpc/cli",
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "@hono/zod-openapi": "^0.19.2",
8
8
  "@modelcontextprotocol/sdk": "^1.8.0",
9
- "zod": "^3.24.2"
9
+ "zod": "^3.24.2",
10
+ "@mcpc-tech/ripgrep-napi": "^0.0.4",
11
+ "@opentelemetry/api": "^1.9.0",
12
+ "@opentelemetry/exporter-trace-otlp-http": "^0.56.0",
13
+ "@opentelemetry/resources": "^1.29.0",
14
+ "@opentelemetry/sdk-trace-base": "^1.29.0",
15
+ "@opentelemetry/sdk-trace-node": "^1.29.0",
16
+ "@opentelemetry/semantic-conventions": "^1.29.0",
17
+ "@segment/ajv-human-errors": "^2.15.0",
18
+ "ajv": "^8.17.1",
19
+ "ajv-formats": "^3.0.1",
20
+ "cheerio": "^1.0.0",
21
+ "json-schema-to-zod": "^2.6.1",
22
+ "json-schema-traverse": "^1.0.0",
23
+ "jsonrepair": "^3.13.0"
10
24
  },
11
25
  "exports": {
12
26
  "./bin/mcpc": "./bin/mcpc.mjs",
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sources":["../../src/app.ts"],"names":[],"mappings":"AAAA,SAAS,WAAW,4BAAwC;AAG5D,cAAc,mBAAmB,0BAA0D;AAC3F,cAAc,UAAU,6BAA6B;AAErD,OAAO,cAAM,eACX,SAAS,eACR,QAAQ,qBA8BT;AAEF,OAAO,cAAM,iBAAgB,YAO3B"}
1
+ {"version":3,"file":"app.d.ts","sources":["../../src/app.ts"],"names":[],"mappings":"AAAA,SAAS,WAAW,4BAAwC;AAI5D,cAAc,mBAAmB,0BAA0D;AAC3F,cAAc,UAAU,6BAA6B;AAErD,OAAO,cAAM,eACX,SAAS,eACR,QAAQ,qBA8BT;AAEF,OAAO,cAAM,iBAAgB,YAO3B"}