@mcpc-tech/cli 0.1.15 → 0.1.17

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
@@ -5,79 +5,108 @@
5
5
 
6
6
  CLI server for MCPC with configuration support.
7
7
 
8
- > **Note:** This package is published as `@mcpc-tech/cli` on npm and `@mcpc/cli`
9
- > on JSR.
8
+ > **Note:** Published as `@mcpc-tech/cli` on npm and `@mcpc/cli` on JSR.
10
9
 
11
10
  ## Quick Start
12
11
 
13
12
  ```bash
14
- # Using npm
15
- npx -y @mcpc-tech/cli --help
13
+ # Install globally (or use npx -y @mcpc-tech/cli instead of mcpc)
14
+ npm install -g @mcpc-tech/cli
16
15
 
17
- # Using JSR
18
- npx -y deno run -A jsr:@mcpc/cli/bin --help
16
+ # Wrap an existing MCP server and run it immediately
17
+ mcpc --wrap --name "file-manager" \
18
+ --mcp-stdio "npx -y @wonderwhy-er/desktop-commander"
19
19
 
20
- # Load configuration from URL
21
- npx -y deno run -A jsr:@mcpc/cli/bin --config-url \
22
- "https://raw.githubusercontent.com/mcpc-tech/mcpc/main/packages/cli/examples/configs/codex-fork.json"
23
- ```
24
-
25
- ## Configuration
20
+ # Add MCP servers to config, then run separately
21
+ mcpc --add --mcp-stdio "npx -y @wonderwhy-er/desktop-commander"
22
+ mcpc # Loads ~/.mcpc/config.json automatically
26
23
 
27
- Load configuration using command-line arguments:
24
+ # Show help
25
+ mcpc --help
26
+ ```
28
27
 
29
- - `--help`, `-h` - Show help message
30
- - `--config <json>` - Inline JSON configuration string
31
- - `--config-url <url>` - Fetch from URL (e.g., GitHub raw)
32
- - `--config-file <path>` - Path to configuration file
33
- - `--request-headers <header>`, `-H <header>` - Add custom HTTP header for URL
34
- fetching (can be used multiple times)
35
- - No arguments - Uses `./mcpc.config.json` if available
28
+ ## Wrapping MCP Servers
36
29
 
37
- ## Usage
30
+ The simplest way to use MCPC is to wrap existing MCP servers with custom
31
+ execution modes:
38
32
 
39
- **Show help:**
33
+ ### One-time Run (no config saved)
40
34
 
41
35
  ```bash
42
- npx -y deno run -A jsr:@mcpc/cli/bin --help
36
+ # Wrap and run a single MCP server
37
+ mcpc --wrap --name "my-file-manager-agent" \
38
+ --mcp-stdio "npx -y @wonderwhy-er/desktop-commander"
39
+
40
+ # Wrap multiple servers with different protocols and execution mode
41
+ mcpc --wrap --name "file-and-github-agent" --mode code_execution \
42
+ --mcp-stdio "npx -y @wonderwhy-er/desktop-commander" \
43
+ --mcp-http "https://api.github.com/mcp"
43
44
  ```
44
45
 
45
- **Inline JSON config:**
46
+ ### Persistent Config (save and reuse)
46
47
 
47
48
  ```bash
48
- npx -y deno run -A jsr:@mcpc/cli/bin --config '[{"name":"my-agent","description":"..."}]'
49
- ```
49
+ # Step 1: Add servers to config
50
+ mcpc --add --mcp-stdio "npx -y @wonderwhy-er/desktop-commander"
50
51
 
51
- **From URL:**
52
+ # Step 2: (Optional) Edit ~/.mcpc/config.json to add headers, env vars, etc.
52
53
 
53
- ```bash
54
- npx -y deno run -A jsr:@mcpc/cli/bin --config-url https://example.com/config.json
54
+ # Step 3: Run with saved config
55
+ mcpc # Automatically loads ~/.mcpc/config.json
55
56
  ```
56
57
 
57
- **From URL with custom headers:**
58
+ The config file lets you add custom headers, environment variables, and other
59
+ settings:
58
60
 
59
- ```bash
60
- npx -y deno run -A jsr:@mcpc/cli/bin \
61
- --config-url https://api.example.com/config.json \
62
- -H "Authorization: Bearer token123" \
63
- -H "X-Custom-Header: value"
61
+ ```json
62
+ {
63
+ "agents": [{
64
+ "deps": {
65
+ "mcpServers": {
66
+ "github": {
67
+ "command": "https://api.github.com/mcp",
68
+ "transportType": "streamable-http",
69
+ "headers": {
70
+ "Authorization": "Bearer YOUR_TOKEN"
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }]
76
+ }
64
77
  ```
