@mcpc-tech/core 0.3.22 → 0.3.24

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.cjs CHANGED
@@ -534,6 +534,7 @@ __export(mod_exports, {
534
534
  composeMcpDepTools: () => composeMcpDepTools,
535
535
  convertToAISDKTools: () => convertToAISDKTools,
536
536
  extractJsonSchema: () => extractJsonSchema,
537
+ isMarkdownFile: () => isMarkdownFile,
537
538
  isProdEnv: () => isProdEnv,
538
539
  isSCF: () => isSCF,
539
540
  isWrappedSchema: () => isWrappedSchema,
@@ -542,6 +543,7 @@ __export(mod_exports, {
542
543
  optionalObject: () => optionalObject,
543
544
  parseJSON: () => parseJSON,
544
545
  parseMcpcConfigs: () => parseMcpcConfigs,
546
+ setMarkdownAgentLoader: () => setMarkdownAgentLoader,
545
547
  truncateJSON: () => truncateJSON
546
548
  });
547
549
  module.exports = __toCommonJS(mod_exports);
@@ -14868,7 +14870,9 @@ var Client = class extends Protocol {
14868
14870
  }
14869
14871
  return taskValidationResult.data;
14870
14872
  }
14871
- const validationResult = safeParse3(CreateMessageResultSchema, result);
14873
+ const hasTools = params.tools || params.toolChoice;
14874
+ const resultSchema = hasTools ? CreateMessageResultWithToolsSchema : CreateMessageResultSchema;
14875
+ const validationResult = safeParse3(resultSchema, result);
14872
14876
  if (!validationResult.success) {
14873
14877
  const errorMessage = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);
14874
14878
  throw new McpError(ErrorCode.InvalidParams, `Invalid sampling result: ${errorMessage}`);
@@ -17784,7 +17788,7 @@ You must follow the <manual/>, obey the <rules/>, and use the <format/>.
17784
17788
 
17785
17789
  <parameters>
17786
17790
  \`tool\` - Which tool to execute: "man" to get schemas, or a tool name to execute
17787
- \`args\` - For "man": ["tool1", "tool2"]. For other tools: tool parameters that strictly adhere to the tool's JSON schema.
17791
+ \`args\` - For "man": { tools: ["tool1", "tool2"] }. For other tools: tool parameters that strictly adhere to the tool's JSON schema.
17788
17792
  </parameters>
17789
17793
 
17790
17794
  <rules>
@@ -17799,7 +17803,7 @@ Get tool schemas:
17799
17803
  \`\`\`json
17800
17804
  {
17801
17805
  "tool": "man",
17802
- "args": ["tool1", "tool2"]
17806
+ "args": { "tools": ["tool1", "tool2"] }
17803
17807
  }
17804
17808
  \`\`\`
17805
17809
 
@@ -17866,7 +17870,9 @@ Next: Execute \`{nextAction}\` by calling \`{toolName}\` again.`,
17866
17870
  /**
17867
17871
  * Error response templates
17868
17872
  */
17869
- ERROR_RESPONSE: `Validation failed: {errorMessage}`,
17873
+ ERROR_RESPONSE: `Validation failed: {errorMessage}
17874
+
17875
+ Adjust parameters and retry.`,
17870
17876
  /**
17871
17877
  * Completion message
17872
17878
  */
@@ -17931,7 +17937,7 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
17931
17937
  *
17932
17938
  * Only two fields:
17933
17939
  * - `tool`: which tool to execute (enum includes "man" + all tool names)
17934
- * - `args`: For "man": ["tool1", "tool2"] or { tools: [...] }. For others: tool parameters.
17940
+ * - `args`: object with parameters. For "man": { tools: ["a", "b"] }. For others: tool parameters.
17935
17941
  */
17936
17942
  forAgentic: function(allToolNames) {
17937
17943
  const toolEnum = [
@@ -17951,7 +17957,7 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
17951
17957
  },
17952
17958
  args: {
17953
17959
  type: "object",
17954
- description: `For "man": ["tool1", "tool2"]. For other tools: tool parameters that strictly adhere to the tool's JSON schema.`
17960
+ description: `For "man": { tools: ["tool1", "tool2"] }. For other tools: tool parameters that strictly adhere to the tool's JSON schema.`
17955
17961
  }
17956
17962
  },
17957
17963
  required: [
@@ -17961,22 +17967,35 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
17961
17967
  };
17962
17968
  },
