@agiflowai/one-mcp 0.2.2 → 0.2.4

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
@@ -1,95 +1,59 @@
1
1
  # @agiflowai/one-mcp
2
2
 
3
- A unified MCP (Model Context Protocol) proxy server that enables **progressive tool discovery** to dramatically reduce token usage when working with multiple MCP servers.
3
+ > MCP proxy server for progressive tool discovery and reduced token usage
4
4
 
5
- ## The Problem: MCP Token Bloat
5
+ Connect to multiple MCP servers through a single proxy that loads tools on-demand, reducing initial token usage by 90%+.
6
6
 
7
- When connecting to multiple MCP servers directly, AI agents must load ALL tools from ALL servers into their context window at startup. This creates massive token overhead:
7
+ ## The Problem
8
+
9
+ When connecting to multiple MCP servers directly, AI agents load ALL tools from ALL servers at startup:
8
10
 
9
- **Example: 10 MCP Servers**
10
11
  ```
11
- Server 1: 20 tools × 200 tokens = 4,000 tokens
12
- Server 2: 15 tools × 200 tokens = 3,000 tokens
13
- Server 3: 30 tools × 200 tokens = 6,000 tokens
14
- ...
15
- Total: ~40,000+ tokens consumed BEFORE you even start coding
12
+ 10 MCP Servers:
13
+ Server 1: 20 tools × 200 tokens = 4,000 tokens
14
+ Server 2: 15 tools × 200 tokens = 3,000 tokens
15
+ Server 3: 30 tools × 200 tokens = 6,000 tokens
16
+ ...
17
+ Total: ~40,000+ tokens consumed BEFORE you even start coding
16
18
  ```
17
19
 
18
- This consumes a significant portion of your context window with tool descriptions you may never use in that session.
19
-
20
- ## The Solution: Progressive Discovery
21
-
22
- one-mcp acts as a **smart proxy** that only loads tool descriptions when needed:
23
-
24
- 1. **Initial Connection**: Agent sees only 2 meta-tools (`describe_tools` and `use_tool`)
25
- - Token cost: ~400 tokens (vs 40,000+ tokens)
20
+ This wastes context window on tool descriptions you may never use.
26
21
 
27
- 2. **Discovery on Demand**: Agent calls `describe_tools` only for servers/tools it needs
28
- - Example: `describe_tools(["filesystem"])` loads only filesystem server tools
29
- - Token cost: ~4,000 tokens (only what you need, when you need it)
30
-
31
- 3. **Tool Execution**: Agent calls `use_tool` to execute tools through the proxy
32
- - one-mcp routes the call to the correct server
33
- - No token overhead - just execution
34
-
35
- **Result: 90%+ reduction in initial token usage**
22
+ ## The Solution
36
23
 
37
- ## How It Works
24
+ one-mcp acts as a smart proxy with progressive discovery:
38
25
 
39
26
  ```
40
- Traditional Approach (High Token Cost):
41
- ┌─────────────────┐
42
- │ AI Agent │ ← Loads ALL tools from ALL servers (40,000+ tokens)
43
- ├─────────────────┤
44
- MCP Server 1 20 tools
45
- MCP Server 2 15 tools
46
- MCP Server 3 30 tools
47
- │ ... │
48
- └─────────────────┘
49
-
50
- Progressive Discovery (Low Token Cost):
51
- ┌─────────────────┐
52
- │ AI Agent │ ← Loads only 2 meta-tools (400 tokens)
53
- ├─────────────────┤
54
- │ one-mcp │ ← Proxies to servers on-demand
55
- │ (2 tools) │
56
- └────────┬────────┘
57
- │ Connects to servers as needed
58
- ┌────┴─────┬──────────┬─────────┐
59
- │ Server 1 │ Server 2 │ Server 3│
60
- └──────────┴──────────┴─────────┘
27
+ Traditional (High Token Cost): Progressive Discovery (Low Token Cost):
28
+ ┌─────────────────┐ ┌─────────────────┐
29
+ │ AI Agent │ ← 40,000+ tokens │ AI Agent │ ← 400 tokens
30
+ ├─────────────────┤ ├─────────────────┤
31
+ │ Server 1 (20) │ one-mcp │ 2 meta-tools
32
+ │ Server 2 (15) │ │ (proxy) │
33
+ │ Server 3 (30) │ └────────┬────────┘
34
+ │ ... │ │ loads on-demand
35
+ └─────────────────┘ ┌────┴────┬────────┐
36
+ │ Srv 1 │ Srv 2 │ ...
37
+ └─────────┴────────┘
61
38
  ```
62
39
 
63
- ## Key Benefits
64
-
65
- - **Massive Token Savings** - 90%+ reduction in initial context usage
66
- - **Faster Startup** - Agent ready in milliseconds, not seconds
67
- - **Scale Infinitely** - Add 100+ MCP servers without bloating context
68
- - **Pay-as-you-go** - Only load tools when actually needed
69
- - **Better Context Budget** - Save tokens for actual code and conversation
70
- - **Centralized Config** - Manage all servers from one YAML/JSON file
40
+ 1. **Initial**: Agent sees only 2 meta-tools (`describe_tools`, `use_tool`) - ~400 tokens
41
+ 2. **Discovery**: Agent calls `describe_tools` for specific servers when needed
42
+ 3. **Execution**: Agent calls `use_tool` to run tools through the proxy
71
43
 
72
- ## Installation
44
+ **Result: 90%+ reduction in initial token usage**
73
45
 
74
- ```bash
75
- npm install -g @agiflowai/one-mcp
76
- # or
77
- pnpm add -g @agiflowai/one-mcp
78
- # or
79
- yarn global add @agiflowai/one-mcp
80
- ```
46
+ ---
81
47
 
82
48
  ## Quick Start
83
49
 
84
- ### 1. Initialize Configuration
85
-
86
- Create an MCP configuration file:
50
+ ### 1. Create Configuration
87
51
 
88
52
  ```bash
89
53
  npx @agiflowai/one-mcp init
90
54
  ```
91
55
 
92
- This creates a `mcp-config.yaml` file with example servers:
56
+ This creates `mcp-config.yaml`:
93
57
 
94
58
  ```yaml
95
59
  mcpServers:
@@ -102,20 +66,19 @@ mcpServers:
102
66
  config:
103
67
  instruction: "Access files in the Documents folder"
104
68
 
105
- web-search:
106
- url: https://example.com/mcp/search
107
- type: sse
108
- headers:
109
- Authorization: "Bearer ${API_KEY}"
69
+ scaffold-mcp:
70
+ command: npx
71
+ args:
72
+ - -y
73
+ - "@agiflowai/scaffold-mcp"
74
+ - "mcp-serve"
110
75
  config:
111
- instruction: "Search the web for information"
76
+ instruction: "Scaffold projects and features"
112
77
  ```
