@alcyone-labs/arg-parser 1.1.0 → 1.2.0
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 +150 -24
- package/dist/index.cjs +21863 -2500
- package/dist/index.cjs.map +1 -1
- package/dist/index.min.mjs +14541 -1827
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.mjs +21865 -2502
- package/dist/index.mjs.map +1 -1
- package/dist/src/ArgParser.d.ts +2 -10
- package/dist/src/ArgParser.d.ts.map +1 -1
- package/dist/src/ArgParserBase.d.ts.map +1 -1
- package/dist/src/mcp-integration.d.ts.map +1 -1
- package/dist/src/types.d.ts +11 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +25 -5
- package/dist/examples/fuzzy-demo.d.ts +0 -8
- package/dist/examples/fuzzy-demo.d.ts.map +0 -1
- package/dist/examples/fuzzy-test-example.d.ts +0 -8
- package/dist/examples/fuzzy-test-example.d.ts.map +0 -1
- package/dist/examples/fzf-search-cli.d.ts +0 -8
- package/dist/examples/fzf-search-cli.d.ts.map +0 -1
- package/dist/examples/getting-started.d.ts +0 -27
- package/dist/examples/getting-started.d.ts.map +0 -1
- package/dist/examples/mcp-preset-transports.d.ts +0 -19
- package/dist/examples/mcp-preset-transports.d.ts.map +0 -1
- package/dist/examples/simple-cli.d.ts +0 -26
- package/dist/examples/simple-cli.d.ts.map +0 -1
- package/dist/examples/v1.1.0-showcase.d.ts +0 -16
- package/dist/examples/v1.1.0-showcase.d.ts.map +0 -1
- package/dist/examples/with-env-example.d.ts +0 -3
- package/dist/examples/with-env-example.d.ts.map +0 -1
- package/dist/index-6G9StDO_.js +0 -6445
- package/dist/index-6G9StDO_.js.map +0 -1
- package/dist/index-CqU7Fj3C.cjs +0 -6444
- package/dist/index-CqU7Fj3C.cjs.map +0 -1
- package/dist/index-Dx_q1msW.js +0 -4682
- package/dist/index-Dx_q1msW.js.map +0 -1
- package/dist/sse-B5Jf_YpG.cjs +0 -121
- package/dist/sse-B5Jf_YpG.cjs.map +0 -1
- package/dist/sse-BDL3h2Ll.js +0 -121
- package/dist/sse-BDL3h2Ll.js.map +0 -1
- package/dist/sse-DSjLfGFo.js +0 -107
- package/dist/sse-DSjLfGFo.js.map +0 -1
- package/dist/stdio-Cf19UQO7.js +0 -70
- package/dist/stdio-Cf19UQO7.js.map +0 -1
- package/dist/stdio-DESvSONI.cjs +0 -94
- package/dist/stdio-DESvSONI.cjs.map +0 -1
- package/dist/stdio-DLOResWr.js +0 -94
- package/dist/stdio-DLOResWr.js.map +0 -1
- package/dist/streamableHttp-DXIdDSbF.js +0 -342
- package/dist/streamableHttp-DXIdDSbF.js.map +0 -1
- package/dist/streamableHttp-DsXlAnqJ.cjs +0 -456
- package/dist/streamableHttp-DsXlAnqJ.cjs.map +0 -1
- package/dist/streamableHttp-Vd4Qsgko.js +0 -456
- package/dist/streamableHttp-Vd4Qsgko.js.map +0 -1
- package/dist/types-DSxPEImy.cjs +0 -943
- package/dist/types-DSxPEImy.cjs.map +0 -1
- package/dist/types-DdsPVLQ5.js +0 -846
- package/dist/types-DdsPVLQ5.js.map +0 -1
- package/dist/types-DpK81FWv.js +0 -944
- package/dist/types-DpK81FWv.js.map +0 -1
package/README.md
CHANGED
|
@@ -4,12 +4,59 @@ ArgParser is a powerful and flexible library for building command-line interface
|
|
|
4
4
|
|
|
5
5
|
Whether you're building a simple script, a complex nested CLI application, or an MCP (Model Context Protocol) server, ArgParser provides the tools to create robust and user-friendly interfaces with minimal boilerplate.
|
|
6
6
|
|
|
7
|
+
## What's New in v1.2.0
|
|
8
|
+
|
|
9
|
+
### **Critical MCP Fixes & Improvements**
|
|
10
|
+
|
|
11
|
+
- **Fixed MCP Output Schema Support**: Resolved the critical issue where MCP tools with output schemas failed with `"Tool has an output schema but no structured content was provided"` error
|
|
12
|
+
- **Enhanced Handler Context**: Added `isMcp` flag to handler context, enabling proper MCP mode detection in handlers
|
|
13
|
+
- **Improved Response Format**: MCP tools now correctly return both `content` and `structuredContent` fields as required by the JSON-RPC 2.0 specification
|
|
14
|
+
- **Better Integration**: Handlers can now reliably detect when they're being called from MCP mode vs CLI mode
|
|
15
|
+
|
|
16
|
+
### **What Was Fixed**
|
|
17
|
+
|
|
18
|
+
**Before v1.2.0**: MCP servers would fail when tools had output schemas defined:
|
|
19
|
+
```
|
|
20
|
+
MCP error -32602: Tool canny-search has an output schema but no structured content was provided
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**After v1.2.0**: MCP tools with output schemas work correctly, returning proper JSON-RPC 2.0 responses:
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"jsonrpc": "2.0",
|
|
27
|
+
"id": 3,
|
|
28
|
+
"result": {
|
|
29
|
+
"content": [{"type": "text", "text": "..."}],
|
|
30
|
+
"structuredContent": { /* validated against output schema */ }
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### **Handler Context Enhancement**
|
|
36
|
+
|
|
37
|
+
Handlers now receive an `isMcp` flag to detect execution context:
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
const cli = ArgParser.withMcp({
|
|
41
|
+
handler: async (ctx) => {
|
|
42
|
+
if (ctx.isMcp) {
|
|
43
|
+
// Running in MCP mode - return structured data
|
|
44
|
+
return { success: true, data: processedData };
|
|
45
|
+
} else {
|
|
46
|
+
// Running in CLI mode - can use console output
|
|
47
|
+
console.log("Processing complete!");
|
|
48
|
+
return processedData;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
7
54
|
## What's New in v1.1.0
|
|
8
55
|
|
|
9
56
|
### **Major Features**
|
|
10
57
|
|
|
11
58
|
- **MCP (Model Context Protocol) Integration**: Transform any CLI into an MCP server with multiple transport support. Run MCP servers with stdio, SSE, and HTTP transports simultaneously, including streamable HTTP.
|
|
12
|
-
- **System Flags**: Built-in `--s-debug-print`, `--s-with-env`, `--s-save-to-env`, and `--s-
|
|
59
|
+
- **System Flags**: Built-in `--s-debug-print`, `--s-with-env`, `--s-save-to-env`, `--s-enable-fuzzy`, and `--s-save-DXT` for enhanced debugging, configuration, testing, and MCP distribution
|
|
13
60
|
- **Environment Loading**: Load configuration from `.env`, `.yaml`, `.json`, and `.toml` files
|
|
14
61
|
- **Enhanced Debugging**: Comprehensive runtime debugging and configuration export tools
|
|
15
62
|
|
|
@@ -136,38 +183,36 @@ deno run --unstable-sloppy-imports --allow-read --allow-write --allow-env your-c
|
|
|
136
183
|
deno task example:simple-cli --env production --port 8080
|
|
137
184
|
```
|
|
138
185
|
|
|
139
|
-
### **Using
|
|
186
|
+
### **Using the Library in Your Projects**
|
|
140
187
|
|
|
141
|
-
|
|
188
|
+
Install the library and use it in your projects:
|
|
142
189
|
|
|
143
190
|
```bash
|
|
144
|
-
#
|
|
145
|
-
|
|
191
|
+
# Install the library
|
|
192
|
+
pnpm add @alcyone-labs/arg-parser
|
|
146
193
|
|
|
147
|
-
#
|
|
148
|
-
|
|
194
|
+
# Use in your project
|
|
195
|
+
import { ArgParser } from '@alcyone-labs/arg-parser';
|
|
196
|
+
// or
|
|
197
|
+
const { ArgParser } = require('@alcyone-labs/arg-parser');
|
|
198
|
+
```
|
|
149
199
|
|
|
150
|
-
|
|
151
|
-
node dist/index.min.mjs
|
|
200
|
+
### **Running Examples**
|
|
152
201
|
|
|
153
|
-
|
|
154
|
-
const { ArgParser } = require('./dist/index.cjs'); // CommonJS
|
|
155
|
-
import { ArgParser } from './dist/index.mjs'; // ES Modules
|
|
202
|
+
Examples are provided as TypeScript source files for educational purposes. Run them directly with your preferred runtime:
|
|
156
203
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
cli.parse(['--env', 'production']);
|
|
167
|
-
"
|
|
204
|
+
```bash
|
|
205
|
+
# BunJS (recommended)
|
|
206
|
+
bun examples/simple-cli.ts --env production --port 8080
|
|
207
|
+
|
|
208
|
+
# Node.js with tsx
|
|
209
|
+
npx tsx examples/simple-cli.ts --env production --port 8080
|
|
210
|
+
|
|
211
|
+
# Deno (use predefined tasks)
|
|
212
|
+
deno task example:simple-cli --env production --port 8080
|
|
168
213
|
```
|
|
169
214
|
|
|
170
|
-
All examples
|
|
215
|
+
All examples work seamlessly across all three runtimes, ensuring maximum compatibility for your CLI applications.
|
|
171
216
|
|
|
172
217
|
## Basic Usage
|
|
173
218
|
|
|
@@ -785,6 +830,7 @@ System flags use the `--s-*` pattern and provide powerful development and deploy
|
|
|
785
830
|
- **`--s-save-to-env <file>`**: Export current configuration to various formats
|
|
786
831
|
- **`--s-debug-print`**: Export complete parser configuration for inspection
|
|
787
832
|
- **`--s-enable-fuzzy`**: Enable fuzzy testing mode (dry-run with no side effects)
|
|
833
|
+
- **`--s-save-DXT [dir]`**: Generate DXT packages for MCP servers (Desktop Extensions)
|
|
788
834
|
|
|
789
835
|
### `--s-save-to-env <file>`
|
|
790
836
|
|
|
@@ -1078,6 +1124,86 @@ bun src/fuzzy-test-cli.ts --file my-cli.ts --format markdown --output report.md
|
|
|
1078
1124
|
|
|
1079
1125
|
For complete documentation, examples, and advanced usage patterns, see the [Fuzzy Testing Documentation](docs/fuzzy-testing.md).
|
|
1080
1126
|
|
|
1127
|
+
### `--s-save-DXT [directory]`
|
|
1128
|
+
|
|
1129
|
+
Generates Desktop Extension (DXT) packages for all MCP servers defined in your ArgParser instance. DXT files are zip archives containing a manifest.json and server files, enabling single-click installation of MCP servers in compatible applications like Claude Desktop.
|
|
1130
|
+
|
|
1131
|
+
```bash
|
|
1132
|
+
# Generate DXT packages in current directory
|
|
1133
|
+
your-cli --s-save-DXT
|
|
1134
|
+
|
|
1135
|
+
# Generate DXT packages in specific directory
|
|
1136
|
+
your-cli --s-save-DXT ./dxt-packages
|
|
1137
|
+
|
|
1138
|
+
# Example with multiple MCP servers
|
|
1139
|
+
my-tool --s-save-DXT ./extensions
|
|
1140
|
+
```
|
|
1141
|
+
|
|
1142
|
+
**Features:**
|
|
1143
|
+
- **Automatic detection**: Finds all MCP servers added via `addMcpSubCommand()`
|
|
1144
|
+
- **Multiple servers**: Generates separate DXT files for each MCP server
|
|
1145
|
+
- **Complete tool listing**: Includes all MCP tools in the manifest
|
|
1146
|
+
- **Proper metadata**: Uses actual server names, versions, and descriptions
|
|
1147
|
+
- **Ready to install**: Generated DXT files work with DXT-compatible applications
|
|
1148
|
+
|
|
1149
|
+
**Generated Structure:**
|
|
1150
|
+
```
|
|
1151
|
+
your-server.dxt (ZIP file)
|
|
1152
|
+
├── manifest.json # Server metadata and tool definitions
|
|
1153
|
+
└── server/
|
|
1154
|
+
└── index.js # Server entry point
|
|
1155
|
+
```
|
|
1156
|
+
|
|
1157
|
+
**Example Output:**
|
|
1158
|
+
```
|
|
1159
|
+
🔧 Generating DXT packages for 2 MCP server(s)...
|
|
1160
|
+
✓ Generated: primary-server.dxt
|
|
1161
|
+
Server: primary-server v1.0.0
|
|
1162
|
+
Tools: 3 tool(s)
|
|
1163
|
+
✓ Generated: analytics-server.dxt
|
|
1164
|
+
Server: analytics-server v2.1.0
|
|
1165
|
+
Tools: 5 tool(s)
|
|
1166
|
+
|
|
1167
|
+
✅ DXT package generation completed!
|
|
1168
|
+
Output directory: /path/to/dxt-packages
|
|
1169
|
+
```
|
|
1170
|
+
|
|
1171
|
+
**Use Cases:**
|
|
1172
|
+
- **Distribution**: Package MCP servers for easy sharing and installation
|
|
1173
|
+
- **Development**: Create test packages during MCP server development
|
|
1174
|
+
- **Deployment**: Generate production-ready DXT files for distribution
|
|
1175
|
+
- **Integration**: Prepare MCP servers for Claude Desktop or other DXT-compatible applications
|
|
1176
|
+
|
|
1177
|
+
## Changelog
|
|
1178
|
+
|
|
1179
|
+
### v1.2.0 (2025-01-02)
|
|
1180
|
+
|
|
1181
|
+
**🔧 Critical MCP Fixes & Improvements**
|
|
1182
|
+
|
|
1183
|
+
- **Fixed MCP Output Schema Support**: Resolved the critical issue where MCP tools with output schemas failed with `"Tool has an output schema but no structured content was provided"` error
|
|
1184
|
+
- **Enhanced Handler Context**: Added `isMcp` flag to handler context for proper MCP mode detection
|
|
1185
|
+
- **Improved Response Format**: MCP tools now correctly return both `content` and `structuredContent` fields as required by JSON-RPC 2.0
|
|
1186
|
+
- **Better Integration**: Handlers can reliably detect when they're being called from MCP mode vs CLI mode
|
|
1187
|
+
|
|
1188
|
+
**What was broken before v1.2.0:**
|
|
1189
|
+
- MCP servers would fail when tools had output schemas defined
|
|
1190
|
+
- Handlers couldn't reliably detect MCP execution context
|
|
1191
|
+
- Response format didn't comply with MCP specification for structured content
|
|
1192
|
+
|
|
1193
|
+
**What works now:**
|
|
1194
|
+
- ✅ MCP tools with output schemas work correctly
|
|
1195
|
+
- ✅ Proper JSON-RPC 2.0 response format with both `content` and `structuredContent`
|
|
1196
|
+
- ✅ Handler context includes `isMcp` flag for mode detection
|
|
1197
|
+
- ✅ Full compatibility with MCP clients and the Model Context Protocol specification
|
|
1198
|
+
|
|
1199
|
+
### v1.1.0 (2024-12-XX)
|
|
1200
|
+
|
|
1201
|
+
**Major Features**
|
|
1202
|
+
- MCP (Model Context Protocol) Integration with multiple transport support
|
|
1203
|
+
- System Flags: `--s-debug-print`, `--s-with-env`, `--s-save-to-env`, `--s-enable-fuzzy`, `--s-save-DXT`
|
|
1204
|
+
- Environment Loading from `.env`, `.yaml`, `.json`, and `.toml` files
|
|
1205
|
+
- Enhanced Debugging and configuration export tools
|
|
1206
|
+
|
|
1081
1207
|
## API Reference
|
|
1082
1208
|
|
|
1083
1209
|
This section provides a quick overview of the main components. See the sections above for detailed explanations and examples.
|