65
78
 
66
- **From file:**
79
+ ## Configuration Files
80
+
81
+ Load config from different sources:
67
82
 
68
83
  ```bash
69
- npx -y deno run -A jsr:@mcpc/cli/bin --config-file ./my-config.json
70
- ```
84
+ # From a specific file
85
+ mcpc --config-file ./my-config.json
71
86
 
72
- **Default (uses ./mcpc.config.json):**
87
+ # From a URL
88
+ mcpc --config-url https://example.com/config.json
73
89
 
74
- ```bash
75
- npx -y deno run -A jsr:@mcpc/cli/bin
90
+ # From URL with custom headers
91
+ mcpc --config-url https://api.example.com/config.json \
92
+ -H "Authorization: Bearer token123"
93
+
94
+ # Inline JSON
95
+ mcpc --config '[{"name":"my-agent","description":"..."}]'
76
96
  ```
77
97
 
78
- **Environment variable substitution:**
98
+ ### Config Priority Order
99
+
100
+ 1. `--config` (inline JSON)
101
+ 2. `MCPC_CONFIG` environment variable
102
+ 3. `--config-url` or `MCPC_CONFIG_URL`
103
+ 4. `--config-file` or `MCPC_CONFIG_FILE`
104
+ 5. `~/.mcpc/config.json` (user config)
105
+ 6. `./mcpc.config.json` (local config)
106
+
107
+ ### Environment Variables
79
108
 
80
- Config files support `$ENV_VAR_NAME` syntax:
109
+ Use `$VAR_NAME` syntax in config files:
81
110
 
82
111
  ```json
83
112
  {
@@ -86,7 +115,7 @@ Config files support `$ENV_VAR_NAME` syntax:
86
115
  "mcpServers": {
87
116
  "github": {
88
117
  "headers": {
89
- "Authorization": "Bearer $GITHUB_PERSONAL_ACCESS_TOKEN"
118
+ "Authorization": "Bearer $GITHUB_TOKEN"
90
119
  }
91
120
  }
92
121
  }
@@ -95,14 +124,78 @@ Config files support `$ENV_VAR_NAME` syntax:
95
124
  }
96
125
  ```
97
126
 
98
- **HTTP server:**
127
+ ## HTTP Server
128
+
129
+ Run as an HTTP server instead of stdio:
130
+
131
+ ```bash
132
+ deno run -A jsr:@mcpc/cli/server --config-file ./my-config.json
133
+ ```
134
+
135
+ ## Command Reference
136
+
137
+ ### Main Options
138
+
139
+ - `--help`, `-h` - Show help message
140
+ - `--add` - Add MCP servers to `~/.mcpc/config.json` and exit
141
+ - `--wrap` - Wrap and run MCP servers immediately (no config saved)
142
+ - `--mcp-stdio <cmd>` - Add stdio MCP server
143
+ - `--mcp-http <url>` - Add HTTP MCP server
144
+ - `--mcp-sse <url>` - Add SSE MCP server
145
+ - `--name <name>` - Custom agent name (default: auto-generated from server
146
+ names)
147
+ - `--mode <mode>` - Execution mode (default: `agentic`)
148
+
149
+ ### Execution Modes (`--mode`)
150
+
151
+ MCPC supports different execution modes that control how the agent processes and
152
+ executes tools:
153
+
154
+ #### `agentic` (default)
155
+
156
+ Interactive tool execution where the AI agent decides which tools to call and
157
+ when. The agent can make multiple tool calls in a conversation-like flow.
158
+
159
+ ```bash
160
+ mcpc --wrap --mode agentic --name "smart-assistant" \
161
+ --mcp-stdio "npx -y @wonderwhy-er/desktop-commander"
162
+ ```
163
+
164
+ #### `agentic_workflow`
165
+
166
+ Structured execution with predefined or runtime-generated steps. The agent
167
+ follows a workflow pattern with specific actions at each step.
99
168
 