113
78
 
114
79
  ### 2. Configure Your Agent
115
80
 
116
- Add one-mcp to your AI coding tool's MCP configuration:
117
-
118
- **For Claude Code:**
81
+ Add to your MCP config (`.mcp.json`, `.cursor/mcp.json`, etc.):
119
82
 
120
83
  ```json
121
84
  {
@@ -128,33 +91,20 @@ Add one-mcp to your AI coding tool's MCP configuration:
128
91
  }
129
92
  ```
130
93
 
131
- **For Cursor:**
94
+ ### 3. Start Using
132
95
 
133
- ```json
134
- {
135
- "mcpServers": {
136
- "one-mcp": {
137
- "command": "npx",
138
- "args": ["-y", "@agiflowai/one-mcp", "mcp-serve", "--config", "./mcp-config.yaml"]
139
- }
140
- }
141
- }
142
- ```
143
-
144
- ### 3. Start Using Tools
96
+ Your agent now has access to all tools from all configured servers through one connection.
145
97
 
146
- Your agent now has access to all tools from all configured servers through the single one-mcp connection!
98
+ ---
147
99
 
148
100
  ## Configuration
149
101
 
150
- ### Config File Format
151
-
152
- one-mcp supports the standard Claude Code MCP configuration format:
102
+ ### Server Types
153
103
 
154
104
  ```yaml
155
105
  mcpServers:
156
106
  # Stdio server (local command)
157
- server-name:
107
+ local-server:
158
108
  command: npx
159
109
  args:
160
110
  - -y
@@ -162,11 +112,7 @@ mcpServers:
162
112
  env:
163
113
  API_KEY: "${MY_API_KEY}"
164
114
  config:
165
- instruction: "Custom instruction for this server"
166
- # Optional: Block specific tools from being listed or executed
167
- toolBlacklist:
168
- - dangerous_tool
169
- - another_blocked_tool
115
+ instruction: "Description for the AI agent"
170
116
 
171
117
  # HTTP/SSE server (remote)
172
118
  remote-server:
@@ -175,20 +121,18 @@ mcpServers:
175
121
  headers:
176
122
  Authorization: "Bearer ${TOKEN}"
177
123
  config:
178
- instruction: "Remote server instruction"
179
- toolBlacklist:
180
- - risky_operation
124
+ instruction: "Remote server description"
181
125
 
182
- # Disabled server (will be skipped)
126
+ # Disabled server (skipped)
183
127
  disabled-server:
184
128
  command: node
185
129
  args: ["server.js"]
186
130
  disabled: true
187
131
  ```
188
132
 
189
- ### Environment Variable Interpolation
133
+ ### Environment Variables
190
134
 
191
- Use `${VAR_NAME}` syntax to interpolate environment variables:
135
+ Use `${VAR_NAME}` syntax:
192
136
 
193
137
  ```yaml
194
138
  mcpServers:
@@ -196,197 +140,142 @@ mcpServers:
196
140
  command: npx
197
141
  args:
198
142
  - "@mycompany/mcp-server"
199
- - "${HOME}/data" # Expands to /Users/username/data
143
+ - "${HOME}/data" # Expands to /Users/username/data
200
144
  env:
201
- API_KEY: "${MY_API_KEY}" # Reads from environment
145
+ API_KEY: "${MY_API_KEY}" # Reads from environment
202
146
  ```
203
147
 
204
148
  ### Tool Blacklisting
205
149
 
206
- Control which tools from an MCP server are accessible by using the `toolBlacklist` configuration. Blacklisted tools will:
207
- - Not appear in `list-tools` output
208
- - Not be shown in `describe_tools` responses
209
- - Raise an error if attempted to be executed via `use_tool`
210
-
211
- This is useful for:
212
- - **Security**: Block dangerous operations (e.g., `write_file`, `delete_file`)
213
- - **Compliance**: Restrict tools that don't meet your policies
214
- - **Simplification**: Hide tools you don't want agents to use
215
-
216
- **Example:**
150
+ Block specific tools from being listed or executed:
217
151
 
218
152
  ```yaml
219
153
  mcpServers:
220
154
  filesystem:
221
155
  command: npx
222
- args:
223
- - -y
224
- - "@modelcontextprotocol/server-filesystem"
225
- - "/workspace"
156
+ args: ["-y", "@modelcontextprotocol/server-filesystem", "/workspace"]
226
157
  config:
227
158
  instruction: "File system access (read-only)"
228
159
  toolBlacklist:
229
160
  - write_file
230
161
  - create_directory
231
- - move_file
162
+ - delete_file
232
163
  ```
233
164
 
234
- **Behavior:**
235
- - Agents will only see read-only tools like `read_file`, `list_directory`
236
- - Attempting to call `write_file` will return an error: `Tool "write_file" is blacklisted on server "filesystem" and cannot be executed.`
165
+ Blacklisted tools:
166
+ - Won't appear in tool listings
167
+ - Return an error if called
237
168
 
238
- ### Tool Description Formatting
169
+ ### Compact Tool Descriptions
239
170
 
240
- Control how tool information is displayed by using the `omitToolDescription` configuration flag. This helps reduce token usage when full descriptions aren't needed.
241
-
242
- **Default behavior (omitToolDescription: false or not set):**
243
- ```
244
- server-name:
245
- - tool_name1: Full description of what this tool does...
246
- - tool_name2: Another detailed description...
247
- ```
248
-
249
- **Compact mode (omitToolDescription: true):**
250
- ```
251
- server-name:
252
- tool_name1, tool_name2, tool_name3
253
- ```
254
-
255
- **Example:**
171
+ Reduce token usage by omitting verbose descriptions:
256
172
 
257
173
  ```yaml
258
174
  mcpServers:
259
175
  filesystem:
260
176
  command: npx
261
- args:
262
- - -y
263
- - "@modelcontextprotocol/server-filesystem"
264
- - "/workspace"
177
+ args: ["-y", "@modelcontextprotocol/server-filesystem", "/workspace"]
265
178
  config:
266
- instruction: "File system access"
267
- omitToolDescription: true # Show only tool names, not descriptions
179
+ omitToolDescription: true # Show only tool names
268
180
  ```
269
181
 
