async function createMcpClient(options) {
  const { mode, apiKeySecret } = options;
  if (!apiKeySecret) {
    throw new Error("API key secret is required");
  }
  switch (mode) {
    case "in-process": {
      if (!options.container) {
        throw new Error("DI container is required for in-process mode");
      }
      const { InProcessMcpClient } = await import("./in-process-client.js");
      return InProcessMcpClient.create({
        apiKeySecret,
        container: options.container
      });
    }
    case "stdio": {
      const { McpClient } = await import("./mcp-client.js");
      const stdioOptions = {
        transport: "stdio",
        apiKeySecret
      };
      if (options.stdioCommand) {
        stdioOptions.command = options.stdioCommand;
      }
      if (options.stdioArgs) {
        stdioOptions.args = options.stdioArgs;
      } else {
        stdioOptions.args = [
          "mercato",
          "ai_assistant",
          "mcp:serve",
          "--api-key",
          apiKeySecret
        ];
      }
      if (options.cwd) {
        stdioOptions.cwd = options.cwd;
      }
      return McpClient.connect(stdioOptions);
    }
    case "http": {
      if (!options.httpUrl) {
        throw new Error("HTTP URL is required for http mode");
      }
      const { McpClient } = await import("./mcp-client.js");
      return McpClient.connect({
        transport: "http",
        apiKeySecret,
        url: options.httpUrl
      });
    }
    default:
      throw new Error(`Unknown client mode: ${mode}`);
  }
}
export {
  createMcpClient
};
//# sourceMappingURL=client-factory.js.map
