Skip to content

Commit 4cf2131

Browse files
committed
feat(cli): bump @mcpc/core to 0.3.6 and overhaul CLI UX
- Upgraded @mcpc/core from 0.3.4 → 0.3.6 for latest fixes/features - Replaced legacy --proxy/--transport-type flags with intuitive --wrap/--add - Added --mcp-stdio/--mcp-http/--mcp-sse helpers for quick server wrapping - Streamlined README with new quick-start, persistent config, and one-shot usage - Default config now auto-loaded from ~/.mcpc/config.json
1 parent 13ecbdf commit 4cf2131

File tree

8 files changed

+532
-191
lines changed

8 files changed

+532
-191
lines changed

deno.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cli/README.md

Lines changed: 139 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,79 +5,108 @@
55

66
CLI server for MCPC with configuration support.
77

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.
109
1110
## Quick Start
1211

1312
```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
1615

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"
1919

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
2623

27-
Load configuration using command-line arguments:
24+
# Show help
25+
mcpc --help
26+
```
2827

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
3629

37-
## Usage
30+
The simplest way to use MCPC is to wrap existing MCP servers with custom
31+
execution modes:
3832

39-
**Show help:**
33+
### One-time Run (no config saved)
4034

4135
```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"
4344
```
4445

45-
**Inline JSON config:**
46+
### Persistent Config (save and reuse)
4647

4748
```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"
5051

51-
**From URL:**
52+
# Step 2: (Optional) Edit ~/.mcpc/config.json to add headers, env vars, etc.
5253

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
5556
```
5657

57-
**From URL with custom headers:**
58+
The config file lets you add custom headers, environment variables, and other
59+
settings:
5860

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+
}
6477
```
6578

66-
**From file:**
79+
## Configuration Files
80+
81+
Load config from different sources:
6782

6883
```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
7186

72-
**Default (uses ./mcpc.config.json):**
87+
# From a URL
88+
mcpc --config-url https://example.com/config.json
7389

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":"..."}]'
7696
```
7797

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
79108

80-
Config files support `$ENV_VAR_NAME` syntax:
109+
Use `$VAR_NAME` syntax in config files:
81110

82111
```json
83112
{
@@ -86,7 +115,7 @@ Config files support `$ENV_VAR_NAME` syntax:
86115
"mcpServers": {
87116
"github": {
88117
"headers": {
89-
"Authorization": "Bearer $GITHUB_PERSONAL_ACCESS_TOKEN"
118+
"Authorization": "Bearer $GITHUB_TOKEN"
90119
}
91120
}
92121
}
@@ -95,14 +124,78 @@ Config files support `$ENV_VAR_NAME` syntax:
95124
}
96125
```
97126

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.
99168

100169
```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"
102172
```
103173

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+
104194
## Examples
105195

196+
See the [examples directory](examples/) for complete working examples using the
197+
Codex Fork configuration.
198+
106199
### Required Environment Variables
107200

108201
When using the Codex Fork configuration:

packages/cli/deno.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mcpc/cli",
3-
"version": "0.1.16",
3+
"version": "0.1.17",
44
"repository": {
55
"type": "git",
66
"url": "git+https://github.com/mcpc-tech/mcpc.git"
@@ -13,7 +13,7 @@
1313
},
1414
"imports": {
1515
"@mcpc-tech/plugin-code-execution": "npm:@mcpc-tech/plugin-code-execution@^0.0.6",
16-
"@mcpc/core": "jsr:@mcpc/core@^0.3.4",
16+
"@mcpc/core": "jsr:@mcpc/core@^0.3.6",
1717
"@mcpc/utils": "jsr:@mcpc/utils@^0.2.2",
1818
"@modelcontextprotocol/sdk": "npm:@modelcontextprotocol/sdk@^1.8.0",
1919
"@mcpc-tech/ripgrep-napi": "npm:@mcpc-tech/ripgrep-napi@^0.0.4",

0 commit comments

Comments
 (0)