270
- **Benefits:**
271
- - **Reduced Token Usage**: Save context window space by omitting verbose descriptions
272
- - **Faster Discovery**: Quickly scan available tool names without reading full descriptions
273
- - **Cleaner Output**: More compact tool listings for familiar servers
274
-
275
- **When to use:**
276
- - You're already familiar with the server's tools
277
- - Working with servers that have many tools with long descriptions
278
- - Trying to conserve context window tokens
279
- - Need a quick overview of available tool names
280
-
281
- ## CLI Commands
282
-
283
- ### `mcp-serve`
284
-
285
- Start the MCP server:
286
-
287
- ```bash
288
- npx @agiflowai/one-mcp mcp-serve [options]
289
-
290
- Options:
291
- -c, --config <path> Path to local config file (YAML or JSON)
292
- --no-cache Force reload configuration from source, bypassing cache
293
- -t, --type <type> Transport mode: stdio (default), http, sse
294
- -p, --port <number> Port for HTTP/SSE transport (default: 3000)
295
- --host <host> Host to bind to (HTTP/SSE only, default: localhost)
182
+ **Default output:**
296
183
  ```
297
-
298
- ### `init`
299
-
300
- Initialize an MCP configuration file:
301
-
302
- ```bash
303
- npx @agiflowai/one-mcp init [options]
304
-
305
- Options:
306
- -o, --output <path> Output file path (default: mcp-config.yaml)
307
- --json Generate JSON config instead of YAML
308
- -f, --force Overwrite existing config file
184
+ filesystem:
185
+ - read_file: Read contents of a file at the specified path...
186
+ - list_directory: List all files and directories...
309
187
  ```
310
188
 
311
- ### `list-tools`
312
-
313
- List all available tools from configured servers:
314
-
315
- ```bash
316
- npx @agiflowai/one-mcp list-tools --config ./mcp-config.yaml
189
+ **With omitToolDescription:**
317
190
  ```
318
-
319
- ### `describe-tools`
320
-
321
- Get detailed information about specific tools:
322
-
323
- ```bash
324
- npx @agiflowai/one-mcp describe-tools \
325
- --config ./mcp-config.yaml \
326
- --tools tool1,tool2
191
+ filesystem:
192
+ read_file, list_directory, search_files
327
193
  ```
328
194
 
329
- ### `use-tool`
330
-
331
- Execute a tool directly from CLI:
332
-
333
- ```bash
334
- npx @agiflowai/one-mcp use-tool \
335
- --config ./mcp-config.yaml \
336
- --tool-name read_file \
337
- --args '{"path": "/path/to/file"}'
338
- ```
195
+ ---
339
196
 
340
197
  ## MCP Tools
341
198
 
342
- When running as an MCP server, one-mcp provides these tools:
199
+ When running as an MCP server, one-mcp provides:
343
200
 
344
- ### `mcp__one-mcp__describe_tools`
201
+ ### `describe_tools`
345
202
 
346
- Get detailed information about available tools from connected servers.
203
+ Get information about available tools:
347
204
 
348
- **Input:**
349
205
  ```json
350
206
  {
351
- "toolNames": ["tool1", "tool2"],
352
- "serverName": "optional-server-name"
207
+ "toolNames": ["read_file", "write_file"],
208
+ "serverName": "filesystem" // optional
353
209
  }
354
210
  ```
355
211
 
356
- ### `mcp__one-mcp__use_tool`
212
+ ### `use_tool`
357
213
 
358
- Execute a tool from any connected server.
214
+ Execute a tool from any connected server:
359
215
 
360
- **Input:**
361
216
  ```json
362
217
  {
363
218
  "toolName": "read_file",
364
219
  "toolArgs": {
365
220
  "path": "/path/to/file"
366
221
  },
367
- "serverName": "optional-server-name"
222
+ "serverName": "filesystem" // optional, auto-detected if unique
368
223
  }
369
224
  ```
370
225
 
371
- ## Use Cases
226
+ ---
227
+
228
+ ## CLI Commands
229
+
230
+ ```bash
231
+ # Start MCP server (stdio, for Claude Code/Cursor)
232
+ npx @agiflowai/one-mcp mcp-serve --config ./mcp-config.yaml
372
233
 
373
- ### 1. Simplify Multi-Server Setup
234
+ # Start with HTTP transport
235
+ npx @agiflowai/one-mcp mcp-serve --config ./mcp-config.yaml --type http --port 3000
374
236
 
375
- Instead of configuring 10+ MCP servers individually in your agent:
237
+ # Initialize config file
238
+ npx @agiflowai/one-mcp init --output mcp-config.yaml
376
239
 
377
- **Before:**
240
+ # List all tools from configured servers
241
+ npx @agiflowai/one-mcp list-tools --config ./mcp-config.yaml
242
+
243
+ # Get tool details
244
+ npx @agiflowai/one-mcp describe-tools --config ./mcp-config.yaml --tools read_file,write_file
245
+
246
+ # Execute a tool directly
247
+ npx @agiflowai/one-mcp use-tool --config ./mcp-config.yaml --tool-name read_file --args '{"path": "/tmp/test.txt"}'
248
+ ```
249
+
250
+ ### Server Options
251
+
252
+ | Option | Description | Default |
253
+ |--------|-------------|---------|
254
+ | `-c, --config` | Path to config file (YAML or JSON) | Required |
255
+ | `-t, --type` | Transport: `stdio`, `http`, `sse` | `stdio` |
256
+ | `-p, --port` | Port for HTTP/SSE | `3000` |
257
+ | `--host` | Host for HTTP/SSE | `localhost` |
258
+ | `--no-cache` | Force reload config, bypass cache | `false` |
259
+
260
+ ---
261
+
262
+ ## Use Cases
263
+
264
+ ### 1. Consolidate Multiple Servers
265
+
266
+ **Before (10 server configs):**
378
267
  ```json
379
268
  {
380
269
  "mcpServers": {
381
270
  "filesystem": { "command": "npx", "args": ["..."] },
382
271
  "database": { "command": "npx", "args": ["..."] },
383
- "web-search": { "command": "npx", "args": ["..."] },
384
- // ... 7 more servers
272
+ "web-search": { "command": "npx", "args": ["..."] }
273
+ // ... 7 more
385
274
  }
386
275
  }
387
276
  ```
388
277
 
389
- **After:**
278
+ **After (1 config):**
390
279
  ```json
391
280
  {
392
281
  "mcpServers": {
@@ -398,15 +287,7 @@ Instead of configuring 10+ MCP servers individually in your agent:
398
287
  }
399
288
  ```
