@mcpc-tech/cli 0.1.43 → 0.1.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/mcpc.cjs CHANGED
@@ -2377,6 +2377,264 @@ if (typeof global.crypto === "undefined") {
2377
2377
  }
2378
2378
  var outgoingEnded = Symbol("outgoingEnded");
2379
2379
 
2380
+ // __mcpc__cli_latest/node_modules/@jsr/std__cli/parse_args.js
2381
+ var FLAG_REGEXP = /^(?:-(?:(?<doubleDash>-)(?<negated>no-)?)?)(?<key>.+?)(?:=(?<value>.+?))?$/s;
2382
+ var LETTER_REGEXP = /[A-Za-z]/;
2383
+ var NUMBER_REGEXP = /-?\d+(\.\d*)?(e-?\d+)?$/;
2384
+ var HYPHEN_REGEXP = /^(-|--)[^-]/;
2385
+ var VALUE_REGEXP = /=(?<value>.+)/;
2386
+ var FLAG_NAME_REGEXP = /^--[^=]+$/;
2387
+ var SPECIAL_CHAR_REGEXP = /\W/;
2388
+ var NON_WHITESPACE_REGEXP = /\S/;
2389
+ function isNumber(string3) {
2390
+ return NON_WHITESPACE_REGEXP.test(string3) && Number.isFinite(Number(string3));
2391
+ }
2392
+ function setNested(object5, keys, value, collect = false) {
2393
+ keys = [
2394
+ ...keys
2395
+ ];
2396
+ const key = keys.pop();
2397
+ keys.forEach((key2) => object5 = object5[key2] ??= {});
2398
+ if (collect) {
2399
+ const v = object5[key];
2400
+ if (Array.isArray(v)) {
2401
+ v.push(value);
2402
+ return;
2403
+ }
2404
+ value = v ? [
2405
+ v,
2406
+ value
2407
+ ] : [
2408
+ value
2409
+ ];
2410
+ }
2411
+ object5[key] = value;
2412
+ }
2413
+ function hasNested(object5, keys) {
2414
+ for (const key of keys) {
2415
+ const value = object5[key];
2416
+ if (!Object.hasOwn(object5, key)) return false;
2417
+ object5 = value;
2418
+ }
2419
+ return true;
2420
+ }
2421
+ function aliasIsBoolean(aliasMap, booleanSet, key) {
2422
+ const set = aliasMap.get(key);
2423
+ if (set === void 0) return false;
2424
+ for (const alias of set) if (booleanSet.has(alias)) return true;
2425
+ return false;
2426
+ }
2427
+ function isBooleanString(value) {
2428
+ return value === "true" || value === "false";
2429
+ }
2430
+ function parseBooleanString(value) {
2431
+ return value !== "false";
2432
+ }
2433
+ function parseArgs(args, options) {
2434
+ const { "--": doubleDash = false, alias = {}, boolean: boolean3 = false, default: defaults = {}, stopEarly = false, string: string3 = [], collect = [], negatable = [], unknown: unknownFn = (i) => i } = options ?? {};
2435
+ const aliasMap = /* @__PURE__ */ new Map();
2436
+ const booleanSet = /* @__PURE__ */ new Set();
2437
+ const stringSet = /* @__PURE__ */ new Set();
2438
+ const collectSet = /* @__PURE__ */ new Set();
2439
+ const negatableSet = /* @__PURE__ */ new Set();
2440
+ let allBools = false;
2441
+ if (alias) {
2442
+ for (const [key, value] of Object.entries(alias)) {
2443
+ if (value === void 0) {
2444
+ throw new TypeError("Alias value must be defined");
2445
+ }
2446
+ const aliases = Array.isArray(value) ? value : [
2447
+ value
2448
+ ];
2449
+ aliasMap.set(key, new Set(aliases));
2450
+ aliases.forEach((alias2) => aliasMap.set(alias2, /* @__PURE__ */ new Set([
2451
+ key,
2452
+ ...aliases.filter((it) => it !== alias2)
2453
+ ])));
2454
+ }
2455
+ }
2456
+ if (boolean3) {
2457
+ if (typeof boolean3 === "boolean") {
2458
+ allBools = boolean3;
2459
+ } else {
2460
+ const booleanArgs = Array.isArray(boolean3) ? boolean3 : [
2461
+ boolean3
2462
+ ];
2463
+ for (const key of booleanArgs.filter(Boolean)) {
2464
+ booleanSet.add(key);
2465
+ aliasMap.get(key)?.forEach((al) => {
2466
+ booleanSet.add(al);
2467
+ });
2468
+ }
2469
+ }
2470
+ }
2471
+ if (string3) {
2472
+ const stringArgs = Array.isArray(string3) ? string3 : [
2473
+ string3
2474
+ ];
2475
+ for (const key of stringArgs.filter(Boolean)) {
2476
+ stringSet.add(key);
2477
+ aliasMap.get(key)?.forEach((al) => stringSet.add(al));
2478
+ }
2479
+ }
2480
+ if (collect) {
2481
+ const collectArgs = Array.isArray(collect) ? collect : [
2482
+ collect
2483
+ ];
2484
+ for (const key of collectArgs.filter(Boolean)) {
2485
+ collectSet.add(key);
2486
+ aliasMap.get(key)?.forEach((al) => collectSet.add(al));
2487
+ }
2488
+ }
2489
+ if (negatable) {
2490
+ const negatableArgs = Array.isArray(negatable) ? negatable : [
2491
+ negatable
2492
+ ];
2493
+ for (const key of negatableArgs.filter(Boolean)) {
2494
+ negatableSet.add(key);
2495
+ aliasMap.get(key)?.forEach((alias2) => negatableSet.add(alias2));
2496
+ }
2497
+ }
2498
+ const argv = {
2499
+ _: []
2500
+ };
2501
+ function setArgument(key, value, arg, collect2) {
2502
+ if (!booleanSet.has(key) && !stringSet.has(key) && !aliasMap.has(key) && !collectSet.has(key) && !(allBools && FLAG_NAME_REGEXP.test(arg)) && unknownFn?.(arg, key, value) === false) {
2503
+ return;
2504
+ }
2505
+ if (typeof value === "string" && !stringSet.has(key)) {
2506
+ value = isNumber(value) ? Number(value) : value;
2507
+ }
2508
+ const collectable = collect2 && collectSet.has(key);
2509
+ setNested(argv, key.split("."), value, collectable);
2510
+ aliasMap.get(key)?.forEach((key2) => {
2511
+ setNested(argv, key2.split("."), value, collectable);
2512
+ });
2513
+ }
2514
+ let notFlags = [];
2515
+ const index = args.indexOf("--");
2516
+ if (index !== -1) {
2517
+ notFlags = args.slice(index + 1);
2518
+ args = args.slice(0, index);
2519
+ }
2520
+ argsLoop: for (let i = 0; i < args.length; i++) {
2521
+ const arg = args[i];
2522
+ const groups = arg.match(FLAG_REGEXP)?.groups;
2523
+ if (groups) {
2524
+ const { doubleDash: doubleDash2, negated } = groups;
2525
+ let key = groups.key;
2526
+ let value = groups.value;
2527
+ if (doubleDash2) {
2528
+ if (value) {
2529
+ if (booleanSet.has(key)) value = parseBooleanString(value);
2530
+ setArgument(key, value, arg, true);
2531
+ continue;
2532
+ }
2533
+ if (negated) {
2534
+ if (negatableSet.has(key)) {
2535
+ setArgument(key, false, arg, false);
2536
+ continue;
2537
+ }
2538
+ key = `no-${key}`;
2539
+ }
2540
+ const next = args[i + 1];
2541
+ if (next) {
2542
+ if (!booleanSet.has(key) && !allBools && !next.startsWith("-") && (!aliasMap.has(key) || !aliasIsBoolean(aliasMap, booleanSet, key))) {
2543
+ value = next;
2544
+ i++;
2545
+ setArgument(key, value, arg, true);
2546
+ continue;
2547
+ }
2548
+ if (isBooleanString(next)) {
2549
+ value = parseBooleanString(next);
2550
+ i++;
2551
+ setArgument(key, value, arg, true);
2552
+ continue;
2553
+ }
2554
+ }
2555
+ value = stringSet.has(key) ? "" : true;
2556
+ setArgument(key, value, arg, true);
2557
+ continue;
2558
+ }
2559
+ const letters = arg.slice(1, -1).split("");
2560
+ for (const [j, letter] of letters.entries()) {
2561
+ const next = arg.slice(j + 2);
2562
+ if (next === "-") {
2563
+ setArgument(letter, next, arg, true);
2564
+ continue;
2565
+ }
2566
+ if (LETTER_REGEXP.test(letter)) {
2567
+ const groups2 = VALUE_REGEXP.exec(next)?.groups;
2568
+ if (groups2) {
2569
+ setArgument(letter, groups2.value, arg, true);
2570
+ continue argsLoop;
2571
+ }
2572
+ if (NUMBER_REGEXP.test(next)) {
2573
+ setArgument(letter, next, arg, true);
2574
+ continue argsLoop;
2575
+ }
2576
+ }
2577
+ if (letters[j + 1]?.match(SPECIAL_CHAR_REGEXP)) {
2578
+ setArgument(letter, arg.slice(j + 2), arg, true);
2579
+ continue argsLoop;
2580
+ }
2581
+ setArgument(letter, stringSet.has(letter) ? "" : true, arg, true);
2582
+ }
2583
+ key = arg.slice(-1);
2584
+ if (key === "-") continue;
2585
+ const nextArg = args[i + 1];
2586
+ if (nextArg) {
2587
+ if (!HYPHEN_REGEXP.test(nextArg) && !booleanSet.has(key) && (!aliasMap.has(key) || !aliasIsBoolean(aliasMap, booleanSet, key))) {
2588
+ setArgument(key, nextArg, arg, true);
2589
+ i++;
2590
+ continue;
2591
+ }
2592
+ if (isBooleanString(nextArg)) {
2593
+ const value2 = parseBooleanString(nextArg);
2594
+ setArgument(key, value2, arg, true);
2595
+ i++;
2596
+ continue;
2597
+ }
2598
+ }
2599
+ setArgument(key, stringSet.has(key) ? "" : true, arg, true);
2600
+ continue;
2601
+ }
2602
+ if (unknownFn?.(arg) !== false) {
2603
+ argv._.push(stringSet.has("_") || !isNumber(arg) ? arg : Number(arg));
2604
+ }
2605
+ if (stopEarly) {
2606
+ argv._.push(...args.slice(i + 1));
2607
+ break;
2608
+ }
2609
+ }
2610
+ for (const [key, value] of Object.entries(defaults)) {
2611
+ const keys = key.split(".");
2612
+ if (!hasNested(argv, keys)) {
2613
+ setNested(argv, keys, value);
2614
+ aliasMap.get(key)?.forEach((key2) => setNested(argv, key2.split("."), value));
2615
+ }
2616
+ }
2617
+ for (const key of booleanSet.keys()) {
2618
+ const keys = key.split(".");
2619
+ if (!hasNested(argv, keys)) {
2620
+ const value = collectSet.has(key) ? [] : false;
2621
+ setNested(argv, keys, value);
2622
+ }
2623
+ }
2624
+ for (const key of stringSet.keys()) {
2625
+ const keys = key.split(".");
2626
+ if (!hasNested(argv, keys) && collectSet.has(key)) {
2627
+ setNested(argv, keys, []);
2628
+ }
2629
+ }
2630
+ if (doubleDash) {
2631
+ argv["--"] = notFlags;
2632
+ } else {
2633
+ argv._.push(...notFlags);
2634
+ }
2635
+ return argv;
2636
+ }
2637
+
2380
2638
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
2381
2639
  var import_promises3 = require("node:fs/promises");