17963
17969
  /**
17964
- * Schema for "man" command args validation (array format)
17965
- * Expected format: ["tool1", "tool2"]
17970
+ * Schema for "man" command args validation
17971
+ * Expected format: { tools: ["tool1", "tool2"] }
17966
17972
  */
17967
17973
  forMan: function(allToolNames) {
17968
17974
  return {
17969
- type: "array",
17970
- items: {
17971
- type: "string",
17972
- enum: allToolNames,
17973
- errorMessage: {
17974
- enum: `Invalid tool name. Available: ${allToolNames.join(", ")}`
17975
+ type: "object",
17976
+ properties: {
17977
+ tools: {
17978
+ type: "array",
17979
+ items: {
17980
+ type: "string",
17981
+ enum: allToolNames,
17982
+ errorMessage: {
17983
+ enum: `Invalid tool name. Available: ${allToolNames.join(", ")}`
17984
+ }
17985
+ },
17986
+ minItems: 1,
17987
+ errorMessage: {
17988
+ minItems: "At least one tool name is required"
17989
+ }
17975
17990
  }
17976
17991
  },
17977
- minItems: 1,
17992
+ required: [
17993
+ "tools"
17994
+ ],
17978
17995
  errorMessage: {
17979
- minItems: "At least one tool name is required"
17996
+ required: {
17997
+ tools: 'Missing "tools" field. Expected: { tools: ["tool1", "tool2"] }'
17998
+ }
17980
17999
  }
17981
18000
  };
17982
18001
  }
@@ -18154,10 +18173,9 @@ var AgenticExecutor = class {
18154
18173
  }
18155
18174
  const tool2 = args.tool;
18156
18175
  if (tool2 === "man") {
18157
- const toolsArray = Array.isArray(args.args) ? args.args : args.args?.tools;
18158
18176
  const createArgsDef = createArgsDefFactory(this.name, this.allToolNames, {});
18159
18177
  const manSchema = createArgsDef.forMan(this.allToolNames);
18160
- const manValidation = validateSchema(toolsArray ?? [], manSchema);
18178
+ const manValidation = validateSchema(args.args ?? {}, manSchema);
18161
18179
  if (!manValidation.valid) {
18162
18180
  return {
18163
18181
  content: [
@@ -18169,7 +18187,8 @@ var AgenticExecutor = class {
18169
18187
  isError: true
18170
18188
  };
18171
18189
  }
18172
- return this.handleManCommand(toolsArray, executeSpan);
18190
+ const argsObj = args.args;
18191
+ return this.handleManCommand(argsObj.tools, executeSpan);
18173
18192
  }
18174
18193
  const toolArgs = args.args || {};
18175
18194
  return await this.executeTool(tool2, toolArgs, executeSpan);
@@ -20391,12 +20410,44 @@ function convertToAISDKTools(server, helpers) {
20391
20410
  }
20392
20411
 
20393
20412
  // __mcpc__core_latest/node_modules/@mcpc/core/src/set-up-mcp-compose.js
20413
+ var markdownAgentLoader = null;
20414
+ function setMarkdownAgentLoader(loader) {
20415
+ markdownAgentLoader = loader;
20416
+ }
20417
+ function isMarkdownFile(path) {
20418
+ return path.endsWith(".md") || path.endsWith(".markdown");
20419
+ }
20420
+ async function resolveComposeInput(input) {
20421
+ if (typeof input !== "string") {
20422
+ return input;
20423
+ }
20424
+ if (!isMarkdownFile(input)) {
20425
+ throw new Error(`Invalid compose input: "${input}". Expected a Markdown file path (.md) or a ComposeDefinition object.`);
20426
+ }
20427
+ if (!markdownAgentLoader) {
20428
+ throw new Error(`Cannot load Markdown agent file "${input}": Markdown loader not available. Use markdownLoaderPlugin() from "@mcpc/plugin-markdown-loader", or use inline ComposeDefinition objects.`);
20429
+ }
20430
+ return await markdownAgentLoader(input);
20431
+ }
20394
20432
  function parseMcpcConfigs(conf) {
20395
20433
  return conf ?? [];
20396
20434
  }
20397
- async function mcpc(serverConf, composeConf, setupCallback) {
20435
+ async function mcpc(serverConf, composeConf, optionsOrSetup) {
20398
20436
  const server = new ComposableMCPServer(...serverConf);
20399
- const parsed = parseMcpcConfigs(composeConf);
20437
+ const options = typeof optionsOrSetup === "function" ? {
20438
+ setup: optionsOrSetup
20439
+ } : optionsOrSetup ?? {};
20440
+ if (options.plugins) {
20441
+ for (const plugin of options.plugins) {
20442
+ if (typeof plugin === "string") {
20443
+ await server.loadPluginFromPath(plugin);
20444
+ } else {
20445
+ await server.addPlugin(plugin);
20446
+ }
20447
+ }
20448
+ }
20449
+ const resolvedConfigs = composeConf ? await Promise.all(composeConf.map(resolveComposeInput)) : [];
20450
+ const parsed = parseMcpcConfigs(resolvedConfigs);
20400
20451
  await server.initBuiltInPlugins();
20401
20452
  for (const mcpcConfig of parsed) {
20402
20453
  if (mcpcConfig.plugins) {
@@ -20409,8 +20460,8 @@ async function mcpc(serverConf, composeConf, setupCallback) {
20409
20460
  }
20410
20461
  }
20411
20462
  }
20412
- if (setupCallback) {
20413
- await setupCallback(server);
20463
+ if (options.setup) {
20464
+ await options.setup(server);
20414
20465
  }
20415
20466
  for (const mcpcConfig of parsed) {
20416
20467
  await server.compose(mcpcConfig.name, mcpcConfig.description ?? "", mcpcConfig.deps, mcpcConfig.options);
@@ -20423,6 +20474,7 @@ async function mcpc(serverConf, composeConf, setupCallback) {
20423
20474
  composeMcpDepTools,
20424
20475
  convertToAISDKTools,
20425
20476
  extractJsonSchema,
20477
+ isMarkdownFile,
20426
20478
  isProdEnv,
20427
20479
  isSCF,
20428
20480
  isWrappedSchema,
@@ -20431,5 +20483,6 @@ async function mcpc(serverConf, composeConf, setupCallback) {
20431
20483
  optionalObject,
20432
20484
  parseJSON,
20433
20485
  parseMcpcConfigs,
20486
+ setMarkdownAgentLoader,
20434
20487
  truncateJSON
20435
20488
  });
package/index.mjs CHANGED
@@ -14856,7 +14856,9 @@ var Client = class extends Protocol {
14856
14856
  }
14857
14857
  return taskValidationResult.data;
14858
14858
  }
14859
- const validationResult = safeParse3(CreateMessageResultSchema, result);
14859
+ const hasTools = params.tools || params.toolChoice;
14860
+ const resultSchema = hasTools ? CreateMessageResultWithToolsSchema : CreateMessageResultSchema;
14861
+ const validationResult = safeParse3(resultSchema, result);
14860
14862
  if (!validationResult.success) {
14861
14863
  const errorMessage = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);
14862
14864
  throw new McpError(ErrorCode.InvalidParams, `Invalid sampling result: ${errorMessage}`);
@@ -17772,7 +17774,7 @@ You must follow the <manual/>, obey the <rules/>, and use the <format/>.
17772
17774
 
17773
17775
  <parameters>
17774
17776
  \`tool\` - Which tool to execute: "man" to get schemas, or a tool name to execute
17775
- \`args\` - For "man": ["tool1", "tool2"]. For other tools: tool parameters that strictly adhere to the tool's JSON schema.
17777
+ \`args\` - For "man": { tools: ["tool1", "tool2"] }. For other tools: tool parameters that strictly adhere to the tool's JSON schema.
17776
17778
  </parameters>
17777
17779
 
17778
17780
  <rules>
@@ -17787,7 +17789,7 @@ Get tool schemas:
17787
17789
  \`\`\`json
17788
17790
  {
17789
17791
  "tool": "man",
17790
- "args": ["tool1", "tool2"]
17792
+ "args": { "tools": ["tool1", "tool2"] }
17791
17793
  }
17792
17794
  \`\`\`
17793
17795
 
@@ -17854,7 +17856,9 @@ Next: Execute \`{nextAction}\` by calling \`{toolName}\` again.`,
17854
17856
  /**
17855
17857
  * Error response templates
17856
17858
  */
17857
- ERROR_RESPONSE: `Validation failed: {errorMessage}`,
17859
+ ERROR_RESPONSE: `Validation failed: {errorMessage}
17860
+
17861
+ Adjust parameters and retry.`,
17858
17862
  /**
17859
17863
  * Completion message
17860
17864
  */
@@ -17919,7 +17923,7 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
17919
17923
  *
17920
17924
  * Only two fields:
17921
17925
  * - `tool`: which tool to execute (enum includes "man" + all tool names)
17922
- * - `args`: For "man": ["tool1", "tool2"] or { tools: [...] }. For others: tool parameters.
17926
+ * - `args`: object with parameters. For "man": { tools: ["a", "b"] }. For others: tool parameters.
17923
17927
  */
17924
17928
  forAgentic: function(allToolNames) {
17925
17929
  const toolEnum = [
@@ -17939,7 +17943,7 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
17939
17943
  },
17940
17944
  args: {
17941
17945
  type: "object",
17942
- description: `For "man": ["tool1", "tool2"]. For other tools: tool parameters that strictly adhere to the tool's JSON schema.`
17946
+ description: `For "man": { tools: ["tool1", "tool2"] }. For other tools: tool parameters that strictly adhere to the tool's JSON schema.`
17943
17947
  }
17944
17948
  },
17945
17949
  required: [
@@ -17949,22 +17953,35 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
17949
17953
  };
17950
17954
  },
17951
17955
  /**
17952
- * Schema for "man" command args validation (array format)
17953
- * Expected format: ["tool1", "tool2"]
17956
+ * Schema for "man" command args validation
17957
+ * Expected format: { tools: ["tool1", "tool2"] }
17954
17958
  */
17955
17959
  forMan: function(allToolNames) {
17956
17960
  return {
17957
- type: "array",
17958
- items: {
17959
- type: "string",
17960
- enum: allToolNames,
17961
- errorMessage: {
17962
- enum: `Invalid tool name. Available: ${allToolNames.join(", ")}`
17961
+ type: "object",
17962
+ properties: {
17963
+ tools: {
17964
+ type: "array",
17965
+ items: {
17966
+ type: "string",
17967
+ enum: allToolNames,
17968
+ errorMessage: {
17969
+ enum: `Invalid tool name. Available: ${allToolNames.join(", ")}`
17970
+ }
17971
+ },
17972
+ minItems: 1,
17973
+ errorMessage: {
17974
+ minItems: "At least one tool name is required"
17975
+ }
17963
17976
  }
17964
17977
  },
17965
- minItems: 1,
17978
+ required: [
17979
+ "tools"
17980
+ ],
17966
17981
  errorMessage: {
17967
- minItems: "At least one tool name is required"
17982
+ required: {
17983
+ tools: 'Missing "tools" field. Expected: { tools: ["tool1", "tool2"] }'
17984
+ }
17968
17985
  }
17969
17986
  };
17970
17987
  }
@@ -18142,10 +18159,9 @@ var AgenticExecutor = class {
18142
18159
  }
18143
18160
  const tool2 = args.tool;
18144
18161
  if (tool2 === "man") {
18145
- const toolsArray = Array.isArray(args.args) ? args.args : args.args?.tools;
18146
18162
  const createArgsDef = createArgsDefFactory(this.name, this.allToolNames, {});
18147
18163
  const manSchema = createArgsDef.forMan(this.allToolNames);
18148
- const manValidation = validateSchema(toolsArray ?? [], manSchema);
18164
+ const manValidation = validateSchema(args.args ?? {}, manSchema);
18149
18165
  if (!manValidation.valid) {
18150
18166
  return {
18151
18167
  content: [
@@ -18157,7 +18173,8 @@ var AgenticExecutor = class {
18157
18173
  isError: true
18158
18174
  };
18159
18175
  }
18160
- return this.handleManCommand(toolsArray, executeSpan);
18176
+ const argsObj = args.args;
18177
+ return this.handleManCommand(argsObj.tools, executeSpan);
18161
18178
  }
18162
18179
  const toolArgs = args.args || {};
18163
18180
  return await this.executeTool(tool2, toolArgs, executeSpan);
@@ -20378,12 +20395,44 @@ function convertToAISDKTools(server, helpers) {
20378
20395
  }
20379
20396
 
20380
20397
  // __mcpc__core_latest/node_modules/@mcpc/core/src/set-up-mcp-compose.js
20398
+ var markdownAgentLoader = null;
20399
+ function setMarkdownAgentLoader(loader) {
20400
+ markdownAgentLoader = loader;
20401
+ }
20402
+ function isMarkdownFile(path) {
20403
+ return path.endsWith(".md") || path.endsWith(".markdown");
20404
+ }
20405
+ async function resolveComposeInput(input) {
20406
+ if (typeof input !== "string") {
20407
+ return input;
20408
+ }
20409
+ if (!isMarkdownFile(input)) {
20410
+ throw new Error(`Invalid compose input: "${input}". Expected a Markdown file path (.md) or a ComposeDefinition object.`);
20411
+ }
20412
+ if (!markdownAgentLoader) {
20413
+ throw new Error(`Cannot load Markdown agent file "${input}": Markdown loader not available. Use markdownLoaderPlugin() from "@mcpc/plugin-markdown-loader", or use inline ComposeDefinition objects.`);
20414
+ }
20415
+ return await markdownAgentLoader(input);
20416
+ }
20381
20417
  function parseMcpcConfigs(conf) {
20382
20418
  return conf ?? [];
20383
20419
  }
20384
- async function mcpc(serverConf, composeConf, setupCallback) {
20420
+ async function mcpc(serverConf, composeConf, optionsOrSetup) {
20385
20421
  const server = new ComposableMCPServer(...serverConf);
20386
- const parsed = parseMcpcConfigs(composeConf);
20422
+ const options = typeof optionsOrSetup === "function" ? {
20423
+ setup: optionsOrSetup
20424
+ } : optionsOrSetup ?? {};
20425
+ if (options.plugins) {
20426
+ for (const plugin of options.plugins) {
20427
+ if (typeof plugin === "string") {
20428
+ await server.loadPluginFromPath(plugin);
20429
+ } else {
20430
+ await server.addPlugin(plugin);
20431
+ }
20432
+ }
20433
+ }
20434
+ const resolvedConfigs = composeConf ? await Promise.all(composeConf.map(resolveComposeInput)) : [];
20435
+ const parsed = parseMcpcConfigs(resolvedConfigs);
20387
20436
  await server.initBuiltInPlugins();
20388
20437
  for (const mcpcConfig of parsed) {
20389
20438
  if (mcpcConfig.plugins) {
@@ -20396,8 +20445,8 @@ async function mcpc(serverConf, composeConf, setupCallback) {
20396
20445
  }
20397
20446
  }
20398
20447
  }
20399
- if (setupCallback) {
20400
- await setupCallback(server);
20448
+ if (options.setup) {
20449
+ await options.setup(server);
20401
20450
  }
20402
20451
  for (const mcpcConfig of parsed) {
20403
20452
  await server.compose(mcpcConfig.name, mcpcConfig.description ?? "", mcpcConfig.deps, mcpcConfig.options);
@@ -20409,6 +20458,7 @@ export {
20409
20458
  composeMcpDepTools,
20410
20459
  convertToAISDKTools,
20411
20460
  extractJsonSchema,
20461
+ isMarkdownFile,
20412
20462
  isProdEnv,
20413
20463
  isSCF,
20414
20464
  isWrappedSchema,
@@ -20417,5 +20467,6 @@ export {
20417
20467
  optionalObject,
20418
20468
  parseJSON,
20419
20469
  parseMcpcConfigs,
20470
+ setMarkdownAgentLoader,
20420
20471
  truncateJSON
20421
20472
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpc-tech/core",
3
- "version": "0.3.22",
3
+ "version": "0.3.24",
4
4
  "homepage": "https://jsr.io/@mcpc/core",
5
5
  "dependencies": {
6
6
  "@ai-sdk/provider": "^2.0.0",
package/types/mod.d.ts CHANGED
@@ -47,11 +47,13 @@
47
47
  *
48
48
  * @module
49
49
  */ export * from "./src/compose.js";
50
+ export type { McpServerConfig, MCPSetting, SseServerConfig, StdioServerConfig, StreamableHTTPServerConfig } from "./src/service/tools.js";
51
+ export type { SamplingConfig, ToolRefXml } from "./src/types.js";
50
52
  export type { AgentToolRegistrationContext, ComposedTool, ComposeEndContext, ComposeStartContext, FinalizeContext, ToolConfig, ToolPlugin, TransformContext } from "./src/plugin-types.js";
51
53
  export * from "./src/utils/common/env.js";
52
54
  export * from "./src/utils/common/json.js";
53
55
  export * from "./src/utils/common/mcp.js";
54
- export * from "./src/set-up-mcp-compose.js";
56
+ export { type ComposeDefinition, type ComposeInput, type ComposibleMCPConfig, isMarkdownFile, type MarkdownAgentLoader, mcpc, type McpcOptions, parseMcpcConfigs, setMarkdownAgentLoader } from "./src/set-up-mcp-compose.js";
55
57
  export { extractJsonSchema, isWrappedSchema, jsonSchema, type Schema } from "./src/utils/schema.js";
56
58
  export { convertToAISDKTools, type JsonSchemaHelper, type ToolHelper } from "./src/ai-sdk-adapter.js";
57
59
  //# sourceMappingURL=mod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sources":["../mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDC,GAED,iCAAiC;AAGjC,cACE,4BAA4B,EAC5B,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,UAAU,EACV,UAAU,EACV,gBAAgB,gCACa;AAE/B,0CAA0C;AAC1C,2CAA2C;AAC3C,0CAA0C;AAE1C,4CAA4C;AAG5C,SACE,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,KAAK,MAAM,gCACkB;AAG/B,SACE,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,KAAK,UAAU,kCACgB"}
1
+ {"version":3,"file":"mod.d.ts","sources":["../mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDC,GAED,iCAAiC;AAGjC,cACE,eAAe,EACf,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,0BAA0B,iCACI;AAGhC,cAAc,cAAc,EAAE,UAAU,yBAAyB;AAGjE,cACE,4BAA4B,EAC5B,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,UAAU,EACV,UAAU,EACV,gBAAgB,gCACa;AAE/B,0CAA0C;AAC1C,2CAA2C;AAC3C,0CAA0C;AAE1C,SACE,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,cAAc,EACd,KAAK,mBAAmB,EACxB,IAAI,EACJ,KAAK,WAAW,EAChB,gBAAgB,EAChB,sBAAsB,sCACa;AAGrC,SACE,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,KAAK,MAAM,gCACkB;AAG/B,SACE,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,KAAK,UAAU,kCACgB"}
@@ -95,10 +95,52 @@ export interface ComposeDefinition {
95
95
  */ refs?: Array<ToolRefXml>;
96
96
  };
97
97
  }
98
+ /**
99
+ * Input type for mcpc() that supports both inline definitions and file paths.
100
+ * - ComposeDefinition: Inline agent definition object
101
+ * - string: Path to a Markdown agent file (.md)
102
+ *
103
+ * @example
104
+ * ```typescript
105
+ * // Mix of inline and file-based definitions
106
+ * await mcpc(serverConf, [
107
+ * './agents/coding-agent.md', // Load from file
108
+ * { name: 'inline-agent', description: '...' } // Inline definition
109
+ * ]);
110
+ * ```
111
+ */ export type ComposeInput = ComposeDefinition | string;
98
112
  export interface ComposibleMCPConfig {
99
113
  [key: string]: ComposeDefinition[];
100
114
  }
115
+ /**
116
+ * Markdown agent file loader function type.
117
+ * This is registered by markdownLoaderPlugin() to avoid circular dependencies.
118
+ */ export type MarkdownAgentLoader = (filePath: string) => Promise<ComposeDefinition>;
119
+ /**
120
+ * Register the Markdown agent loader (called by markdownLoaderPlugin())
121
+ */ export declare function setMarkdownAgentLoader(loader: MarkdownAgentLoader): void;
122
+ /**
123
+ * Check if a path is a Markdown file (.md or .markdown)
124
+ */ export declare function isMarkdownFile(path: string): boolean;
101
125
  export declare function parseMcpcConfigs(conf?: ComposeDefinition[]): ComposeDefinition[];
126
+ /**
127
+ * Options for mcpc() function
128
+ */ export interface McpcOptions {
129
+ /**
130
+ * Loader plugins to load BEFORE resolving compose inputs.
131
+ * These plugins register file loaders (e.g., markdown-loader) that are needed
132
+ * to parse file paths in composeConf.
133
+ *
134
+ * Supports both plugin objects and string paths (e.g., "@mcpc/plugin-markdown-loader").
135
+ *
136
+ * Note: This is different from ComposeDefinition.plugins which are runtime plugins
137
+ * that transform tool descriptions and results AFTER composition.
138
+ */ plugins?: (ToolPlugin | string)[];
139
+ /**
140
+ * Callback to register custom tools or perform additional setup before composition.
141
+ * Useful for adding internal tools or custom configurations.
142
+ */ setup?: (server: ComposableMCPServer) => void | Promise<void>;
143
+ }
102
144
  /**
103
145
  * Create and configure an agentic MCP server with composed tools.
104
146
  *
@@ -110,6 +152,7 @@ export declare function parseMcpcConfigs(conf?: ComposeDefinition[]): ComposeDef
110
152
  *
111
153
  * @example
112
154
  * ```typescript
155
+ * // Using inline definitions
113
156
  * const server = await mcpc(
114
157
  * [
115
158
  * { name: "coding-agent", version: "1.0.0" },
@@ -139,6 +182,16 @@ export declare function parseMcpcConfigs(conf?: ComposeDefinition[]): ComposeDef
139
182
  * options: { mode: "ai_sampling" }
140
183
  * }]
141
184
  * );
185
+ *
186
+ * // Using Markdown file paths with plugin
187
+ * import { markdownLoaderPlugin } from "@mcpc/plugin-markdown-loader";
188
+ *
189
+ * const server = await mcpc(
190
+ * [{ name: "my-server", version: "1.0.0" }, { capabilities: { tools: {} } }],
191
+ * ["./agents/coding-agent.md"],
192
+ * { plugins: [markdownLoaderPlugin()] }
193
+ * );
194
+ *
142
195
  * await server.connect(new StdioServerTransport());
143
196
  * ```
144
197
  *
@@ -146,20 +199,17 @@ export declare function parseMcpcConfigs(conf?: ComposeDefinition[]): ComposeDef
146
199
  * - First element: Server metadata (name, version)
147
200
  * - Second element: Server capabilities (tools, sampling, etc.)
148
201
  *
149
- * @param composeConf - Array of agent composition definitions. Each definition includes:
150
- * - name: Agent name (set to null for composition-only mode)
151
- * - description: Agent purpose with XML-like tool references (e.g., `<tool name="server.tool"/>`)
152
- * - deps: MCP server dependencies with transport configurations (stdio, sse, streamable-http)
153
- * - plugins: Global plugins to transform/extend tool behavior (objects or file paths)
154
- * - options: Execution mode settings (agentic, ai_sampling, ai_acp)
202
+ * @param composeConf - Array of agent composition definitions or Markdown file paths.
203
+ * - ComposeDefinition: Inline agent definition object
204
+ * - string: Path to a Markdown agent file (.md) - requires markdown-loader plugin
155
205
  *
156
- * @param setupCallback - Optional callback to register custom tools or perform additional setup
157
- * before composition. Useful for adding internal tools or custom configurations.
206
+ * @param options - Optional configuration for mcpc()
207
+ * - plugins: Plugins to load before resolving compose inputs (e.g., markdown-loader)
158
208
  *
159
209
  * @returns A configured MCP Server instance ready to connect to a transport
160
210
  *
161
211
  * @see {@link ComposeDefinition} for detailed composition configuration options
162
212
  * @see {@link ToolPlugin} for plugin development guide
163
213
  * @see https://github.com/mcpc-tech/mcpc/tree/main/docs for complete documentation
164
- */ export declare function mcpc(serverConf: ConstructorParameters<typeof ComposableMCPServer>, composeConf?: ComposeDefinition[], setupCallback?: (server: ComposableMCPServer) => void | Promise<void>): Promise<InstanceType<typeof ComposableMCPServer>>;
214
+ */ export declare function mcpc(serverConf: ConstructorParameters<typeof ComposableMCPServer>, composeConf?: ComposeInput[], optionsOrSetup?: McpcOptions | ((server: ComposableMCPServer) => void | Promise<void>)): Promise<InstanceType<typeof ComposableMCPServer>>;
165
215
  //# sourceMappingURL=set-up-mcp-compose.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"set-up-mcp-compose.d.ts","sources":["../../src/set-up-mcp-compose.ts"],"names":[],"mappings":"AAAA,SAAS,mBAAmB,oBAAoB;AAChD,cAAc,UAAU,6BAA6B;AACrD,cAAc,cAAc,qBAAqB;AACjD,cAAc,UAAU,4BAA4B;AACpD,cAAc,UAAU,qBAAqB;AAC7C,cAAc,aAAa,6BAA6B;AAExD,iBAAiB;EACf;;;GAGC,GACD,MAAM,MAAM,GAAG,IAAI;EACnB;;GAEC,GACD,cAAc,MAAM;EACpB,OAAO;EAEP;;;;;;;;;;;GAWC,GACD,WAAW,aAAa,MAAM;EAE9B;IACE;;;;;;KAMC,GACD,OAAO;IAEP;;KAEC,GACD,iBAAiB;IAEjB;;;;KAIC,GACD;MACE;QACE,QAAQ;UAAQ,OAAO,MAAM;;QAC7B,eAAe,MAAM;QACrB,gBAAgB,MAAM;QACtB,uBAAuB,MAAM;;;IAIjC;;;;KAIC,GACD;MACE,SAAS,MAAM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