400
289
 
401
- ### 2. Centralized Configuration Management
402
-
403
- Manage all MCP servers from a single YAML/JSON file that can be:
404
- - Version controlled
405
- - Shared across teams
406
- - Hosted remotely
407
- - Environment-specific
408
-
409
- ### 3. Mix Local and Remote Servers
290
+ ### 2. Mix Local and Remote Servers
410
291
 
411
292
  ```yaml
412
293
  mcpServers:
@@ -423,9 +304,7 @@ mcpServers:
423
304
  Authorization: "Bearer ${COMPANY_TOKEN}"
424
305
  ```
425
306
 
426
- ### 4. Dynamic Configuration
427
-
428
- Load different configs based on environment:
307
+ ### 3. Environment-Specific Configs
429
308
 
430
309
  ```bash
431
310
  # Development
@@ -435,21 +314,7 @@ npx @agiflowai/one-mcp mcp-serve --config ./mcp-dev.yaml
435
314
  npx @agiflowai/one-mcp mcp-serve --config ./mcp-prod.yaml
436
315
  ```
437
316
 
438
- ## Development
439
-
440
- ```bash
441
- # Install dependencies
442
- pnpm install
443
-
444
- # Build
445
- pnpm build
446
-
447
- # Run tests
448
- pnpm test
449
-
450
- # Run in development mode
451
- pnpm dev
452
- ```
317
+ ---
453
318
 
454
319
  ## Architecture
455
320
 
@@ -458,27 +323,17 @@ pnpm dev
458
323
  │ AI Agent │
459
324
  │ (Claude/etc) │
460
325
  └────────┬────────┘
461
- │ Single MCP Connection
326
+ │ Single MCP Connection (2 tools)
462
327
 
463
328
  ┌────────▼────────────────────────────┐
464
- │ │
465
329
  │ @agiflowai/one-mcp │
466
330
  │ │
467
- ┌─────────────────────────────┐
468
- │ │ ConfigFetcherService │ │
469
- │ - Load YAML/JSON configs
470
- │ - Merge strategies
471
- │ - Environment interpolation
472
- │ └─────────────────────────────┘ │
473
- │ │
474
- │ ┌─────────────────────────────┐ │
475
- │ │ McpClientManagerService │ │
476
- │ │ - Connect to MCP servers │ │
477
- │ │ - Manage connections │ │
478
- │ │ - Route tool calls │ │
479
- │ └─────────────────────────────┘ │
480
- │ │
481
- └──────┬──────┬───────┬──────────────┘
331
+ • Load configs (YAML/JSON)
332
+ • Environment interpolation
333
+ Connect to servers on-demand
334
+ Route tool calls
335
+ Apply blacklists
336
+ └──────┬──────┬───────┬───────────────┘
482
337
  │ │ │
483
338
  │ │ │ Multiple MCP Connections
484
339
  │ │ │
@@ -489,12 +344,16 @@ pnpm dev
489
344
  └──────┘ └──────┘ └──────────┘