2382
2640
  var import_node_os3 = require("node:os");
@@ -2982,6 +3240,7 @@ function getDefaultAgents() {
2982
3240
  }
2983
3241
 
2984
3242
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
3243
+ var CLI_VERSION = "0.1.44";
2985
3244
  function extractServerName(command, commandArgs) {
2986
3245
  for (const arg of commandArgs) {
2987
3246
  if (!arg.startsWith("-")) {
@@ -3089,97 +3348,50 @@ Created configuration for ${serverNames.length} MCP server(s)${modeInfo}`);
3089
3348
  }
3090
3349
  return config;
3091
3350
  }
3351
+ function printVersion() {
3352
+ console.log(`mcpc ${CLI_VERSION}`);
3353
+ }
3092
3354
  function printHelp() {
3093
3355
  console.log(`
3094
- MCPC CLI - Model Context Protocol Composer
3356
+ mcpc ${CLI_VERSION} - Model Context Protocol Composer
3095
3357
 
3096
3358
  USAGE:
3097
3359
  mcpc [OPTIONS]
3098
3360
 
3099
3361
  OPTIONS:
3100
- --help, -h Show this help message
3362
+ -h, --help Show this help message
3363
+ -v, --version Show version information
3101
3364
  --cwd <path> Change working directory before loading config
3102
- Useful when running from MCP Inspector or other tools
3103
3365
  --config <json> Inline JSON configuration string
3104
3366
  --config-url <url> Fetch configuration from URL
3105
3367
  --config-file <path> Load configuration from file path
3106
- --skills <dirs> Skills directories (comma-separated), default: .claude/skills
3107
- Example: --skills ./skills,./more-skills
3108
- --request-headers <header>, -H <header>
3109
- Add custom HTTP header for URL fetching
3110
- Format: "Key: Value" or "Key=Value"
3111
- Can be used multiple times
3112
- --mode <mode> Set execution mode for JSON/object agents (does not
3113
- affect Markdown agent files which define mode in frontmatter)
3114
- Supported modes:
3115
- - agentic: Fully autonomous agent mode (default)
3116
- - ai_sampling: AI SDK sampling mode for autonomous execution
3117
- - ai_acp: AI SDK ACP mode for coding agents
3118
- - code_execution: Code execution mode (requires @mcpc-tech/plugin-code-execution)
3368
+ --skills <dirs> Skills directories (comma-separated)
3369
+ -H, --request-headers <header>
3370
+ Add custom HTTP header for URL fetching
3371
+ Format: "Key: Value" or "Key=Value"
3372
+ --mode <mode> Set execution mode for agents
3373
+ Modes: agentic, ai_sampling, ai_acp, code_execution
3119
3374
  --add Add MCP servers to ~/.mcpc/config.json and exit
3120
- Then run 'mcpc' to start the server with saved config
3121
- Use --mcp-stdio, --mcp-http, or --mcp-sse to specify servers
3122
- --wrap Wrap and run MCP servers immediately without saving config
3123
- Use --mcp-stdio, --mcp-http, or --mcp-sse to specify servers
3375
+ --wrap Wrap and run MCP servers immediately
3124
3376
  --mcp-stdio <cmd> Add an MCP server with stdio transport
3125
- Example: --mcp-stdio "npx -y @wonderwhy-er/desktop-commander"
3126
3377
  --mcp-http <url> Add an MCP server with streamable-http transport
3127
- Example: --mcp-http "https://api.github.com/mcp"
3128
3378
  --mcp-sse <url> Add an MCP server with SSE transport
3129
- Example: --mcp-sse "https://api.example.com/sse"
3130
- --name <name> Custom agent name for wrap mode (overrides auto-detection)
3379
+ --name <name> Custom agent name for wrap mode
3131
3380
 
3132
3381
  ENVIRONMENT VARIABLES:
3133
- MCPC_CONFIG Inline JSON configuration (same as --config)
3134
- MCPC_CONFIG_URL URL to fetch config from (same as --config-url)
3135
- MCPC_CONFIG_FILE Path to config file (same as --config-file)
3382
+ MCPC_CONFIG Inline JSON configuration
3383
+ MCPC_CONFIG_URL URL to fetch config from
3384
+ MCPC_CONFIG_FILE Path to config file
3136
3385
 
3137
3386
  EXAMPLES:
3138
- # Show help
3139
3387
  mcpc --help
3140
-
3141
- # Add MCP servers to config and save to ~/.mcpc/config.json
3388
+ mcpc --version
3142
3389
  mcpc --add --mcp-stdio "npx -y @wonderwhy-er/desktop-commander"
3143
- # Edit ~/.mcpc/config.json if needed (add headers, etc.)
3144
- mcpc # Loads config from ~/.mcpc/config.json automatically
3145
-
3146
- # Wrap and run immediately (one-time use, no config saved)
3147
3390
  mcpc --wrap --mcp-stdio "npx -y @wonderwhy-er/desktop-commander"
3148
-
3149
- # Multiple servers with different transports
3150
- mcpc --add --mcp-stdio "npx -y @wonderwhy-er/desktop-commander" --mcp-http "https://api.github.com/mcp" --mcp-sse "https://api.example.com/sse"
3151
-
3152
- # Custom agent name
3153
- mcpc --add --name my-agent --mcp-stdio "npx shadcn@latest mcp"
3154
- mcpc --wrap --name my-agent --mcp-stdio "npx shadcn@latest mcp"
3155
-
3156
- # Load from URL
3157
- mcpc --config-url \\
3158
- "https://raw.githubusercontent.com/mcpc-tech/mcpc/main/packages/cli/examples/configs/codex-fork.json"
3159
-
3160
- # Load from URL with custom headers
3161
- mcpc \\
3162
- --config-url "https://api.example.com/config.json" \\
3163
- -H "Authorization: Bearer token123" \\
3164
- -H "X-Custom-Header: value"
3165
-
3166
- # Load from file
3391
+ mcpc --config-url "https://example.com/config.json"
3167
3392
  mcpc --config-file ./my-config.json
3168
3393
 
3169
- # Override execution mode for all agents
3170
- mcpc --config-file ./my-config.json --mode ai_sampling
3171
-
3172
- # Using environment variable
3173
- export MCPC_CONFIG='[{"name":"agent","description":"..."}]'
3174
- mcpc
3175
-
3176
- # Use default configuration (./mcpc.config.json)
3177
- mcpc
3178
-
3179
- CONFIGURATION:
3180
- Configuration files support environment variable substitution using $VAR_NAME syntax.
3181
-
3182
- Priority order:
3394
+ CONFIG PRIORITY:
3183
3395
  1. --config (inline JSON)
3184
3396
  2. MCPC_CONFIG environment variable
3185
3397
  3. --config-url or MCPC_CONFIG_URL
@@ -3187,74 +3399,125 @@ CONFIGURATION:
3187
3399
  5. ~/.mcpc/config.json (user config)
3188
3400
  6. ./mcpc.config.json (local config)
3189
3401
 
3190
- For more information, visit: https://github.com/mcpc-tech/mcpc
3402
+ For more information: https://github.com/mcpc-tech/mcpc
3191
3403
  `);
3192
3404
  }
3193
- function parseArgs() {
3194
- const args = import_node_process3.default.argv.slice(2);
3195
- const result = {};
3196
- for (let i = 0; i < args.length; i++) {
3197
- const arg = args[i];
3198
- if (arg === "--cwd" && i + 1 < args.length) {
3199
- result.cwd = args[++i];
3200
- } else if (arg === "--config" && i + 1 < args.length) {
3201
- result.config = args[++i];
3202
- } else if (arg === "--config-url" && i + 1 < args.length) {
3203
- result.configUrl = args[++i];
3204
- } else if (arg === "--config-file" && i + 1 < args.length) {
3205
- result.configFile = args[++i];
3206
- } else if ((arg === "--request-headers" || arg === "-H") && i + 1 < args.length) {
3207
- const headerStr = args[++i];
3208
- const colonIdx = headerStr.indexOf(":");
3209
- const equalIdx = headerStr.indexOf("=");
3210
- const separatorIdx = colonIdx !== -1 ? equalIdx !== -1 ? Math.min(colonIdx, equalIdx) : colonIdx : equalIdx;
3211
- if (separatorIdx !== -1) {
3212
- const key = headerStr.substring(0, separatorIdx).trim();
3213
- const value = headerStr.substring(separatorIdx + 1).trim();
3214
- if (!result.requestHeaders) {
3215
- result.requestHeaders = {};
3216
- }
3217
- result.requestHeaders[key] = value;
3218
- }
3219
- } else if (arg === "--help" || arg === "-h") {
3220
- result.help = true;
3221
- } else if (arg === "--add") {
3222
- result.add = true;
3223
- } else if (arg === "--wrap") {
3224
- result.wrap = true;
3225
- } else if ((arg === "--mcp-stdio" || arg === "--mcp-http" || arg === "--mcp-sse") && i + 1 < args.length) {
3226
- const cmdString = args[++i];
3227
- const cmdParts = cmdString.split(/\s+/);
3228
- const command = cmdParts[0];
3229
- const cmdArgs = cmdParts.slice(1);
3230
- let transportType;
3231
- if (arg === "--mcp-stdio") {
3232
- transportType = "stdio";
3233
- } else if (arg === "--mcp-http") {
3234
- transportType = "streamable-http";
3235
- } else {
3236
- transportType = "sse";
3405
+ function parseHeader(headerStr) {
3406
+ const colonIdx = headerStr.indexOf(":");
3407
+ const equalIdx = headerStr.indexOf("=");
3408
+ const separatorIdx = colonIdx !== -1 ? equalIdx !== -1 ? Math.min(colonIdx, equalIdx) : colonIdx : equalIdx;
3409
+ if (separatorIdx !== -1) {
3410
+ return {
3411
+ key: headerStr.substring(0, separatorIdx).trim(),
3412
+ value: headerStr.substring(separatorIdx + 1).trim()
3413
+ };
3414
+ }
3415
+ return null;
3416
+ }
3417
+ function parseMcpServer(cmdString, transportType) {
3418
+ const cmdParts = cmdString.split(/\s+/);
3419
+ return {
3420
+ command: cmdParts[0],
3421
+ args: cmdParts.slice(1),
3422
+ transportType
3423
+ };
3424
+ }
3425
+ function parseCLIArgs() {
3426
+ const args = parseArgs(import_node_process3.default.argv.slice(2), {
3427
+ boolean: [
3428
+ "help",
3429
+ "version",
3430
+ "add",
3431
+ "wrap"
3432
+ ],
3433
+ string: [
3434
+ "cwd",
3435
+ "config",
3436
+ "config-url",
3437
+ "config-file",
3438
+ "mode",
3439
+ "name",
3440
+ "skills",
3441
+ "mcp-stdio",
3442
+ "mcp-http",
3443
+ "mcp-sse"
3444
+ ],
3445
+ collect: [
3446
+ "request-headers",
3447
+ "mcp-stdio",
3448
+ "mcp-http",
3449
+ "mcp-sse"
3450
+ ],
3451
+ alias: {
3452
+ h: "help",
3453
+ v: "version",
3454
+ H: "request-headers"
3455
+ },
3456
+ default: {
3457
+ help: false,
3458
+ version: false,
3459
+ add: false,
3460
+ wrap: false
3461
+ }
3462
+ });
3463
+ const result = {
3464
+ help: args.help,
3465
+ version: args.version,
3466
+ add: args.add,
3467
+ wrap: args.wrap,
3468
+ cwd: args.cwd,
3469
+ config: args.config,
3470
+ configUrl: args["config-url"],
3471
+ configFile: args["config-file"],
3472
+ mode: args.mode,
3473
+ name: args.name
3474
+ };
3475
+ if (args.skills) {
3476
+ result.skills = args.skills.split(",").map((s) => s.trim()).filter(Boolean);
3477
+ }
3478
+ const headers = args["request-headers"];
3479
+ if (headers && headers.length > 0) {
3480
+ result.requestHeaders = {};
3481
+ for (const h of headers) {
3482
+ const parsed = parseHeader(h);
3483
+ if (parsed) {
3484
+ result.requestHeaders[parsed.key] = parsed.value;
3237
3485
  }
3238
- if (!result.mcpServers) {
3239
- result.mcpServers = [];
3486
+ }
3487
+ }
3488
+ const mcpStdio = args["mcp-stdio"];
3489
+ const mcpHttp = args["mcp-http"];
3490
+ const mcpSse = args["mcp-sse"];
3491
+ if (mcpStdio && mcpStdio.length > 0 || mcpHttp && mcpHttp.length > 0 || mcpSse && mcpSse.length > 0) {
3492
+ result.mcpServers = [];
3493
+ if (mcpStdio) {
3494
+ for (const cmd of mcpStdio) {
3495
+ result.mcpServers.push(parseMcpServer(cmd, "stdio"));
3496
+ }
3497
+ }
3498
+ if (mcpHttp) {
3499
+ for (const url2 of mcpHttp) {
3500
+ result.mcpServers.push(parseMcpServer(url2, "streamable-http"));
3501
+ }
3502
+ }
3503
+ if (mcpSse) {
3504
+ for (const url2 of mcpSse) {
3505
+ result.mcpServers.push(parseMcpServer(url2, "sse"));
3240
3506
  }
3241
- result.mcpServers.push({
3242
- command,
3243
- args: cmdArgs,
3244
- transportType
3245
- });
3246
- } else if (arg === "--mode" && i + 1 < args.length) {
3247
- result.mode = args[++i];
3248
- } else if (arg === "--name" && i + 1 < args.length) {
3249
- result.name = args[++i];
3250
- } else if (arg === "--skills" && i + 1 < args.length) {
3251
- result.skills = args[++i].split(",").map((s) => s.trim()).filter(Boolean);
3252
3507
  }
3253
3508
  }
3254
3509
  return result;
3255
3510
  }
3256
3511
  async function loadConfig() {
3257
- const args = parseArgs();
3512
+ const args = parseCLIArgs();
3513
+ if (args.version) {
3514
+ printVersion();
3515
+ import_node_process3.default.exit(0);
3516
+ }
3517
+ if (args.help) {
3518
+ printHelp();
3519
+ import_node_process3.default.exit(0);
3520
+ }
3258
3521
  if (args.cwd) {
3259
3522
  const targetCwd = (0, import_node_path6.resolve)(import_node_process3.default.cwd(), args.cwd);
3260
3523
  import_node_process3.default.chdir(targetCwd);
@@ -3264,10 +3527,6 @@ async function loadConfig() {
3264
3527
  config.skills = args.skills || config.skills || DEFAULT_SKILLS_PATHS;
3265
3528
  return config;
3266
3529
  };
3267
- if (args.help) {
3268
- printHelp();
3269
- import_node_process3.default.exit(0);
3270
- }
3271
3530
  if (args.add) {
3272
3531
  await createWrapConfig({
3273
3532
  ...args,
package/bin/mcpc.mjs CHANGED
@@ -2385,6 +2385,264 @@ if (typeof global.crypto === "undefined") {
2385
2385
  }
2386
2386
  var outgoingEnded = Symbol("outgoingEnded");
2387
2387
 
2388
+ // __mcpc__cli_latest/node_modules/@jsr/std__cli/parse_args.js
2389
+ var FLAG_REGEXP = /^(?:-(?:(?<doubleDash>-)(?<negated>no-)?)?)(?<key>.+?)(?:=(?<value>.+?))?$/s;
2390
+ var LETTER_REGEXP = /[A-Za-z]/;
2391
+ var NUMBER_REGEXP = /-?\d+(\.\d*)?(e-?\d+)?$/;
2392
+ var HYPHEN_REGEXP = /^(-|--)[^-]/;
2393
+ var VALUE_REGEXP = /=(?<value>.+)/;
2394
+ var FLAG_NAME_REGEXP = /^--[^=]+$/;
2395
+ var SPECIAL_CHAR_REGEXP = /\W/;
2396
+ var NON_WHITESPACE_REGEXP = /\S/;
2397
+ function isNumber(string3) {
2398
+ return NON_WHITESPACE_REGEXP.test(string3) && Number.isFinite(Number(string3));
2399
+ }
2400
+ function setNested(object5, keys, value, collect = false) {
2401
+ keys = [
2402
+ ...keys
2403
+ ];
2404
+ const key = keys.pop();
2405
+ keys.forEach((key2) => object5 = object5[key2] ??= {});
2406
+ if (collect) {
2407
+ const v = object5[key];
2408
+ if (Array.isArray(v)) {
2409
+ v.push(value);
2410
+ return;
2411
+ }
2412
+ value = v ? [
2413
+ v,
2414
+ value
2415
+ ] : [
2416
+ value
2417
+ ];
2418
+ }
2419
+ object5[key] = value;
2420
+ }
2421
+ function hasNested(object5, keys) {
2422
+ for (const key of keys) {
2423
+ const value = object5[key];
2424
+ if (!Object.hasOwn(object5, key)) return false;
2425
+ object5 = value;
2426
+ }
2427
+ return true;
2428
+ }
2429
+ function aliasIsBoolean(aliasMap, booleanSet, key) {
2430
+ const set = aliasMap.get(key);
2431
+ if (set === void 0) return false;
2432
+ for (const alias of set) if (booleanSet.has(alias)) return true;
2433
+ return false;
2434
+ }
2435
+ function isBooleanString(value) {
2436
+ return value === "true" || value === "false";
2437
+ }
2438
+ function parseBooleanString(value) {
2439
+ return value !== "false";
2440
+ }
2441
+ function parseArgs(args, options) {
2442
+ const { "--": doubleDash = false, alias = {}, boolean: boolean3 = false, default: defaults = {}, stopEarly = false, string: string3 = [], collect = [], negatable = [], unknown: unknownFn = (i) => i } = options ?? {};
2443
+ const aliasMap = /* @__PURE__ */ new Map();
2444
+ const booleanSet = /* @__PURE__ */ new Set();
2445
+ const stringSet = /* @__PURE__ */ new Set();
2446
+ const collectSet = /* @__PURE__ */ new Set();
2447
+ const negatableSet = /* @__PURE__ */ new Set();
2448
+ let allBools = false;
2449
+ if (alias) {
2450
+ for (const [key, value] of Object.entries(alias)) {
2451
+ if (value === void 0) {
2452
+ throw new TypeError("Alias value must be defined");
2453
+ }
2454
+ const aliases = Array.isArray(value) ? value : [
2455
+ value
2456
+ ];
2457
+ aliasMap.set(key, new Set(aliases));
2458
+ aliases.forEach((alias2) => aliasMap.set(alias2, /* @__PURE__ */ new Set([
2459
+ key,
2460
+ ...aliases.filter((it) => it !== alias2)
2461
+ ])));
2462
+ }
2463
+ }
2464
+ if (boolean3) {
2465
+ if (typeof boolean3 === "boolean") {
2466
+ allBools = boolean3;
2467
+ } else {
2468
+ const booleanArgs = Array.isArray(boolean3) ? boolean3 : [
2469
+ boolean3
2470
+ ];
2471
+ for (const key of booleanArgs.filter(Boolean)) {
2472
+ booleanSet.add(key);
2473
+ aliasMap.get(key)?.forEach((al) => {
2474
+ booleanSet.add(al);
2475
+ });
2476
+ }
2477
+ }
2478
+ }
2479
+ if (string3) {
2480
+ const stringArgs = Array.isArray(string3) ? string3 : [
2481
+ string3
2482
+ ];
2483
+ for (const key of stringArgs.filter(Boolean)) {
2484
+ stringSet.add(key);
2485
+ aliasMap.get(key)?.forEach((al) => stringSet.add(al));
2486
+ }
2487
+ }
2488
+ if (collect) {
2489
+ const collectArgs = Array.isArray(collect) ? collect : [
2490
+ collect
2491
+ ];
2492
+ for (const key of collectArgs.filter(Boolean)) {
2493
+ collectSet.add(key);
2494
+ aliasMap.get(key)?.forEach((al) => collectSet.add(al));
2495
+ }
2496
+ }
2497
+ if (negatable) {
2498
+ const negatableArgs = Array.isArray(negatable) ? negatable : [
2499
+ negatable
2500
+ ];
2501
+ for (const key of negatableArgs.filter(Boolean)) {
2502
+ negatableSet.add(key);
2503
+ aliasMap.get(key)?.forEach((alias2) => negatableSet.add(alias2));
2504
+ }
2505
+ }
2506
+ const argv = {
2507
+ _: []
2508
+ };
2509
+ function setArgument(key, value, arg, collect2) {
2510
+ if (!booleanSet.has(key) && !stringSet.has(key) && !aliasMap.has(key) && !collectSet.has(key) && !(allBools && FLAG_NAME_REGEXP.test(arg)) && unknownFn?.(arg, key, value) === false) {
2511
+ return;
2512
+ }
2513
+ if (typeof value === "string" && !stringSet.has(key)) {
2514
+ value = isNumber(value) ? Number(value) : value;
2515
+ }
2516
+ const collectable = collect2 && collectSet.has(key);
2517
+ setNested(argv, key.split("."), value, collectable);
2518
+ aliasMap.get(key)?.forEach((key2) => {
2519
+ setNested(argv, key2.split("."), value, collectable);
2520
+ });
2521
+ }
2522
+ let notFlags = [];
2523
+ const index = args.indexOf("--");
2524
+ if (index !== -1) {
2525
+ notFlags = args.slice(index + 1);
2526
+ args = args.slice(0, index);
2527
+ }
2528
+ argsLoop: for (let i = 0; i < args.length; i++) {
2529
+ const arg = args[i];
2530
+ const groups = arg.match(FLAG_REGEXP)?.groups;
2531
+ if (groups) {
2532
+ const { doubleDash: doubleDash2, negated } = groups;
2533
+ let key = groups.key;
2534
+ let value = groups.value;
2535
+ if (doubleDash2) {
2536
+ if (value) {
2537
+ if (booleanSet.has(key)) value = parseBooleanString(value);
2538
+ setArgument(key, value, arg, true);
2539
+ continue;
2540
+ }
2541
+ if (negated) {
2542
+ if (negatableSet.has(key)) {
2543
+ setArgument(key, false, arg, false);
2544
+ continue;
2545
+ }
2546
+ key = `no-${key}`;
2547
+ }
2548
+ const next = args[i + 1];
2549
+ if (next) {
2550
+ if (!booleanSet.has(key) && !allBools && !next.startsWith("-") && (!aliasMap.has(key) || !aliasIsBoolean(aliasMap, booleanSet, key))) {
2551
+ value = next;
2552
+ i++;
2553
+ setArgument(key, value, arg, true);
2554
+ continue;
2555
+ }
2556
+ if (isBooleanString(next)) {
2557
+ value = parseBooleanString(next);
2558
+ i++;
2559
+ setArgument(key, value, arg, true);
2560
+ continue;
2561
+ }
2562
+ }
2563
+ value = stringSet.has(key) ? "" : true;
2564
+ setArgument(key, value, arg, true);
2565
+ continue;
2566
+ }
2567
+ const letters = arg.slice(1, -1).split("");
2568
+ for (const [j, letter] of letters.entries()) {
2569
+ const next = arg.slice(j + 2);
2570
+ if (next === "-") {
2571
+ setArgument(letter, next, arg, true);
2572
+ continue;
2573
+ }
2574
+ if (LETTER_REGEXP.test(letter)) {
2575
+ const groups2 = VALUE_REGEXP.exec(next)?.groups;
2576
+ if (groups2) {
2577
+ setArgument(letter, groups2.value, arg, true);
2578
+ continue argsLoop;
2579
+ }
2580
+ if (NUMBER_REGEXP.test(next)) {
2581
+ setArgument(letter, next, arg, true);
2582
+ continue argsLoop;
2583
+ }
2584
+ }
2585
+ if (letters[j + 1]?.match(SPECIAL_CHAR_REGEXP)) {
2586
+ setArgument(letter, arg.slice(j + 2), arg, true);
2587
+ continue argsLoop;
2588
+ }
2589
+ setArgument(letter, stringSet.has(letter) ? "" : true, arg, true);
2590
+ }
2591
+ key = arg.slice(-1);
2592
+ if (key === "-") continue;
2593
+ const nextArg = args[i + 1];
2594
+ if (nextArg) {
2595
+ if (!HYPHEN_REGEXP.test(nextArg) && !booleanSet.has(key) && (!aliasMap.has(key) || !aliasIsBoolean(aliasMap, booleanSet, key))) {
2596
+ setArgument(key, nextArg, arg, true);
2597
+ i++;
2598
+ continue;
2599
+ }
2600
+ if (isBooleanString(nextArg)) {
2601
+ const value2 = parseBooleanString(nextArg);
2602
+ setArgument(key, value2, arg, true);
2603
+ i++;
2604
+ continue;
2605
+ }
2606
+ }
2607
+ setArgument(key, stringSet.has(key) ? "" : true, arg, true);
2608
+ continue;
2609
+ }
2610
+ if (unknownFn?.(arg) !== false) {
2611
+ argv._.push(stringSet.has("_") || !isNumber(arg) ? arg : Number(arg));
2612
+ }
2613
+ if (stopEarly) {
2614
+ argv._.push(...args.slice(i + 1));
2615
+ break;
2616
+ }
2617
+ }
2618
+ for (const [key, value] of Object.entries(defaults)) {
2619
+ const keys = key.split(".");
2620
+ if (!hasNested(argv, keys)) {
2621
+ setNested(argv, keys, value);
2622
+ aliasMap.get(key)?.forEach((key2) => setNested(argv, key2.split("."), value));
2623
+ }
2624
+ }
2625
+ for (const key of booleanSet.keys()) {
2626
+ const keys = key.split(".");
2627
+ if (!hasNested(argv, keys)) {
2628
+ const value = collectSet.has(key) ? [] : false;
2629
+ setNested(argv, keys, value);
2630
+ }
2631
+ }
2632
+ for (const key of stringSet.keys()) {
2633
+ const keys = key.split(".");
2634
+ if (!hasNested(argv, keys) && collectSet.has(key)) {
2635
+ setNested(argv, keys, []);
2636
+ }
2637
+ }
2638
+ if (doubleDash) {
2639
+ argv["--"] = notFlags;
2640
+ } else {
2641
+ argv._.push(...notFlags);
2642
+ }
2643
+ return argv;
2644
+ }
2645
+
2388
2646
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
2389
2647
  import { mkdir, readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
2390
2648
  import { homedir } from "node:os";
@@ -2990,6 +3248,7 @@ function getDefaultAgents() {
2990
3248
  }
2991
3249
 
2992
3250
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
3251
+ var CLI_VERSION = "0.1.44";
2993
3252
  function extractServerName(command, commandArgs) {
2994
3253
  for (const arg of commandArgs) {
2995
3254
  if (!arg.startsWith("-")) {
@@ -3097,97 +3356,50 @@ Created configuration for ${serverNames.length} MCP server(s)${modeInfo}`);
3097
3356
  }
3098
3357
  return config;
3099
3358
  }