100
169
  ```bash
101
- npx -y deno run -A jsr:@mcpc/cli/server --config-file ./my-config.json
170
+ mcpc --wrap --mode agentic_workflow --name "workflow-processor" \
171
+ --mcp-stdio "npx -y @wonderwhy-er/desktop-commander"
102
172
  ```
103
173
 
174
+ #### `code_execution`
175
+
176
+ Enables code execution capabilities for running code snippets and scripts
177
+ through the agent.
178
+
179
+ ```bash
180
+ mcpc --wrap --mode code_execution --name "code-runner" \
181
+ --mcp-stdio "npx -y @wonderwhy-er/desktop-commander"
182
+ ```
183
+
184
+ > **Note:** Different modes may require specific plugins to be available. The
185
+ > `agentic` mode is always available by default.
186
+
187
+ ### Config Options
188
+
189
+ - `--config <json>` - Inline JSON config
190
+ - `--config-url <url>` - Fetch config from URL
191
+ - `--config-file <path>` - Load config from file
192
+ - `--request-headers <header>`, `-H <header>` - Add HTTP header for URL fetching
193
+
104
194
  ## Examples
105
195
 
196
+ See the [examples directory](examples/) for complete working examples using the
197
+ Codex Fork configuration.
198
+
106
199
  ### Required Environment Variables
107
200
 
108
201
  When using the Codex Fork configuration:
package/bin/mcpc.mjs CHANGED
@@ -3864,9 +3864,16 @@ var ComposableMCPServer = class extends Server {
3864
3864
  const toolNameToIdMapping = /* @__PURE__ */ new Map();
3865
3865
  const requestedToolNames = /* @__PURE__ */ new Set();
3866
3866
  const availableToolNames = /* @__PURE__ */ new Set();
3867
+ const allPlaceholderUsages = [];
3867
3868
  tagToResults.tool.forEach((tool) => {
3868
3869
  if (tool.attribs.name) {
3869
- requestedToolNames.add(sanitizePropertyKey(tool.attribs.name));
3870
+ const originalName = tool.attribs.name;
3871
+ const toolName = sanitizePropertyKey(originalName);
3872
+ if (toolName.endsWith(`_${ALL_TOOLS_PLACEHOLDER2}`) || toolName === ALL_TOOLS_PLACEHOLDER2) {
3873
+ allPlaceholderUsages.push(originalName);
3874
+ } else {
3875
+ requestedToolNames.add(toolName);
3876
+ }
3870
3877
  }
3871
3878
  });
3872
3879
  const { tools, cleanupClients } = await composeMcpDepTools(depsConfig, ({ mcpName, toolNameWithScope, toolId }) => {
@@ -3907,6 +3914,14 @@ var ComposableMCPServer = class extends Server {
3907
3914
  }
3908
3915
  availableToolNames.add(toolName);
3909
3916
  });
3917
+ if (allPlaceholderUsages.length > 0) {
3918
+ await this.logger.warning(`Found ${allPlaceholderUsages.length} __ALL__ placeholder(s) for agent "${name}":`);
3919
+ allPlaceholderUsages.forEach((usage) => {
3920
+ this.logger.warning(` \u2022 "${usage}" - consider using specific tool names`);
3921
+ });
3922
+ const available = Array.from(availableToolNames).sort().join(", ");
3923
+ await this.logger.warning(` Available tools: ${available}`);
3924
+ }
3910
3925
  const unmatchedTools = Array.from(requestedToolNames).filter((toolName) => !allTools[toolName]);
3911
3926
  if (unmatchedTools.length > 0) {
3912
3927
  await this.logger.warning(`Tool matching warnings for agent "${name}":`);
@@ -4388,8 +4403,9 @@ var createServer = async (config2) => {
4388
4403
  };
4389
4404
 
4390
4405
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
4391
- import { readFile } from "node:fs/promises";
4392
- import { resolve as resolve2 } from "node:path";
4406
+ import { access, mkdir, readFile, writeFile as writeFile2 } from "node:fs/promises";
4407
+ import { homedir } from "node:os";
4408
+ import { dirname, join as join2, resolve as resolve2 } from "node:path";
4393
4409
  import process7 from "node:process";
4394
4410
  function extractServerName(command, commandArgs) {
4395
4411
  for (const arg of commandArgs) {
@@ -4401,33 +4417,83 @@ function extractServerName(command, commandArgs) {
4401
4417
  const name = command.replace(/[@.,/\\:;!?#$%^&*()[\]{}]/g, "_").substring(0, 64);
4402
4418
  return name || "agentic-tool";
4403
4419
  }
4404
- function createProxyConfig(args) {
4405
- if (!args.proxyCommand || args.proxyCommand.length === 0) {
4406
- console.error("Error: --proxy requires a command after --");
4407
- console.error("Example: mcpc --proxy --transport-type stdio -- npx -y @wonderwhy-er/desktop-commander");
4408
- process7.exit(1);
4420
+ function getUserConfigDir() {
4421
+ return join2(homedir(), ".mcpc");
4422
+ }
4423
+ function getUserConfigPath() {
4424
+ return join2(getUserConfigDir(), "config.json");
4425
+ }
4426
+ async function saveUserConfig(config2) {
4427
+ const configPath = getUserConfigPath();
4428
+ const configDir = dirname(configPath);
4429
+ try {
4430
+ let exists = false;
4431
+ try {
4432
+ await access(configPath);
4433
+ exists = true;
4434
+ } catch {
4435
+ }
4436
+ if (exists) {
4437
+ console.error(`
4438
+ \u26A0 Configuration file already exists: ${configPath}
4439
+
4440
+ To avoid overwriting your customized settings:
4441
+ 1. Use a different output path with --config-file
4442
+ 2. Or manually merge the new servers into your existing config
4443
+ 3. Or delete the file first: rm ${configPath}
4444
+
4445
+ Skipping save to preserve your existing configuration.
4446
+ `);
4447
+ return;
4448
+ }
4449
+ await mkdir(configDir, {
4450
+ recursive: true
4451
+ });
4452
+ await writeFile2(configPath, JSON.stringify(config2, null, 2), "utf-8");
4453
+ console.error(`
4454
+ \u2713 Configuration saved to: ${configPath}
4455
+
4456
+ Next steps:
4457
+ 1. (Optional) Edit the config to add headers, env vars, etc.
4458
+ Examples:
4459
+ - Add headers: "headers": {"Authorization": "Bearer \${YOUR_TOKEN}"}
4460
+ - Add env vars: "env": {"API_KEY": "\${API_KEY}"}
4461
+
4462
+ 2. Run the server:
4463
+ mcpc
4464
+
4465
+ The config will be loaded automatically from ${configPath}
4466
+ `);
4467
+ } catch (error) {
4468
+ console.error(`Warning: Failed to save config to ${configPath}:`, error);
4409
4469
  }
4410
- if (!args.transportType) {
4411
- console.error("Error: --proxy requires --transport-type to be specified");
4412
- console.error("Supported types: stdio, streamable-http, sse");
4413
- console.error("Example: mcpc --proxy --transport-type stdio -- npx -y @wonderwhy-er/desktop-commander");
4470
+ }
4471
+ async function createWrapConfig(args) {
4472
+ if (!args.mcpServers || args.mcpServers.length === 0) {
4473
+ console.error("Error: --wrap/--add requires at least one MCP server");
4474
+ console.error("Example: mcpc --wrap --mcp-stdio 'npx -y @wonderwhy-er/desktop-commander'");
4475
+ console.error("Multiple: mcpc --add --mcp-stdio 'npx -y server1' --mcp-http 'https://api.example.com'");
4414
4476
  process7.exit(1);
4415
4477
  }
4416
- const validTransports = [
4417
- "stdio",
4418
- "streamable-http",
4419
- "sse"
4420
- ];
4421
- if (!validTransports.includes(args.transportType)) {
4422
- console.error(`Error: Invalid transport type '${args.transportType}'`);
4423
- console.error(`Supported types: ${validTransports.join(", ")}`);
4424
- process7.exit(1);
4478
+ const mcpServers = {};
4479
+ const serverNames = [];
4480
+ const refs = [];
4481
+ for (const spec of args.mcpServers) {
4482
+ const serverName = extractServerName(spec.command, spec.args);
4483
+ mcpServers[serverName] = {
4484
+ command: spec.command,
4485
+ args: spec.args,
4486
+ transportType: spec.transportType
4487
+ };
4488
+ serverNames.push(serverName);
4489
+ refs.push(`<tool name="${serverName}.__ALL__"/>`);
4490
+ console.error(`Added MCP server: ${serverName}
4491
+ Transport: ${spec.transportType}
4492
+ Command: ${spec.command} ${spec.args.join(" ")}`);
4425
4493
  }
4426
- const command = args.proxyCommand[0];
4427
- const commandArgs = args.proxyCommand.slice(1);
4428
- const serverName = args.name || extractServerName(command, commandArgs);
4494
+ const agentName = args.name || `${serverNames.join("__")}--orchestrator`;
4429
4495
  const config2 = {
4430
- name: `${serverName}-proxy`,
4496
+ name: "mcpc-wrap-config",
4431
4497
  version: "0.1.0",
4432
4498
  capabilities: {
4433
4499
  tools: {},
@@ -4435,31 +4501,24 @@ function createProxyConfig(args) {
4435
4501
  },
4436
4502
  agents: [
4437
4503
  {
4438
- name: serverName,
4439
- description: `Orchestrate ${serverName} MCP server tools`,
4504
+ name: agentName,
4505
+ description: `Orchestrate ${serverNames.length === 1 ? serverNames[0] : serverNames.join(", ")} MCP server tools`,
4440
4506
  deps: {
4441
- mcpServers: {
4442
- [serverName]: {
4443
- command,
4444
- args: commandArgs,
4445
- transportType: args.transportType
4446
- }
4447
- }
4507
+ mcpServers
4448
4508
  },
4449
4509
  options: {
4450
4510
  mode: args.mode || "agentic",
4451
- refs: [
4452
- `<tool name="${serverName}.__ALL__"/>`
4453
- ]
4511
+ refs
4454
4512
  }
4455
4513
  }
4456
4514
  ]
4457
4515
  };
4458
- console.error(`Created proxy configuration for ${serverName}`);
4459
- console.error(`Transport: ${args.transportType}`);
4460
- console.error(`Command: ${command} ${commandArgs.join(" ")}`);
4461
- if (args.mode) {
4462
- console.error(`Mode: ${args.mode}`);
4516
+ const modeInfo = args.mode ? `
4517
+ Mode: ${args.mode}` : "";
4518
+ console.error(`
4519
+ Created wrap configuration for ${serverNames.length} MCP server(s)${modeInfo}`);
4520
+ if (args.saveConfig) {
4521
+ await saveUserConfig(config2);
4463
4522
  }
4464
4523
  return config2;
4465
4524
  }
@@ -4486,12 +4545,18 @@ OPTIONS:
4486
4545
  - agentic_sampling: Autonomous sampling mode for agentic execution
4487
4546
  - agentic_workflow_sampling: Autonomous sampling mode for workflow execution
4488
4547
  - code_execution: Code execution mode for most efficient token usage
4489
- --proxy Proxy mode: automatically configure MCPC to wrap an MCP server
4490
- Use with --transport-type to specify the transport
4491
- Example: --proxy --transport-type stdio -- npx -y @wonderwhy-er/desktop-commander
4492
- --transport-type <type> Transport type for proxy mode
4493
- Supported types: stdio, streamable-http, sse
4494
- --name <name> Custom server name for proxy mode (overrides auto-detection)
4548
+ --add Add MCP servers to ~/.mcpc/config.json and exit
4549
+ Then run 'mcpc' to start the server with saved config
4550
+ Use --mcp-stdio, --mcp-http, or --mcp-sse to specify servers
4551
+ --wrap Wrap and run MCP servers immediately without saving config
4552
+ Use --mcp-stdio, --mcp-http, or --mcp-sse to specify servers
4553
+ --mcp-stdio <cmd> Add an MCP server with stdio transport
4554
+ Example: --mcp-stdio "npx -y @wonderwhy-er/desktop-commander"
4555
+ --mcp-http <url> Add an MCP server with streamable-http transport
4556
+ Example: --mcp-http "https://api.github.com/mcp"
4557
+ --mcp-sse <url> Add an MCP server with SSE transport
4558
+ Example: --mcp-sse "https://api.example.com/sse"
4559
+ --name <name> Custom agent name for wrap mode (overrides auto-detection)
4495
4560
 
4496
4561
  ENVIRONMENT VARIABLES:
4497
4562
  MCPC_CONFIG Inline JSON configuration (same as --config)
@@ -4502,17 +4567,20 @@ EXAMPLES:
4502
4567
  # Show help
4503
4568
  mcpc --help
4504
4569
 
4505
- # Proxy mode - wrap an existing MCP server (stdio)
4506
- mcpc --proxy --transport-type stdio -- npx -y @wonderwhy-er/desktop-commander
4570
+ # Add MCP servers to config and save to ~/.mcpc/config.json
4571
+ mcpc --add --mcp-stdio "npx -y @wonderwhy-er/desktop-commander"
4572
+ # Edit ~/.mcpc/config.json if needed (add headers, etc.)
4573
+ mcpc # Loads config from ~/.mcpc/config.json automatically
4507
4574
 
4508
- # Proxy mode with custom server name
4509
- mcpc --proxy --transport-type stdio --name my-server -- npx shadcn@latest mcp
4575
+ # Wrap and run immediately (one-time use, no config saved)
4576
+ mcpc --wrap --mcp-stdio "npx -y @wonderwhy-er/desktop-commander"
4510
4577
 
4511
- # Proxy mode - wrap an MCP server (streamable-http)
4512
- mcpc --proxy --transport-type streamable-http -- https://api.example.com/mcp
4578
+ # Multiple servers with different transports
4579
+ mcpc --add --mcp-stdio "npx -y @wonderwhy-er/desktop-commander" --mcp-http "https://api.github.com/mcp" --mcp-sse "https://api.example.com/sse"
4513
4580
 
4514
- # Proxy mode - wrap an MCP server (sse)
4515
- mcpc --proxy --transport-type sse -- https://api.example.com/sse
4581
+ # Custom agent name
4582
+ mcpc --add --name my-agent --mcp-stdio "npx shadcn@latest mcp"
4583
+ mcpc --wrap --name my-agent --mcp-stdio "npx shadcn@latest mcp"
4516
4584
 
4517
4585
  # Load from URL
4518
4586
  mcpc --config-url \\
@@ -4576,17 +4644,35 @@ function parseArgs() {
4576
4644
  }
4577
4645
  } else if (arg === "--help" || arg === "-h") {
4578
4646
  result.help = true;
4579
- } else if (arg === "--proxy") {
4580
- result.proxy = true;
4581
- } else if (arg === "--transport-type" && i + 1 < args.length) {
4582
- result.transportType = args[++i];
4647
+ } else if (arg === "--add") {
4648
+ result.add = true;
4649
+ } else if (arg === "--wrap") {
4650
+ result.wrap = true;
4651
+ } else if ((arg === "--mcp-stdio" || arg === "--mcp-http" || arg === "--mcp-sse") && i + 1 < args.length) {
4652
+ const cmdString = args[++i];
4653
+ const cmdParts = cmdString.split(/\s+/);
4654
+ const command = cmdParts[0];
4655
+ const cmdArgs = cmdParts.slice(1);
4656
+ let transportType;
4657
+ if (arg === "--mcp-stdio") {
4658
+ transportType = "stdio";
4659
+ } else if (arg === "--mcp-http") {
4660
+ transportType = "streamable-http";
4661
+ } else {
4662
+ transportType = "sse";
4663
+ }
4664
+ if (!result.mcpServers) {
4665
+ result.mcpServers = [];
4666
+ }
4667
+ result.mcpServers.push({
4668
+ command,
4669
+ args: cmdArgs,
4670
+ transportType
4671
+ });
4583
4672
  } else if (arg === "--mode" && i + 1 < args.length) {
4584
4673
  result.mode = args[++i];
4585
4674
  } else if (arg === "--name" && i + 1 < args.length) {
4586
4675
  result.name = args[++i];
4587
- } else if (arg === "--") {
4588
- result.proxyCommand = args.slice(i + 1);
4589
- break;
4590
4676
  }
4591
4677
  }
4592
4678
  return result;
@@ -4597,8 +4683,18 @@ async function loadConfig() {
4597
4683
  printHelp();
4598
4684
  process7.exit(0);
4599
4685
  }
4600
- if (args.proxy) {
4601
- return createProxyConfig(args);
4686
+ if (args.add) {
4687
+ await createWrapConfig({
4688
+ ...args,
4689
+ saveConfig: true
4690
+ });
4691
+ process7.exit(0);
4692
+ }
4693
+ if (args.wrap) {
4694
+ return await createWrapConfig({
4695
+ ...args,
4696
+ saveConfig: false
4697
+ });
4602
4698
  }
4603
4699
  if (args.config) {
4604
4700
  try {
@@ -4655,6 +4751,17 @@ async function loadConfig() {
4655
4751
  }
4656
4752
  }
4657
4753
  }
4754
+ const userConfigPath = getUserConfigPath();
4755
+ try {
4756
+ const content = await readFile(userConfigPath, "utf-8");
4757
+ const parsed = JSON.parse(content);
4758
+ return applyModeOverride(normalizeConfig(parsed), args.mode);
4759
+ } catch (error) {
4760
+ if (error.code !== "ENOENT") {
4761
+ console.error(`Failed to load config from ${userConfigPath}:`, error);
4762
+ throw error;
4763
+ }
4764
+ }
4658
4765
  const defaultConfigPath = resolve2(process7.cwd(), "mcpc.config.json");
4659
4766
  try {
4660
4767
  const content = await readFile(defaultConfigPath, "utf-8");
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@mcpc-tech/cli",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "homepage": "https://jsr.io/@mcpc/cli",
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "@hono/zod-openapi": "^0.19.2",
8
- "@mcpc-tech/plugin-code-execution": "^0.0.5",
8
+ "@mcpc-tech/plugin-code-execution": "^0.0.6",
9
9
  "@modelcontextprotocol/sdk": "^1.8.0",
10
10
  "zod": "^3.24.2",
11
11
  "@mcpc-tech/ripgrep-napi": "^0.0.4",
@@ -19,7 +19,8 @@
19
19
  * 2. MCPC_CONFIG environment variable
20
20
  * 3. --config-url or MCPC_CONFIG_URL
21
21
  * 4. --config-file or MCPC_CONFIG_FILE
22
- * 5. ./mcpc.config.json (default)
22
+ * 5. ~/.mcpc/config.json (user config)
23
+ * 6. ./mcpc.config.json (local config)
23
24
  *
24
25
  * @example
25
26
  * ```bash
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sources":["../../../src/config/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CC,GAED,cAAc,iBAAiB,0BAAgC;AAK/D,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;;AAqRV;;;CAGC,GACD,OAAO,iBAAe,cAAc,QAAQ,aAAa,IAAI;AAqL7D;;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,iBAAiB,0BAAgC;AAM/D,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;;AAmYV;;;CAGC,GACD,OAAO,iBAAe,cAAc,QAAQ,aAAa,IAAI;AAyM7D;;CAEC,GACD,OAAO,iBAAS,eAAe,QAAQ,UAAU,GAAG,IAAI"}