490
345
  ```
491
346
 
492
- ## License
493
-
494
- AGPL-3.0 © AgiflowIO
347
+ ---
495
348
 
496
349
  ## Related Packages
497
350
 
498
- - [@agiflowai/scaffold-mcp](../scaffold-mcp) - Scaffolding and templates
499
- - [@agiflowai/architect-mcp](../architect-mcp) - Architecture patterns and code review
500
- - [@agiflowai/aicode-toolkit](../../apps/aicode-toolkit) - Unified CLI toolkit
351
+ - [@agiflowai/scaffold-mcp](../scaffold-mcp) - Code scaffolding and templates
352
+ - [@agiflowai/architect-mcp](../architect-mcp) - Design patterns and code review
353
+ - [@agiflowai/aicode-toolkit](../../apps/aicode-toolkit) - Unified CLI toolkit
354
+
355
+ ---
356
+
357
+ ## License
358
+
359
+ AGPL-3.0 © AgiflowIO
package/dist/cli.cjs CHANGED
@@ -4,6 +4,7 @@ let node_fs_promises = require("node:fs/promises");
4
4
  let node_path = require("node:path");
5
5
  let commander = require("commander");
6
6
  let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
7
+ let liquidjs = require("liquidjs");
7
8
 
8
9
  //#region src/types/index.ts
9
10
  /**
@@ -398,12 +399,12 @@ const useToolCommand = new commander.Command("use-tool").description("Execute an
398
399
  });
399
400
 
400
401
  //#endregion
401
- //#region src/templates/mcp-config.yaml?raw
402
- var mcp_config_default = "# MCP Server Configuration\n# This file configures the MCP servers that one-mcp will connect to\n#\n# Environment Variable Interpolation:\n# Use ${VAR_NAME} syntax to reference environment variables\n# Example: ${HOME}, ${API_KEY}, ${DATABASE_URL}\n#\n# Instructions:\n# - config.instruction: Server's default instruction (from server documentation)\n# - instruction: User override (optional, takes precedence over config.instruction)\n# - config.toolBlacklist: Array of tool names to hide/block from this server\n# - config.omitToolDescription: Boolean to show only tool names without descriptions (saves tokens)\n\n# Remote Configuration Sources (OPTIONAL)\n# Fetch and merge configurations from remote URLs\n# Remote configs are merged with local configs based on merge strategy\n#\n# SECURITY: SSRF Protection is ENABLED by default\n# - Only HTTPS URLs are allowed (set security.enforceHttps: false to allow HTTP)\n# - Private IPs and localhost are blocked (set security.allowPrivateIPs: true for internal networks)\n# - Blocked ranges: 127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16\nremoteConfigs:\n # Example 1: Basic remote config with default security\n # - url: ${AGIFLOW_URL}/api/v1/mcp-configs\n # headers:\n # Authorization: Bearer ${AGIFLOW_API_KEY}\n # mergeStrategy: local-priority # Options: local-priority (default), remote-priority, merge-deep\n #\n # Example 2: Remote config with custom security settings (for internal networks)\n # - url: ${INTERNAL_URL}/mcp-configs\n # headers:\n # Authorization: Bearer ${INTERNAL_TOKEN}\n # security:\n # allowPrivateIPs: true # Allow internal IPs (default: false)\n # enforceHttps: false # Allow HTTP (default: true, HTTPS only)\n # mergeStrategy: local-priority\n #\n # Example 3: Remote config with additional validation (OPTIONAL)\n # - url: ${AGIFLOW_URL}/api/v1/mcp-configs\n # headers:\n # Authorization: Bearer ${AGIFLOW_API_KEY}\n # X-API-Key: ${AGIFLOW_API_KEY}\n # security:\n # enforceHttps: true # Require HTTPS (default: true)\n # allowPrivateIPs: false # Block private IPs (default: false)\n # validation: # OPTIONAL: Additional regex validation on top of security checks\n # url: ^https://.*\\.agiflow\\.io/.* # OPTIONAL: Regex pattern to validate URL format\n # headers: # OPTIONAL: Regex patterns to validate header values\n # Authorization: ^Bearer [A-Za-z0-9_-]+$\n # X-API-Key: ^[A-Za-z0-9_-]{32,}$\n # mergeStrategy: local-priority\n\nmcpServers:\n # Example MCP server using stdio transport\n example-server:\n command: node\n args:\n - /path/to/mcp-server/build/index.js\n env:\n # Environment variables for the MCP server\n LOG_LEVEL: info\n # You can use environment variable interpolation:\n # DATABASE_URL: ${DATABASE_URL}\n # API_KEY: ${MY_API_KEY}\n config:\n # Server's default instruction (from server documentation)\n instruction: Use this server for...\n # Optional: Block specific tools from being listed or executed\n # toolBlacklist:\n # - dangerous_tool_name\n # - another_blocked_tool\n # Optional: Omit tool descriptions to save tokens (default: false)\n # omitToolDescription: true\n # instruction: Optional user override - takes precedence over config.instruction\n\n # Example MCP server using SSE transport with environment variables\n # remote-server:\n # url: https://example.com/mcp\n # type: sse\n # headers:\n # # Use ${VAR_NAME} to interpolate environment variables\n # Authorization: Bearer ${API_KEY}\n # config:\n # instruction: This server provides tools for...\n # # Optional: Block specific tools from being listed or executed\n # # toolBlacklist:\n # # - tool_to_block\n # # Optional: Omit tool descriptions to save tokens (default: false)\n # # omitToolDescription: true\n # # instruction: Optional user override\n";
402
+ //#region src/templates/mcp-config.yaml.liquid?raw
403
+ var mcp_config_yaml_default = "# MCP Server Configuration\n# This file configures the MCP servers that one-mcp will connect to\n#\n# Environment Variable Interpolation:\n# Use ${VAR_NAME} syntax to reference environment variables\n# Example: ${HOME}, ${API_KEY}, ${DATABASE_URL}\n#\n# Instructions:\n# - config.instruction: Server's default instruction (from server documentation)\n# - instruction: User override (optional, takes precedence over config.instruction)\n# - config.toolBlacklist: Array of tool names to hide/block from this server\n# - config.omitToolDescription: Boolean to show only tool names without descriptions (saves tokens)\n\n# Remote Configuration Sources (OPTIONAL)\n# Fetch and merge configurations from remote URLs\n# Remote configs are merged with local configs based on merge strategy\n#\n# SECURITY: SSRF Protection is ENABLED by default\n# - Only HTTPS URLs are allowed (set security.enforceHttps: false to allow HTTP)\n# - Private IPs and localhost are blocked (set security.allowPrivateIPs: true for internal networks)\n# - Blocked ranges: 127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16\nremoteConfigs:\n # Example 1: Basic remote config with default security\n # - url: ${AGIFLOW_URL}/api/v1/mcp-configs\n # headers:\n # Authorization: Bearer ${AGIFLOW_API_KEY}\n # mergeStrategy: local-priority # Options: local-priority (default), remote-priority, merge-deep\n #\n # Example 2: Remote config with custom security settings (for internal networks)\n # - url: ${INTERNAL_URL}/mcp-configs\n # headers:\n # Authorization: Bearer ${INTERNAL_TOKEN}\n # security:\n # allowPrivateIPs: true # Allow internal IPs (default: false)\n # enforceHttps: false # Allow HTTP (default: true, HTTPS only)\n # mergeStrategy: local-priority\n #\n # Example 3: Remote config with additional validation (OPTIONAL)\n # - url: ${AGIFLOW_URL}/api/v1/mcp-configs\n # headers:\n # Authorization: Bearer ${AGIFLOW_API_KEY}\n # X-API-Key: ${AGIFLOW_API_KEY}\n # security:\n # enforceHttps: true # Require HTTPS (default: true)\n # allowPrivateIPs: false # Block private IPs (default: false)\n # validation: # OPTIONAL: Additional regex validation on top of security checks\n # url: ^https://.*\\.agiflow\\.io/.* # OPTIONAL: Regex pattern to validate URL format\n # headers: # OPTIONAL: Regex patterns to validate header values\n # Authorization: ^Bearer [A-Za-z0-9_-]+$\n # X-API-Key: ^[A-Za-z0-9_-]{32,}$\n # mergeStrategy: local-priority\n\nmcpServers:\n{%- if mcpServers %}{% for server in mcpServers %}\n {{ server.name }}:\n command: {{ server.command }}\n args:{% for arg in server.args %}\n - '{{ arg }}'{% endfor %}\n # env:\n # LOG_LEVEL: info\n # # API_KEY: ${MY_API_KEY}\n # config:\n # instruction: Use this server for...\n # # toolBlacklist:\n # # - tool_to_block\n # # omitToolDescription: true\n{% endfor %}\n # Example MCP server using SSE transport\n # remote-server:\n # url: https://example.com/mcp\n # type: sse\n # headers:\n # Authorization: Bearer ${API_KEY}\n # config:\n # instruction: This server provides tools for...\n{% else %}\n # Example MCP server using stdio transport\n example-server:\n command: node\n args:\n - /path/to/mcp-server/build/index.js\n env:\n # Environment variables for the MCP server\n LOG_LEVEL: info\n # You can use environment variable interpolation:\n # DATABASE_URL: ${DATABASE_URL}\n # API_KEY: ${MY_API_KEY}\n config:\n # Server's default instruction (from server documentation)\n instruction: Use this server for...\n # Optional: Block specific tools from being listed or executed\n # toolBlacklist:\n # - dangerous_tool_name\n # - another_blocked_tool\n # Optional: Omit tool descriptions to save tokens (default: false)\n # omitToolDescription: true\n # instruction: Optional user override - takes precedence over config.instruction\n\n # Example MCP server using SSE transport with environment variables\n # remote-server:\n # url: https://example.com/mcp\n # type: sse\n # headers:\n # # Use ${VAR_NAME} to interpolate environment variables\n # Authorization: Bearer ${API_KEY}\n # config:\n # instruction: This server provides tools for...\n # # Optional: Block specific tools from being listed or executed\n # # toolBlacklist:\n # # - tool_to_block\n # # Optional: Omit tool descriptions to save tokens (default: false)\n # # omitToolDescription: true\n # # instruction: Optional user override\n{% endif %}\n";
403
404
 
404
405
  //#endregion
405
406
  //#region src/templates/mcp-config.json?raw
406
- var mcp_config_default$1 = "{\n \"_comment\": \"MCP Server Configuration - Use ${VAR_NAME} syntax for environment variable interpolation\",\n \"_instructions\": \"config.instruction: Server's default instruction | instruction: User override (takes precedence)\",\n \"mcpServers\": {\n \"example-server\": {\n \"command\": \"node\",\n \"args\": [\n \"/path/to/mcp-server/build/index.js\"\n ],\n \"env\": {\n \"LOG_LEVEL\": \"info\",\n \"_comment\": \"You can use environment variable interpolation:\",\n \"_example_DATABASE_URL\": \"${DATABASE_URL}\",\n \"_example_API_KEY\": \"${MY_API_KEY}\"\n },\n \"config\": {\n \"instruction\": \"Use this server for...\"\n },\n \"_instruction_override\": \"Optional user override - takes precedence over config.instruction\"\n }\n }\n}\n";
407
+ var mcp_config_default = "{\n \"_comment\": \"MCP Server Configuration - Use ${VAR_NAME} syntax for environment variable interpolation\",\n \"_instructions\": \"config.instruction: Server's default instruction | instruction: User override (takes precedence)\",\n \"mcpServers\": {\n \"example-server\": {\n \"command\": \"node\",\n \"args\": [\n \"/path/to/mcp-server/build/index.js\"\n ],\n \"env\": {\n \"LOG_LEVEL\": \"info\",\n \"_comment\": \"You can use environment variable interpolation:\",\n \"_example_DATABASE_URL\": \"${DATABASE_URL}\",\n \"_example_API_KEY\": \"${MY_API_KEY}\"\n },\n \"config\": {\n \"instruction\": \"Use this server for...\"\n },\n \"_instruction_override\": \"Optional user override - takes precedence over config.instruction\"\n }\n }\n}\n";
407
408
 
408
409
  //#endregion
409
410
  //#region src/commands/init.ts
@@ -431,12 +432,29 @@ var mcp_config_default$1 = "{\n \"_comment\": \"MCP Server Configuration - Use
431
432
  /**
432
433
  * Initialize MCP configuration file
433
434
  */
434
- const initCommand = new commander.Command("init").description("Initialize MCP configuration file").option("-o, --output <path>", "Output file path", "mcp-config.yaml").option("--json", "Generate JSON config instead of YAML", false).option("-f, --force", "Overwrite existing config file", false).action(async (options) => {
435
+ const initCommand = new commander.Command("init").description("Initialize MCP configuration file").option("-o, --output <path>", "Output file path", "mcp-config.yaml").option("--json", "Generate JSON config instead of YAML", false).option("-f, --force", "Overwrite existing config file", false).option("--mcp-servers <json>", "JSON string of MCP servers to add to config (optional)").action(async (options) => {
435
436
  try {
436
437
  const outputPath = (0, node_path.resolve)(options.output);
437
- const template = !options.json && (outputPath.endsWith(".yaml") || outputPath.endsWith(".yml")) ? mcp_config_default : mcp_config_default$1;
438
+ const isYaml = !options.json && (outputPath.endsWith(".yaml") || outputPath.endsWith(".yml"));
439
+ let content;
440
+ if (isYaml) {
441
+ const liquid = new liquidjs.Liquid();
442
+ let mcpServersData = null;
443
+ if (options.mcpServers) try {
444
+ const serversObj = JSON.parse(options.mcpServers);
445
+ mcpServersData = Object.entries(serversObj).map(([name, config]) => ({
446
+ name,
447
+ command: config.command,
448
+ args: config.args
449
+ }));
450
+ } catch (parseError) {
451
+ __agiflowai_aicode_utils.log.error("Failed to parse --mcp-servers JSON:", parseError instanceof Error ? parseError.message : String(parseError));
452
+ process.exit(1);
453
+ }
454
+ content = await liquid.parseAndRender(mcp_config_yaml_default, { mcpServers: mcpServersData });
455
+ } else content = mcp_config_default;
438
456
  try {
439
- await (0, node_fs_promises.writeFile)(outputPath, template, {
457
+ await (0, node_fs_promises.writeFile)(outputPath, content, {
440
458
  encoding: "utf-8",
441
459
  flag: options.force ? "w" : "wx"
442
460
  });
@@ -460,7 +478,7 @@ const initCommand = new commander.Command("init").description("Initialize MCP co
460
478
 
461
479
  //#endregion
462
480
  //#region package.json
463
- var version = "0.2.2";
481
+ var version = "0.2.3";
464
482
 
465
483
  //#endregion
466
484
  //#region src/cli.ts
package/dist/cli.mjs CHANGED
@@ -4,6 +4,7 @@ import { writeFile } from "node:fs/promises";
4
4
  import { resolve } from "node:path";
5
5
  import { Command } from "commander";
6
6
  import { log } from "@agiflowai/aicode-utils";
7
+ import { Liquid } from "liquidjs";
7
8
 
8
9
  //#region src/types/index.ts
9
10
  /**
@@ -398,12 +399,12 @@ const useToolCommand = new Command("use-tool").description("Execute an MCP tool
398
399
  });
399
400
 
400
401
  //#endregion
401
- //#region src/templates/mcp-config.yaml?raw
402
- var mcp_config_default = "# MCP Server Configuration\n# This file configures the MCP servers that one-mcp will connect to\n#\n# Environment Variable Interpolation:\n# Use ${VAR_NAME} syntax to reference environment variables\n# Example: ${HOME}, ${API_KEY}, ${DATABASE_URL}\n#\n# Instructions:\n# - config.instruction: Server's default instruction (from server documentation)\n# - instruction: User override (optional, takes precedence over config.instruction)\n# - config.toolBlacklist: Array of tool names to hide/block from this server\n# - config.omitToolDescription: Boolean to show only tool names without descriptions (saves tokens)\n\n# Remote Configuration Sources (OPTIONAL)\n# Fetch and merge configurations from remote URLs\n# Remote configs are merged with local configs based on merge strategy\n#\n# SECURITY: SSRF Protection is ENABLED by default\n# - Only HTTPS URLs are allowed (set security.enforceHttps: false to allow HTTP)\n# - Private IPs and localhost are blocked (set security.allowPrivateIPs: true for internal networks)\n# - Blocked ranges: 127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16\nremoteConfigs:\n # Example 1: Basic remote config with default security\n # - url: ${AGIFLOW_URL}/api/v1/mcp-configs\n # headers:\n # Authorization: Bearer ${AGIFLOW_API_KEY}\n # mergeStrategy: local-priority # Options: local-priority (default), remote-priority, merge-deep\n #\n # Example 2: Remote config with custom security settings (for internal networks)\n # - url: ${INTERNAL_URL}/mcp-configs\n # headers:\n # Authorization: Bearer ${INTERNAL_TOKEN}\n # security:\n # allowPrivateIPs: true # Allow internal IPs (default: false)\n # enforceHttps: false # Allow HTTP (default: true, HTTPS only)\n # mergeStrategy: local-priority\n #\n # Example 3: Remote config with additional validation (OPTIONAL)\n # - url: ${AGIFLOW_URL}/api/v1/mcp-configs\n # headers:\n # Authorization: Bearer ${AGIFLOW_API_KEY}\n # X-API-Key: ${AGIFLOW_API_KEY}\n # security:\n # enforceHttps: true # Require HTTPS (default: true)\n # allowPrivateIPs: false # Block private IPs (default: false)\n # validation: # OPTIONAL: Additional regex validation on top of security checks\n # url: ^https://.*\\.agiflow\\.io/.* # OPTIONAL: Regex pattern to validate URL format\n # headers: # OPTIONAL: Regex patterns to validate header values\n # Authorization: ^Bearer [A-Za-z0-9_-]+$\n # X-API-Key: ^[A-Za-z0-9_-]{32,}$\n # mergeStrategy: local-priority\n\nmcpServers:\n # Example MCP server using stdio transport\n example-server:\n command: node\n args:\n - /path/to/mcp-server/build/index.js\n env:\n # Environment variables for the MCP server\n LOG_LEVEL: info\n # You can use environment variable interpolation:\n # DATABASE_URL: ${DATABASE_URL}\n # API_KEY: ${MY_API_KEY}\n config:\n # Server's default instruction (from server documentation)\n instruction: Use this server for...\n # Optional: Block specific tools from being listed or executed\n # toolBlacklist:\n # - dangerous_tool_name\n # - another_blocked_tool\n # Optional: Omit tool descriptions to save tokens (default: false)\n # omitToolDescription: true\n # instruction: Optional user override - takes precedence over config.instruction\n\n # Example MCP server using SSE transport with environment variables\n # remote-server:\n # url: https://example.com/mcp\n # type: sse\n # headers:\n # # Use ${VAR_NAME} to interpolate environment variables\n # Authorization: Bearer ${API_KEY}\n # config:\n # instruction: This server provides tools for...\n # # Optional: Block specific tools from being listed or executed\n # # toolBlacklist:\n # # - tool_to_block\n # # Optional: Omit tool descriptions to save tokens (default: false)\n # # omitToolDescription: true\n # # instruction: Optional user override\n";
402
+ //#region src/templates/mcp-config.yaml.liquid?raw
403
+ var mcp_config_yaml_default = "# MCP Server Configuration\n# This file configures the MCP servers that one-mcp will connect to\n#\n# Environment Variable Interpolation:\n# Use ${VAR_NAME} syntax to reference environment variables\n# Example: ${HOME}, ${API_KEY}, ${DATABASE_URL}\n#\n# Instructions:\n# - config.instruction: Server's default instruction (from server documentation)\n# - instruction: User override (optional, takes precedence over config.instruction)\n# - config.toolBlacklist: Array of tool names to hide/block from this server\n# - config.omitToolDescription: Boolean to show only tool names without descriptions (saves tokens)\n\n# Remote Configuration Sources (OPTIONAL)\n# Fetch and merge configurations from remote URLs\n# Remote configs are merged with local configs based on merge strategy\n#\n# SECURITY: SSRF Protection is ENABLED by default\n# - Only HTTPS URLs are allowed (set security.enforceHttps: false to allow HTTP)\n# - Private IPs and localhost are blocked (set security.allowPrivateIPs: true for internal networks)\n# - Blocked ranges: 127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16\nremoteConfigs:\n # Example 1: Basic remote config with default security\n # - url: ${AGIFLOW_URL}/api/v1/mcp-configs\n # headers:\n # Authorization: Bearer ${AGIFLOW_API_KEY}\n # mergeStrategy: local-priority # Options: local-priority (default), remote-priority, merge-deep\n #\n # Example 2: Remote config with custom security settings (for internal networks)\n # - url: ${INTERNAL_URL}/mcp-configs\n # headers:\n # Authorization: Bearer ${INTERNAL_TOKEN}\n # security:\n # allowPrivateIPs: true # Allow internal IPs (default: false)\n # enforceHttps: false # Allow HTTP (default: true, HTTPS only)\n # mergeStrategy: local-priority\n #\n # Example 3: Remote config with additional validation (OPTIONAL)\n # - url: ${AGIFLOW_URL}/api/v1/mcp-configs\n # headers:\n # Authorization: Bearer ${AGIFLOW_API_KEY}\n # X-API-Key: ${AGIFLOW_API_KEY}\n # security:\n # enforceHttps: true # Require HTTPS (default: true)\n # allowPrivateIPs: false # Block private IPs (default: false)\n # validation: # OPTIONAL: Additional regex validation on top of security checks\n # url: ^https://.*\\.agiflow\\.io/.* # OPTIONAL: Regex pattern to validate URL format\n # headers: # OPTIONAL: Regex patterns to validate header values\n # Authorization: ^Bearer [A-Za-z0-9_-]+$\n # X-API-Key: ^[A-Za-z0-9_-]{32,}$\n # mergeStrategy: local-priority\n\nmcpServers:\n{%- if mcpServers %}{% for server in mcpServers %}\n {{ server.name }}:\n command: {{ server.command }}\n args:{% for arg in server.args %}\n - '{{ arg }}'{% endfor %}\n # env:\n # LOG_LEVEL: info\n # # API_KEY: ${MY_API_KEY}\n # config:\n # instruction: Use this server for...\n # # toolBlacklist:\n # # - tool_to_block\n # # omitToolDescription: true\n{% endfor %}\n # Example MCP server using SSE transport\n # remote-server:\n # url: https://example.com/mcp\n # type: sse\n # headers:\n # Authorization: Bearer ${API_KEY}\n # config:\n # instruction: This server provides tools for...\n{% else %}\n # Example MCP server using stdio transport\n example-server:\n command: node\n args:\n - /path/to/mcp-server/build/index.js\n env:\n # Environment variables for the MCP server\n LOG_LEVEL: info\n # You can use environment variable interpolation:\n # DATABASE_URL: ${DATABASE_URL}\n # API_KEY: ${MY_API_KEY}\n config:\n # Server's default instruction (from server documentation)\n instruction: Use this server for...\n # Optional: Block specific tools from being listed or executed\n # toolBlacklist:\n # - dangerous_tool_name\n # - another_blocked_tool\n # Optional: Omit tool descriptions to save tokens (default: false)\n # omitToolDescription: true\n # instruction: Optional user override - takes precedence over config.instruction\n\n # Example MCP server using SSE transport with environment variables\n # remote-server:\n # url: https://example.com/mcp\n # type: sse\n # headers:\n # # Use ${VAR_NAME} to interpolate environment variables\n # Authorization: Bearer ${API_KEY}\n # config:\n # instruction: This server provides tools for...\n # # Optional: Block specific tools from being listed or executed\n # # toolBlacklist:\n # # - tool_to_block\n # # Optional: Omit tool descriptions to save tokens (default: false)\n # # omitToolDescription: true\n # # instruction: Optional user override\n{% endif %}\n";
403
404
 
404
405
  //#endregion
405
406
  //#region src/templates/mcp-config.json?raw
406
- var mcp_config_default$1 = "{\n \"_comment\": \"MCP Server Configuration - Use ${VAR_NAME} syntax for environment variable interpolation\",\n \"_instructions\": \"config.instruction: Server's default instruction | instruction: User override (takes precedence)\",\n \"mcpServers\": {\n \"example-server\": {\n \"command\": \"node\",\n \"args\": [\n \"/path/to/mcp-server/build/index.js\"\n ],\n \"env\": {\n \"LOG_LEVEL\": \"info\",\n \"_comment\": \"You can use environment variable interpolation:\",\n \"_example_DATABASE_URL\": \"${DATABASE_URL}\",\n \"_example_API_KEY\": \"${MY_API_KEY}\"\n },\n \"config\": {\n \"instruction\": \"Use this server for...\"\n },\n \"_instruction_override\": \"Optional user override - takes precedence over config.instruction\"\n }\n }\n}\n";
407
+ var mcp_config_default = "{\n \"_comment\": \"MCP Server Configuration - Use ${VAR_NAME} syntax for environment variable interpolation\",\n \"_instructions\": \"config.instruction: Server's default instruction | instruction: User override (takes precedence)\",\n \"mcpServers\": {\n \"example-server\": {\n \"command\": \"node\",\n \"args\": [\n \"/path/to/mcp-server/build/index.js\"\n ],\n \"env\": {\n \"LOG_LEVEL\": \"info\",\n \"_comment\": \"You can use environment variable interpolation:\",\n \"_example_DATABASE_URL\": \"${DATABASE_URL}\",\n \"_example_API_KEY\": \"${MY_API_KEY}\"\n },\n \"config\": {\n \"instruction\": \"Use this server for...\"\n },\n \"_instruction_override\": \"Optional user override - takes precedence over config.instruction\"\n }\n }\n}\n";
407
408
 
408
409
  //#endregion
409
410
  //#region src/commands/init.ts
@@ -431,12 +432,29 @@ var mcp_config_default$1 = "{\n \"_comment\": \"MCP Server Configuration - Use
431
432
  /**
432
433
  * Initialize MCP configuration file
433
434
  */
434
- const initCommand = new Command("init").description("Initialize MCP configuration file").option("-o, --output <path>", "Output file path", "mcp-config.yaml").option("--json", "Generate JSON config instead of YAML", false).option("-f, --force", "Overwrite existing config file", false).action(async (options) => {
435
+ const initCommand = new Command("init").description("Initialize MCP configuration file").option("-o, --output <path>", "Output file path", "mcp-config.yaml").option("--json", "Generate JSON config instead of YAML", false).option("-f, --force", "Overwrite existing config file", false).option("--mcp-servers <json>", "JSON string of MCP servers to add to config (optional)").action(async (options) => {
435
436
  try {
436
437
  const outputPath = resolve(options.output);
437
- const template = !options.json && (outputPath.endsWith(".yaml") || outputPath.endsWith(".yml")) ? mcp_config_default : mcp_config_default$1;
438
+ const isYaml = !options.json && (outputPath.endsWith(".yaml") || outputPath.endsWith(".yml"));
439
+ let content;
440
+ if (isYaml) {
441
+ const liquid = new Liquid();
442
+ let mcpServersData = null;
443
+ if (options.mcpServers) try {
444
+ const serversObj = JSON.parse(options.mcpServers);
445
+ mcpServersData = Object.entries(serversObj).map(([name, config]) => ({
446
+ name,
447
+ command: config.command,
448
+ args: config.args
449
+ }));
450
+ } catch (parseError) {
451
+ log.error("Failed to parse --mcp-servers JSON:", parseError instanceof Error ? parseError.message : String(parseError));
452
+ process.exit(1);
453
+ }
454
+ content = await liquid.parseAndRender(mcp_config_yaml_default, { mcpServers: mcpServersData });
455
+ } else content = mcp_config_default;
438
456
  try {
439
- await writeFile(outputPath, template, {
457
+ await writeFile(outputPath, content, {
440
458
  encoding: "utf-8",
441
459
  flag: options.force ? "w" : "wx"
442
460
  });
@@ -460,7 +478,7 @@ const initCommand = new Command("init").description("Initialize MCP configuratio
460
478
 
461
479
  //#endregion
462
480
  //#region package.json
463
- var version = "0.2.2";
481
+ var version = "0.2.3";
464
482
 
465
483
  //#endregion
466
484
  //#region src/cli.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agiflowai/one-mcp",
3
3
  "description": "One MCP server package",
4
- "version": "0.2.2",
4
+ "version": "0.2.4",
5
5
  "license": "AGPL-3.0",
6
6
  "keywords": [
7
7
  "mcp",
@@ -24,8 +24,9 @@
24
24
  "commander": "14.0.1",
25
25
  "express": "^4.21.2",
26
26
  "js-yaml": "^4.1.0",
27
+ "liquidjs": "^10.21.0",
27
28
  "zod": "^3.24.1",
28
- "@agiflowai/aicode-utils": "1.0.4"
29
+ "@agiflowai/aicode-utils": "1.0.7"
29
30
  },
30
31
  "devDependencies": {
31
32
  "@types/express": "^5.0.0",