3359
+ function printVersion() {
3360
+ console.log(`mcpc ${CLI_VERSION}`);
3361
+ }
3100
3362
  function printHelp() {
3101
3363
  console.log(`
3102
- MCPC CLI - Model Context Protocol Composer
3364
+ mcpc ${CLI_VERSION} - Model Context Protocol Composer
3103
3365
 
3104
3366
  USAGE:
3105
3367
  mcpc [OPTIONS]
3106
3368
 
3107
3369
  OPTIONS:
3108
- --help, -h Show this help message
3370
+ -h, --help Show this help message
3371
+ -v, --version Show version information
3109
3372
  --cwd <path> Change working directory before loading config
3110
- Useful when running from MCP Inspector or other tools
3111
3373
  --config <json> Inline JSON configuration string
3112
3374
  --config-url <url> Fetch configuration from URL
3113
3375
  --config-file <path> Load configuration from file path
3114
- --skills <dirs> Skills directories (comma-separated), default: .claude/skills
3115
- Example: --skills ./skills,./more-skills
3116
- --request-headers <header>, -H <header>
3117
- Add custom HTTP header for URL fetching
3118
- Format: "Key: Value" or "Key=Value"
3119
- Can be used multiple times
3120
- --mode <mode> Set execution mode for JSON/object agents (does not
3121
- affect Markdown agent files which define mode in frontmatter)
3122
- Supported modes:
3123
- - agentic: Fully autonomous agent mode (default)
3124
- - ai_sampling: AI SDK sampling mode for autonomous execution
3125
- - ai_acp: AI SDK ACP mode for coding agents
3126
- - code_execution: Code execution mode (requires @mcpc-tech/plugin-code-execution)
3376
+ --skills <dirs> Skills directories (comma-separated)
3377
+ -H, --request-headers <header>
3378
+ Add custom HTTP header for URL fetching
3379
+ Format: "Key: Value" or "Key=Value"
3380
+ --mode <mode> Set execution mode for agents
3381
+ Modes: agentic, ai_sampling, ai_acp, code_execution
3127
3382
  --add Add MCP servers to ~/.mcpc/config.json and exit
3128
- Then run 'mcpc' to start the server with saved config
3129
- Use --mcp-stdio, --mcp-http, or --mcp-sse to specify servers
3130
- --wrap Wrap and run MCP servers immediately without saving config
3131
- Use --mcp-stdio, --mcp-http, or --mcp-sse to specify servers
3383
+ --wrap Wrap and run MCP servers immediately
3132
3384
  --mcp-stdio <cmd> Add an MCP server with stdio transport
3133
- Example: --mcp-stdio "npx -y @wonderwhy-er/desktop-commander"
3134
3385
  --mcp-http <url> Add an MCP server with streamable-http transport
3135
- Example: --mcp-http "https://api.github.com/mcp"
3136
3386
  --mcp-sse <url> Add an MCP server with SSE transport
3137
- Example: --mcp-sse "https://api.example.com/sse"
3138
- --name <name> Custom agent name for wrap mode (overrides auto-detection)
3387
+ --name <name> Custom agent name for wrap mode
3139
3388
 
3140
3389
  ENVIRONMENT VARIABLES:
3141
- MCPC_CONFIG Inline JSON configuration (same as --config)
3142
- MCPC_CONFIG_URL URL to fetch config from (same as --config-url)
3143
- MCPC_CONFIG_FILE Path to config file (same as --config-file)
3390
+ MCPC_CONFIG Inline JSON configuration
3391
+ MCPC_CONFIG_URL URL to fetch config from
3392
+ MCPC_CONFIG_FILE Path to config file
3144
3393
 
3145
3394
  EXAMPLES:
3146
- # Show help
3147
3395
  mcpc --help
3148
-
3149
- # Add MCP servers to config and save to ~/.mcpc/config.json
3396
+ mcpc --version
3150
3397
  mcpc --add --mcp-stdio "npx -y @wonderwhy-er/desktop-commander"
3151
- # Edit ~/.mcpc/config.json if needed (add headers, etc.)
3152
- mcpc # Loads config from ~/.mcpc/config.json automatically
3153
-
3154
- # Wrap and run immediately (one-time use, no config saved)
3155
3398
  mcpc --wrap --mcp-stdio "npx -y @wonderwhy-er/desktop-commander"
3156
-
3157
- # Multiple servers with different transports
3158
- mcpc --add --mcp-stdio "npx -y @wonderwhy-er/desktop-commander" --mcp-http "https://api.github.com/mcp" --mcp-sse "https://api.example.com/sse"
3159
-
3160
- # Custom agent name
3161
- mcpc --add --name my-agent --mcp-stdio "npx shadcn@latest mcp"
3162
- mcpc --wrap --name my-agent --mcp-stdio "npx shadcn@latest mcp"
3163
-
3164
- # Load from URL
3165
- mcpc --config-url \\
3166
- "https://raw.githubusercontent.com/mcpc-tech/mcpc/main/packages/cli/examples/configs/codex-fork.json"
3167
-
3168
- # Load from URL with custom headers
3169
- mcpc \\
3170
- --config-url "https://api.example.com/config.json" \\
3171
- -H "Authorization: Bearer token123" \\
3172
- -H "X-Custom-Header: value"
3173
-
3174
- # Load from file
3399
+ mcpc --config-url "https://example.com/config.json"
3175
3400
  mcpc --config-file ./my-config.json
3176
3401
 
3177
- # Override execution mode for all agents
3178
- mcpc --config-file ./my-config.json --mode ai_sampling
3179
-
3180
- # Using environment variable
3181
- export MCPC_CONFIG='[{"name":"agent","description":"..."}]'
3182
- mcpc
3183
-
3184
- # Use default configuration (./mcpc.config.json)
3185
- mcpc
3186
-
3187
- CONFIGURATION:
3188
- Configuration files support environment variable substitution using $VAR_NAME syntax.
3189
-
3190
- Priority order:
3402
+ CONFIG PRIORITY:
3191
3403
  1. --config (inline JSON)
3192
3404
  2. MCPC_CONFIG environment variable
3193
3405
  3. --config-url or MCPC_CONFIG_URL
@@ -3195,74 +3407,125 @@ CONFIGURATION:
3195
3407
  5. ~/.mcpc/config.json (user config)
3196
3408
  6. ./mcpc.config.json (local config)
3197
3409
 
3198
- For more information, visit: https://github.com/mcpc-tech/mcpc
3410
+ For more information: https://github.com/mcpc-tech/mcpc
3199
3411
  `);
3200
3412
  }
3201
- function parseArgs() {
3202
- const args = process4.argv.slice(2);
3203
- const result = {};
3204
- for (let i = 0; i < args.length; i++) {
3205
- const arg = args[i];
3206
- if (arg === "--cwd" && i + 1 < args.length) {
3207
- result.cwd = args[++i];
3208
- } else if (arg === "--config" && i + 1 < args.length) {
3209
- result.config = args[++i];
3210
- } else if (arg === "--config-url" && i + 1 < args.length) {
3211
- result.configUrl = args[++i];
3212
- } else if (arg === "--config-file" && i + 1 < args.length) {
3213
- result.configFile = args[++i];
3214
- } else if ((arg === "--request-headers" || arg === "-H") && i + 1 < args.length) {
3215
- const headerStr = args[++i];
3216
- const colonIdx = headerStr.indexOf(":");
3217
- const equalIdx = headerStr.indexOf("=");
3218
- const separatorIdx = colonIdx !== -1 ? equalIdx !== -1 ? Math.min(colonIdx, equalIdx) : colonIdx : equalIdx;
3219
- if (separatorIdx !== -1) {
3220
- const key = headerStr.substring(0, separatorIdx).trim();
3221
- const value = headerStr.substring(separatorIdx + 1).trim();
3222
- if (!result.requestHeaders) {
3223
- result.requestHeaders = {};
3224
- }
3225
- result.requestHeaders[key] = value;
3226
- }
3227
- } else if (arg === "--help" || arg === "-h") {
3228
- result.help = true;
3229
- } else if (arg === "--add") {
3230
- result.add = true;
3231
- } else if (arg === "--wrap") {
3232
- result.wrap = true;
3233
- } else if ((arg === "--mcp-stdio" || arg === "--mcp-http" || arg === "--mcp-sse") && i + 1 < args.length) {
3234
- const cmdString = args[++i];
3235
- const cmdParts = cmdString.split(/\s+/);
3236
- const command = cmdParts[0];
3237
- const cmdArgs = cmdParts.slice(1);
3238
- let transportType;
3239
- if (arg === "--mcp-stdio") {
3240
- transportType = "stdio";
3241
- } else if (arg === "--mcp-http") {
3242
- transportType = "streamable-http";
3243
- } else {
3244
- transportType = "sse";
3413
+ function parseHeader(headerStr) {
3414
+ const colonIdx = headerStr.indexOf(":");
3415
+ const equalIdx = headerStr.indexOf("=");
3416
+ const separatorIdx = colonIdx !== -1 ? equalIdx !== -1 ? Math.min(colonIdx, equalIdx) : colonIdx : equalIdx;
3417
+ if (separatorIdx !== -1) {
3418
+ return {
3419
+ key: headerStr.substring(0, separatorIdx).trim(),
3420
+ value: headerStr.substring(separatorIdx + 1).trim()
3421
+ };
3422
+ }
3423
+ return null;
3424
+ }
3425
+ function parseMcpServer(cmdString, transportType) {
3426
+ const cmdParts = cmdString.split(/\s+/);
3427
+ return {
3428
+ command: cmdParts[0],
3429
+ args: cmdParts.slice(1),
3430
+ transportType
3431
+ };
3432
+ }
3433
+ function parseCLIArgs() {
3434
+ const args = parseArgs(process4.argv.slice(2), {
3435
+ boolean: [
3436
+ "help",
3437
+ "version",
3438
+ "add",
3439
+ "wrap"
3440
+ ],
3441
+ string: [
3442
+ "cwd",
3443
+ "config",
3444
+ "config-url",
3445
+ "config-file",
3446
+ "mode",
3447
+ "name",
3448
+ "skills",
3449
+ "mcp-stdio",
3450
+ "mcp-http",
3451
+ "mcp-sse"
3452
+ ],
3453
+ collect: [
3454
+ "request-headers",
3455
+ "mcp-stdio",
3456
+ "mcp-http",
3457
+ "mcp-sse"
3458
+ ],
3459
+ alias: {
3460
+ h: "help",
3461
+ v: "version",
3462
+ H: "request-headers"
3463
+ },
3464
+ default: {
3465
+ help: false,
3466
+ version: false,
3467
+ add: false,
3468
+ wrap: false
3469
+ }
3470
+ });
3471
+ const result = {
3472
+ help: args.help,
3473
+ version: args.version,
3474
+ add: args.add,
3475
+ wrap: args.wrap,
3476
+ cwd: args.cwd,
3477
+ config: args.config,
3478
+ configUrl: args["config-url"],
3479
+ configFile: args["config-file"],
3480
+ mode: args.mode,
3481
+ name: args.name
3482
+ };
3483
+ if (args.skills) {
3484
+ result.skills = args.skills.split(",").map((s) => s.trim()).filter(Boolean);
3485
+ }
3486
+ const headers = args["request-headers"];
3487
+ if (headers && headers.length > 0) {
3488
+ result.requestHeaders = {};
3489
+ for (const h of headers) {
3490
+ const parsed = parseHeader(h);
3491
+ if (parsed) {
3492
+ result.requestHeaders[parsed.key] = parsed.value;
3245
3493
  }
3246
- if (!result.mcpServers) {
3247
- result.mcpServers = [];
3494
+ }
3495
+ }
3496
+ const mcpStdio = args["mcp-stdio"];
3497
+ const mcpHttp = args["mcp-http"];
3498
+ const mcpSse = args["mcp-sse"];
3499
+ if (mcpStdio && mcpStdio.length > 0 || mcpHttp && mcpHttp.length > 0 || mcpSse && mcpSse.length > 0) {
3500
+ result.mcpServers = [];
3501
+ if (mcpStdio) {
3502
+ for (const cmd of mcpStdio) {
3503
+ result.mcpServers.push(parseMcpServer(cmd, "stdio"));
3504
+ }
3505
+ }
3506
+ if (mcpHttp) {
3507
+ for (const url2 of mcpHttp) {
3508
+ result.mcpServers.push(parseMcpServer(url2, "streamable-http"));
3509
+ }
3510
+ }
3511
+ if (mcpSse) {
3512
+ for (const url2 of mcpSse) {
3513
+ result.mcpServers.push(parseMcpServer(url2, "sse"));
3248
3514
  }
3249
- result.mcpServers.push({
3250
- command,
3251
- args: cmdArgs,
3252
- transportType
3253
- });
3254
- } else if (arg === "--mode" && i + 1 < args.length) {
3255
- result.mode = args[++i];
3256
- } else if (arg === "--name" && i + 1 < args.length) {
3257
- result.name = args[++i];
3258
- } else if (arg === "--skills" && i + 1 < args.length) {
3259
- result.skills = args[++i].split(",").map((s) => s.trim()).filter(Boolean);
3260
3515
  }
3261
3516
  }
3262
3517
  return result;
3263
3518
  }
3264
3519
  async function loadConfig() {
3265
- const args = parseArgs();
3520
+ const args = parseCLIArgs();
3521
+ if (args.version) {
3522
+ printVersion();
3523
+ process4.exit(0);
3524
+ }
3525
+ if (args.help) {
3526
+ printHelp();
3527
+ process4.exit(0);
3528
+ }
3266
3529
  if (args.cwd) {
3267
3530
  const targetCwd = resolve4(process4.cwd(), args.cwd);
3268
3531
  process4.chdir(targetCwd);
@@ -3272,10 +3535,6 @@ async function loadConfig() {
3272
3535
  config.skills = args.skills || config.skills || DEFAULT_SKILLS_PATHS;
3273
3536
  return config;
3274
3537
  };
3275
- if (args.help) {
3276
- printHelp();
3277
- process4.exit(0);
3278
- }
3279
3538
  if (args.add) {
3280
3539
  await createWrapConfig({
3281
3540
  ...args,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpc-tech/cli",
3
- "version": "0.1.43",
3
+ "version": "0.1.44",
4
4
  "homepage": "https://jsr.io/@mcpc/cli",
5
5
  "dependencies": {
6
6
  "@hono/zod-openapi": "^0.19.2",
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sources":["../../../src/config/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CC,GAED,cAAc,YAAY,0BAAiC;AAO3D,iBAAiB;EACf;;GAEC,GACD,OAAO,MAAM;EACb;;GAEC,GACD,UAAU,MAAM;EAChB;;GAEC,GACD;IACE,QAAQ,OAAO,MAAM,EAAE,OAAO;IAC9B,WAAW,OAAO,MAAM,EAAE,OAAO;;EAEnC;;GAEC,GACD,QAAQ;EACR;;;GAGC,GACD,SAAS,MAAM;;AAuZjB;;;CAGC,GACD,OAAO,iBAAe,cAAc,QAAQ,aAAa,IAAI;AAkQ7D;;CAEC,GACD,OAAO,iBAAS,eAAe,QAAQ,UAAU,GAAG,IAAI"}
1
+ {"version":3,"file":"loader.d.ts","sources":["../../../src/config/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CC,GAED,cAAc,YAAY,0BAAiC;AAW3D,iBAAiB;EACf;;GAEC,GACD,OAAO,MAAM;EACb;;GAEC,GACD,UAAU,MAAM;EAChB;;GAEC,GACD;IACE,QAAQ,OAAO,MAAM,EAAE,OAAO;IAC9B,WAAW,OAAO,MAAM,EAAE,OAAO;;EAEnC;;GAEC,GACD,QAAQ;EACR;;;GAGC,GACD,SAAS,MAAM;;AA8YjB;;;CAGC,GACD,OAAO,iBAAe,cAAc,QAAQ,aAAa,IAAI;AAwQ7D;;CAEC,GACD,OAAO,iBAAS,eAAe,QAAQ,UAAU,GAAG,IAAI"}