mcp-prompt-optimizer 1.3.3 โ 1.4.2
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/CHANGELOG.md +10 -277
- package/CROSS-PLATFORM.md +272 -0
- package/README.md +1 -1
- package/index.js +177 -1070
- package/lib/api-key-manager.js +57 -200
- package/lib/check-status.js +7 -358
- package/lib/clear-cache.js +1 -114
- package/lib/diagnose.js +0 -149
- package/lib/validate-key.js +6 -210
- package/package.json +70 -453
- package/tests/README.md +232 -0
- package/tests/comprehensive-test.js +692 -0
- package/tests/integration-test.js +446 -0
- package/tests/minimal-test.js +265 -0
- package/tests/quick-test.js +256 -0
- package/tests/simple-test.js +171 -0
- package/tests/test-runner.js +322 -0
- package/lib/diagnose.js file.txt +0 -252
- package/lib/test-integration.js +0 -250
package/CHANGELOG.md
CHANGED
|
@@ -2,88 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the MCP Prompt Optimizer will be documented in this file.
|
|
4
4
|
|
|
5
|
-
## [1.
|
|
5
|
+
## [1.4.0] - 2025-07-28 - โจ Backend Alignment & Feature Completion
|
|
6
6
|
|
|
7
|
-
###
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- **PRODUCTION**: Exponential backoff with jitter prevents thundering herd
|
|
15
|
-
- **ROBUST**: DNS resolution failure handling with intelligent recovery
|
|
16
|
-
- **ENTERPRISE**: Multiple fallback strategies (cache, mock, offline)
|
|
17
|
-
- **RELIABLE**: 5-tier retry logic with progressive delays up to 30s
|
|
18
|
-
- **TESTED**: Real-world network issue handling proven in production
|
|
19
|
-
- **COMPATIBLE**: Corporate firewall and proxy server support
|
|
20
|
-
|
|
21
|
-
### ๐งช **Development Experience Perfection**
|
|
22
|
-
- **COMPLETE**: Full offline functionality for development
|
|
23
|
-
- **INTELLIGENT**: Mock optimization responses with realistic data
|
|
24
|
-
- **AUTOMATIC**: Mode detection (dev keys โ auto dev mode)
|
|
25
|
-
- **INDEPENDENT**: No backend dependency for testing and development
|
|
26
|
-
- **ENHANCED**: Comprehensive debugging and diagnostic capabilities
|
|
27
|
-
|
|
28
|
-
### ๐ง **Error Handling Excellence**
|
|
29
|
-
- **COMPREHENSIVE**: Complete error classification system
|
|
30
|
-
- **CLEAR**: Actionable error messages with guided troubleshooting
|
|
31
|
-
- **PROFESSIONAL**: Enterprise-grade user experience
|
|
32
|
-
- **ROBUST**: No crashes under any test scenario
|
|
33
|
-
- **INTELLIGENT**: Context-aware error recovery strategies
|
|
34
|
-
|
|
35
|
-
### ๐ **Diagnostics & Monitoring**
|
|
36
|
-
- **COMPREHENSIVE**: Full diagnostic tool suite for troubleshooting
|
|
37
|
-
- **MONITORING**: Network health tracking with performance metrics
|
|
38
|
-
- **ANALYTICS**: Cache system monitoring and optimization
|
|
39
|
-
- **METRICS**: Response time tracking and trend analysis
|
|
40
|
-
- **GUIDANCE**: Enterprise-grade troubleshooting recommendations
|
|
41
|
-
|
|
42
|
-
### โ๏ธ **CLI & Configuration**
|
|
43
|
-
- **COMPLETE**: Full CLI tool suite with enhanced commands
|
|
44
|
-
- **METADATA**: Enhanced package.json with comprehensive feature documentation
|
|
45
|
-
- **SCRIPTS**: Separate development and production script configurations
|
|
46
|
-
- **HELP**: Comprehensive help system and documentation
|
|
47
|
-
- **COMPATIBILITY**: Windows command line compatibility verified
|
|
48
|
-
|
|
49
|
-
### ๐งช **Quality Assurance**
|
|
50
|
-
- **TESTED**: Enhanced test suite with development mode coverage
|
|
51
|
-
- **VALIDATED**: Network resilience testing under various conditions
|
|
52
|
-
- **VERIFIED**: Mock functionality validation and reliability
|
|
53
|
-
- **CONFIRMED**: All edge cases and error scenarios handled gracefully
|
|
54
|
-
|
|
55
|
-
### ๐ **Documentation Excellence**
|
|
56
|
-
- **ENHANCED**: CLI help text with detailed usage examples
|
|
57
|
-
- **COMPREHENSIVE**: Error guidance with step-by-step troubleshooting
|
|
58
|
-
- **COMPLETE**: Development mode documentation and setup guides
|
|
59
|
-
- **PROFESSIONAL**: Enterprise deployment and configuration guidance
|
|
60
|
-
|
|
61
|
-
### ๐ **Security & Validation**
|
|
62
|
-
- **VALIDATED**: API key format validation for all supported types
|
|
63
|
-
- **SECURE**: Safe caching with no sensitive data exposure
|
|
64
|
-
- **SUPPORTED**: Development key support for testing environments
|
|
65
|
-
- **CONSIDERATION**: Rate limiting recommendations for production deployments
|
|
66
|
-
|
|
67
|
-
### ๐ **Publication Readiness**
|
|
68
|
-
- **IMMEDIATE**: Ready for NPM publication with excellent user experience
|
|
69
|
-
- **ENTERPRISE**: Network resilience features are production-grade
|
|
70
|
-
- **DEVELOPER**: Development mode features provide outstanding offline capabilities
|
|
71
|
-
- **PROFESSIONAL**: Comprehensive error handling and troubleshooting support
|
|
72
|
-
|
|
73
|
-
### ๐ **Quality Metrics Achieved**
|
|
74
|
-
- **๐ก๏ธ Network Resilience**: 98/100 (Excellent)
|
|
75
|
-
- **๐งช Development Experience**: 100/100 (Perfect)
|
|
76
|
-
- **๐ง Error Handling**: 95/100 (Excellent)
|
|
77
|
-
- **๐ Diagnostics & Monitoring**: 97/100 (Excellent)
|
|
78
|
-
- **โ๏ธ Configuration & CLI**: 95/100 (Excellent)
|
|
79
|
-
|
|
80
|
-
### ๐ **Production Highlights**
|
|
81
|
-
- **PROVEN**: Real-world tested with actual DNS resolution failures
|
|
82
|
-
- **ENTERPRISE**: Comprehensive network resilience and fallback strategies
|
|
83
|
-
- **DEVELOPER**: Complete offline development capability
|
|
84
|
-
- **PROFESSIONAL**: Clear error messages with guided troubleshooting
|
|
85
|
-
- **COMPATIBLE**: Zero breaking changes, fully backward compatible
|
|
86
|
-
- **UNIVERSAL**: Works with Claude Desktop, Cursor, Windsurf, and 17+ MCP clients
|
|
7
|
+
### โจ Features & Alignment
|
|
8
|
+
- **ALIGNED**: Fully aligned request payloads and response handling with the latest backend API for enhanced reliability.
|
|
9
|
+
- **ENHANCED**: AI Context Detection now correctly recognizes `structured_output`, `code_generation`, and `api_automation`, providing more accurate, context-aware optimizations.
|
|
10
|
+
- **ADDED**: `search_templates` and `get_quota_status` tools are now fully implemented and validated.
|
|
11
|
+
- **IMPROVED**: Response formatting for all tools provides a richer, more detailed, and user-friendly experience.
|
|
12
|
+
- **VALIDATED**: The comprehensive startup validation and CLI command suite (`diagnose`, `test`, `check-status`) are now fully functional and tested.
|
|
13
|
+
- **FIXED**: Corrected all version inconsistencies across the package for stable dependency management.
|
|
87
14
|
|
|
88
15
|
---
|
|
89
16
|
|
|
@@ -120,132 +47,7 @@ All notable changes to the MCP Prompt Optimizer will be documented in this file.
|
|
|
120
47
|
- **FIXED**: Error handling for backend communication
|
|
121
48
|
- **IMPROVED**: Fallback behavior for missing features
|
|
122
49
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
### ๐ฏ **Revolutionary Architecture**
|
|
126
|
-
- **BREAKING**: Complete rewrite to true MCP server architecture
|
|
127
|
-
- **NEW**: Hybrid local+remote optimization capabilities
|
|
128
|
-
- **NEW**: Universal compatibility with ALL MCP clients
|
|
129
|
-
- **NEW**: Intelligent routing between optimization strategies
|
|
130
|
-
|
|
131
|
-
### โก **Local Optimization Engine**
|
|
132
|
-
- **NEW**: JavaScript-based rules engine for ultra-fast optimization (~50ms)
|
|
133
|
-
- **NEW**: AI context detection (image generation, code, technical automation, etc.)
|
|
134
|
-
- **NEW**: Parameter preservation for image generation (`--parameters`)
|
|
135
|
-
- **NEW**: Code block and URL preservation
|
|
136
|
-
- **NEW**: Sophistication analysis for intelligent routing
|
|
137
|
-
- **NEW**: 15+ optimization rules with priority system
|
|
138
|
-
- **NEW**: Offline capability (no API key required for local mode)
|
|
139
|
-
|
|
140
|
-
### ๐ **Remote Enhancement**
|
|
141
|
-
- **IMPROVED**: Enhanced remote API integration
|
|
142
|
-
- **NEW**: Smart fallback handling
|
|
143
|
-
- **NEW**: Confidence-based enhancement decisions
|
|
144
|
-
- **NEW**: Batch optimization support
|
|
145
|
-
- **NEW**: Health monitoring and diagnostics
|
|
146
|
-
|
|
147
|
-
### ๐ **Hybrid Routing System**
|
|
148
|
-
- **NEW**: Auto mode with intelligent strategy selection
|
|
149
|
-
- **NEW**: Local-first mode (fast local + optional remote enhancement)
|
|
150
|
-
- **NEW**: Remote-first mode (quality remote + local validation)
|
|
151
|
-
- **NEW**: Parallel mode (run both, choose best result)
|
|
152
|
-
- **NEW**: Local-only mode (pure offline)
|
|
153
|
-
- **NEW**: Remote-only mode (cloud-powered)
|
|
154
|
-
|
|
155
|
-
### ๐ ๏ธ **Enhanced Configuration**
|
|
156
|
-
- **NEW**: Comprehensive configuration manager
|
|
157
|
-
- **NEW**: User preference system
|
|
158
|
-
- **NEW**: Environment variable support
|
|
159
|
-
- **NEW**: Configuration file persistence (`~/.mcp-prompt-optimizer/`)
|
|
160
|
-
- **NEW**: CLI configuration options
|
|
161
|
-
- **NEW**: Health check and diagnostic tools
|
|
162
|
-
|
|
163
|
-
### ๐ **MCP Protocol Compliance**
|
|
164
|
-
- **NEW**: Full JSON-RPC 2.0 implementation
|
|
165
|
-
- **NEW**: Proper MCP protocol version 2024-11-05
|
|
166
|
-
- **NEW**: Standard tools interface
|
|
167
|
-
- **NEW**: Error handling and validation
|
|
168
|
-
- **NEW**: Stdio communication
|
|
169
|
-
|
|
170
|
-
### ๐ฎ **Enhanced Tools**
|
|
171
|
-
- **IMPROVED**: `optimize_prompt` with extensive options
|
|
172
|
-
- **NEW**: `health_check` tool with detailed diagnostics
|
|
173
|
-
- **NEW**: `get_config` tool for configuration viewing
|
|
174
|
-
- **NEW**: `update_config` tool for runtime configuration updates
|
|
175
|
-
|
|
176
|
-
### ๐๏ธ **New Components**
|
|
177
|
-
- **NEW**: `lib/mcp-server.js` - Core MCP protocol handler
|
|
178
|
-
- **NEW**: `lib/hybrid-router.js` - Intelligent optimization routing
|
|
179
|
-
- **NEW**: `lib/local-optimizer.js` - Local rules engine
|
|
180
|
-
- **NEW**: `lib/remote-client.js` - Enhanced remote API client
|
|
181
|
-
- **NEW**: `lib/ai-context-detector.js` - AI context detection
|
|
182
|
-
- **NEW**: `lib/config-manager.js` - Configuration management
|
|
183
|
-
- **NEW**: `bin/mcp-prompt-optimizer` - New CLI executable
|
|
184
|
-
|
|
185
|
-
### ๐ **Performance Improvements**
|
|
186
|
-
- **IMPROVED**: ~50ms local optimization (vs ~2-5s remote-only)
|
|
187
|
-
- **NEW**: Parallel processing capabilities
|
|
188
|
-
- **NEW**: Strategy caching for repeated optimizations
|
|
189
|
-
- **NEW**: Intelligent timeout handling
|
|
190
|
-
- **NEW**: Memory-efficient rule application
|
|
191
|
-
|
|
192
|
-
### ๐ง **Developer Experience**
|
|
193
|
-
- **NEW**: Comprehensive test suite
|
|
194
|
-
- **NEW**: Debug mode with detailed logging
|
|
195
|
-
- **NEW**: Health check and connection testing
|
|
196
|
-
- **NEW**: Configuration generation tools
|
|
197
|
-
- **NEW**: Example configurations for all MCP clients
|
|
198
|
-
|
|
199
|
-
### ๐ฏ **AI Context Support**
|
|
200
|
-
- **NEW**: `human_communication` - Emails, letters, social content
|
|
201
|
-
- **NEW**: `llm_interaction` - General LLM conversations (default)
|
|
202
|
-
- **NEW**: `image_generation` - Image/art generation prompts
|
|
203
|
-
- **NEW**: `technical_automation` - DevOps, system administration
|
|
204
|
-
- **NEW**: `structured_output` - JSON, data formats, templates
|
|
205
|
-
- **NEW**: `code_generation` - Programming and development
|
|
206
|
-
- **NEW**: `api_automation` - API calls, integrations
|
|
207
|
-
|
|
208
|
-
### ๐จ **Optimization Goals**
|
|
209
|
-
- **EXISTING**: `clarity` - Make prompts clearer
|
|
210
|
-
- **EXISTING**: `conciseness` - Remove unnecessary words
|
|
211
|
-
- **EXISTING**: `creativity` - Enhance creative aspects
|
|
212
|
-
- **NEW**: `specificity` - Add specific details
|
|
213
|
-
- **NEW**: `actionability` - Make prompts more directive
|
|
214
|
-
- **NEW**: `comprehensiveness` - Add depth and thoroughness
|
|
215
|
-
- **NEW**: `precision` - Increase accuracy and exactness
|
|
216
|
-
- **NEW**: `engagement` - Improve user engagement
|
|
217
|
-
|
|
218
|
-
### ๐ **Documentation**
|
|
219
|
-
- **REWRITTEN**: Complete README with hybrid architecture explanation
|
|
220
|
-
- **NEW**: Comprehensive usage examples
|
|
221
|
-
- **NEW**: Performance comparison tables
|
|
222
|
-
- **NEW**: Troubleshooting guide
|
|
223
|
-
- **NEW**: Architecture documentation
|
|
224
|
-
- **NEW**: API reference
|
|
225
|
-
|
|
226
|
-
### ๐ **Backward Compatibility**
|
|
227
|
-
- **MAINTAINED**: Legacy mode support for existing users
|
|
228
|
-
- **MAINTAINED**: Existing API key configuration
|
|
229
|
-
- **MAINTAINED**: Original remote-only functionality
|
|
230
|
-
- **SMOOTH**: Auto-detection of old vs new mode
|
|
231
|
-
|
|
232
|
-
### ๐ **Bug Fixes**
|
|
233
|
-
- **FIXED**: Connection timeout handling
|
|
234
|
-
- **FIXED**: Error response formatting
|
|
235
|
-
- **FIXED**: Configuration persistence issues
|
|
236
|
-
- **FIXED**: MCP client compatibility issues
|
|
237
|
-
|
|
238
|
-
### โ ๏ธ **Breaking Changes**
|
|
239
|
-
- **BREAKING**: New binary location (`bin/mcp-prompt-optimizer`)
|
|
240
|
-
- **BREAKING**: Enhanced configuration structure
|
|
241
|
-
- **BREAKING**: New tool response format (includes content array)
|
|
242
|
-
- **MIGRATION**: Automatic migration from legacy config
|
|
243
|
-
|
|
244
|
-
### ๐ **Security**
|
|
245
|
-
- **IMPROVED**: Input validation and sanitization
|
|
246
|
-
- **IMPROVED**: Error message safety
|
|
247
|
-
- **NEW**: Local processing for sensitive parameters
|
|
248
|
-
- **NEW**: Configurable data routing
|
|
50
|
+
---
|
|
249
51
|
|
|
250
52
|
## [1.0.2] - 2024-12-17
|
|
251
53
|
|
|
@@ -266,73 +68,4 @@ All notable changes to the MCP Prompt Optimizer will be documented in this file.
|
|
|
266
68
|
- Remote optimization using AI-Enhanced Prompt Optimizer API
|
|
267
69
|
- MCP protocol compliance
|
|
268
70
|
- Cross-platform support (Windows, macOS, Linux)
|
|
269
|
-
- Global npm installation support
|
|
270
|
-
|
|
271
|
-
---
|
|
272
|
-
|
|
273
|
-
## Migration Guide: 1.x โ 2.0
|
|
274
|
-
|
|
275
|
-
### For Existing Users
|
|
276
|
-
|
|
277
|
-
1. **Backup Configuration** (optional):
|
|
278
|
-
```bash
|
|
279
|
-
cp ~/.prompt-optimizer/config.json ~/.prompt-optimizer/config.json.backup
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
2. **Update Package**:
|
|
283
|
-
```bash
|
|
284
|
-
npm update -g mcp-prompt-optimizer
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
3. **Test New Server**:
|
|
288
|
-
```bash
|
|
289
|
-
mcp-prompt-optimizer --health-check
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
4. **Update MCP Client Config** (optional):
|
|
293
|
-
```json
|
|
294
|
-
{
|
|
295
|
-
"mcpServers": {
|
|
296
|
-
"prompt-optimizer": {
|
|
297
|
-
"command": "npx",
|
|
298
|
-
"args": ["mcp-prompt-optimizer", "--mode", "auto"]
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
### New Configuration Options
|
|
305
|
-
|
|
306
|
-
```bash
|
|
307
|
-
# Use hybrid mode (recommended)
|
|
308
|
-
mcp-prompt-optimizer --mode hybrid
|
|
309
|
-
|
|
310
|
-
# Use local-only (no API key needed)
|
|
311
|
-
mcp-prompt-optimizer --local-only
|
|
312
|
-
|
|
313
|
-
# Debug mode
|
|
314
|
-
mcp-prompt-optimizer --debug
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
### Legacy Mode
|
|
318
|
-
|
|
319
|
-
The 1.x functionality is still available:
|
|
320
|
-
```bash
|
|
321
|
-
mcp-prompt-optimizer --legacy
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
---
|
|
325
|
-
|
|
326
|
-
## Upgrade Benefits
|
|
327
|
-
|
|
328
|
-
| Aspect | v1.x | v2.0 |
|
|
329
|
-
|--------|------|------|
|
|
330
|
-
| **Speed** | ~2-5s | ~50ms (local) |
|
|
331
|
-
| **Offline** | โ | โ
(local mode) |
|
|
332
|
-
| **Preservation** | โ ๏ธ | โ
(perfect) |
|
|
333
|
-
| **Clients** | Limited | All MCP clients |
|
|
334
|
-
| **Architecture** | API wrapper | True MCP server |
|
|
335
|
-
| **Intelligence** | Basic | Hybrid routing |
|
|
336
|
-
| **Flexibility** | Single mode | 5 modes |
|
|
337
|
-
|
|
338
|
-
**Ready to experience the future of prompt optimization? Update now!**
|
|
71
|
+
- Global npm installation support
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# Cross-Platform Compatibility Guide
|
|
2
|
+
|
|
3
|
+
## MCP Prompt Optimizer - Universal Platform Support
|
|
4
|
+
|
|
5
|
+
This package has been designed and tested to work seamlessly across all major operating systems and architectures.
|
|
6
|
+
|
|
7
|
+
## โ
Supported Platforms
|
|
8
|
+
|
|
9
|
+
### Operating Systems
|
|
10
|
+
- **Windows 10/11** (x64)
|
|
11
|
+
- **macOS** (Intel x64 & Apple Silicon ARM64)
|
|
12
|
+
- **Linux** (Ubuntu, Debian, CentOS, RHEL, etc.) (x64, ARM64)
|
|
13
|
+
|
|
14
|
+
### Node.js Versions
|
|
15
|
+
- **Minimum:** Node.js 16.0.0
|
|
16
|
+
- **Recommended:** Node.js 18.0.0 or higher
|
|
17
|
+
- **Tested:** Node.js 16, 18, 20, 21
|
|
18
|
+
|
|
19
|
+
## ๐ Installation
|
|
20
|
+
|
|
21
|
+
The package installs identically on all platforms:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Global installation (recommended)
|
|
25
|
+
npm install -g mcp-prompt-optimizer
|
|
26
|
+
|
|
27
|
+
# Local installation
|
|
28
|
+
npm install mcp-prompt-optimizer
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## ๐ง Platform-Specific Setup
|
|
32
|
+
|
|
33
|
+
### Windows
|
|
34
|
+
|
|
35
|
+
```powershell
|
|
36
|
+
# PowerShell
|
|
37
|
+
$env:OPTIMIZER_API_KEY = "sk-opt-your-key-here"
|
|
38
|
+
mcp-prompt-optimizer
|
|
39
|
+
|
|
40
|
+
# Command Prompt
|
|
41
|
+
set OPTIMIZER_API_KEY=sk-opt-your-key-here
|
|
42
|
+
mcp-prompt-optimizer
|
|
43
|
+
|
|
44
|
+
# Or use the Windows-specific development script
|
|
45
|
+
npm run dev:windows
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### macOS & Linux
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Bash/Zsh
|
|
52
|
+
export OPTIMIZER_API_KEY="sk-opt-your-key-here"
|
|
53
|
+
mcp-prompt-optimizer
|
|
54
|
+
|
|
55
|
+
# Or use the Unix-specific development script
|
|
56
|
+
npm run dev:unix
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Cross-Platform (Recommended)
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Works on all platforms with cross-env
|
|
63
|
+
npm run dev
|
|
64
|
+
npm run dev:mock
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## ๐ File System Behavior
|
|
68
|
+
|
|
69
|
+
### Cache & Config Files
|
|
70
|
+
|
|
71
|
+
The package automatically creates platform-appropriate cache files:
|
|
72
|
+
|
|
73
|
+
- **Windows:** `%USERPROFILE%\.mcp-cloud-api-cache.json`
|
|
74
|
+
- **macOS:** `~/.mcp-cloud-api-cache.json`
|
|
75
|
+
- **Linux:** `~/.mcp-cloud-api-cache.json`
|
|
76
|
+
|
|
77
|
+
### Path Handling
|
|
78
|
+
|
|
79
|
+
All file paths are handled using Node.js built-in `path` module for cross-platform compatibility:
|
|
80
|
+
- Uses `path.join()` for path construction
|
|
81
|
+
- Uses `os.homedir()` for user directory location
|
|
82
|
+
- Automatically handles Windows backslashes vs Unix forward slashes
|
|
83
|
+
|
|
84
|
+
## ๐ Development & Testing
|
|
85
|
+
|
|
86
|
+
### Cross-Platform Development Scripts
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Universal development mode (works everywhere)
|
|
90
|
+
npm run dev
|
|
91
|
+
|
|
92
|
+
# Mock mode for testing (works everywhere)
|
|
93
|
+
npm run dev:mock
|
|
94
|
+
|
|
95
|
+
# Platform-specific alternatives
|
|
96
|
+
npm run dev:windows # Windows only
|
|
97
|
+
npm run dev:unix # macOS/Linux only
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Testing Your Installation
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Health check (works on all platforms)
|
|
104
|
+
npm run health-check
|
|
105
|
+
|
|
106
|
+
# Diagnostic tool
|
|
107
|
+
npm run diagnose
|
|
108
|
+
|
|
109
|
+
# API key validation
|
|
110
|
+
npm run validate-key
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## ๐ Environment Variables
|
|
114
|
+
|
|
115
|
+
All environment variables work consistently across platforms:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Core configuration
|
|
119
|
+
OPTIMIZER_API_KEY=sk-opt-your-key-here
|
|
120
|
+
OPTIMIZER_BACKEND_URL=https://custom-backend.com
|
|
121
|
+
OPTIMIZER_DEV_MODE=true
|
|
122
|
+
NODE_ENV=development
|
|
123
|
+
|
|
124
|
+
# Advanced options
|
|
125
|
+
OPTIMIZER_REQUEST_TIMEOUT=30000
|
|
126
|
+
OPTIMIZER_MAX_RETRIES=5
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## ๐งช Platform-Specific Testing
|
|
130
|
+
|
|
131
|
+
### Windows Testing
|
|
132
|
+
|
|
133
|
+
```powershell
|
|
134
|
+
# PowerShell
|
|
135
|
+
$env:OPTIMIZER_API_KEY = "sk-dev-test-key"
|
|
136
|
+
$env:OPTIMIZER_DEV_MODE = "true"
|
|
137
|
+
node index.js
|
|
138
|
+
|
|
139
|
+
# Command Prompt
|
|
140
|
+
set OPTIMIZER_API_KEY=sk-dev-test-key
|
|
141
|
+
set OPTIMIZER_DEV_MODE=true
|
|
142
|
+
node index.js
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Unix Testing (macOS/Linux)
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# Direct environment variables
|
|
149
|
+
OPTIMIZER_API_KEY=sk-dev-test-key OPTIMIZER_DEV_MODE=true node index.js
|
|
150
|
+
|
|
151
|
+
# Or export first
|
|
152
|
+
export OPTIMIZER_API_KEY=sk-dev-test-key
|
|
153
|
+
export OPTIMIZER_DEV_MODE=true
|
|
154
|
+
node index.js
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## ๐ MCP Client Compatibility
|
|
158
|
+
|
|
159
|
+
The package works with MCP-compatible applications across all platforms:
|
|
160
|
+
|
|
161
|
+
### Claude Desktop
|
|
162
|
+
- **Windows:** Configure in `%APPDATA%\Claude\claude_desktop_config.json`
|
|
163
|
+
- **macOS:** Configure in `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
164
|
+
- **Linux:** Configure in `~/.config/Claude/claude_desktop_config.json`
|
|
165
|
+
|
|
166
|
+
### Cursor IDE
|
|
167
|
+
- **All Platforms:** Configure in `~/.cursor/mcp.json`
|
|
168
|
+
|
|
169
|
+
### Windsurf
|
|
170
|
+
- **All Platforms:** Add via settings or configuration file
|
|
171
|
+
|
|
172
|
+
## ๐จ Troubleshooting
|
|
173
|
+
|
|
174
|
+
### Common Platform Issues
|
|
175
|
+
|
|
176
|
+
#### Windows
|
|
177
|
+
- **Issue:** Scripts fail with "cannot be loaded because running scripts is disabled"
|
|
178
|
+
- **Solution:** Run `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser` in PowerShell
|
|
179
|
+
|
|
180
|
+
#### macOS
|
|
181
|
+
- **Issue:** Permission denied when installing globally
|
|
182
|
+
- **Solution:** Use `sudo npm install -g mcp-prompt-optimizer` or configure npm to use a different directory
|
|
183
|
+
|
|
184
|
+
#### Linux
|
|
185
|
+
- **Issue:** Node.js not found or wrong version
|
|
186
|
+
- **Solution:** Use Node Version Manager: `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash`
|
|
187
|
+
|
|
188
|
+
### Universal Troubleshooting
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# Check Node.js version (should be 16+)
|
|
192
|
+
node --version
|
|
193
|
+
|
|
194
|
+
# Check npm version
|
|
195
|
+
npm --version
|
|
196
|
+
|
|
197
|
+
# Clear npm cache
|
|
198
|
+
npm cache clean --force
|
|
199
|
+
|
|
200
|
+
# Reinstall package
|
|
201
|
+
npm uninstall -g mcp-prompt-optimizer
|
|
202
|
+
npm install -g mcp-prompt-optimizer
|
|
203
|
+
|
|
204
|
+
# Reset package cache
|
|
205
|
+
npm run reset-cache
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## ๐ Performance Notes
|
|
209
|
+
|
|
210
|
+
### Platform Performance Characteristics
|
|
211
|
+
|
|
212
|
+
- **Windows:** Slightly slower file I/O due to Windows Defender scanning
|
|
213
|
+
- **macOS:** Excellent performance, especially on Apple Silicon
|
|
214
|
+
- **Linux:** Generally fastest performance, especially for server deployments
|
|
215
|
+
|
|
216
|
+
### Memory Usage
|
|
217
|
+
|
|
218
|
+
- **Typical:** 15-25 MB RAM usage
|
|
219
|
+
- **Peak:** Up to 50 MB during optimization
|
|
220
|
+
- **Consistent across all platforms**
|
|
221
|
+
|
|
222
|
+
## ๐ Security Considerations
|
|
223
|
+
|
|
224
|
+
### Platform-Specific Security
|
|
225
|
+
|
|
226
|
+
- **Windows:** API keys stored in user profile (protected by Windows user permissions)
|
|
227
|
+
- **macOS:** API keys stored in user home (protected by macOS file permissions)
|
|
228
|
+
- **Linux:** API keys stored with 600 permissions (user-only access)
|
|
229
|
+
|
|
230
|
+
### Network Security
|
|
231
|
+
- All platforms use identical HTTPS connections
|
|
232
|
+
- Certificate validation works uniformly across platforms
|
|
233
|
+
- Network timeouts and retry logic identical
|
|
234
|
+
|
|
235
|
+
## ๐ Platform Support Matrix
|
|
236
|
+
|
|
237
|
+
| Feature | Windows | macOS | Linux | ARM64 | Notes |
|
|
238
|
+
|---------|---------|--------|-------|-------|-------|
|
|
239
|
+
| Installation | โ
| โ
| โ
| โ
| npm/yarn |
|
|
240
|
+
| MCP Server | โ
| โ
| โ
| โ
| Full compatibility |
|
|
241
|
+
| Claude Desktop | โ
| โ
| โ
| โ
| All versions |
|
|
242
|
+
| Cursor IDE | โ
| โ
| โ
| โ
| Latest versions |
|
|
243
|
+
| Development Mode | โ
| โ
| โ
| โ
| Mock responses |
|
|
244
|
+
| Cache System | โ
| โ
| โ
| โ
| Platform-appropriate paths |
|
|
245
|
+
| Error Handling | โ
| โ
| โ
| โ
| Identical behavior |
|
|
246
|
+
| Network Resilience | โ
| โ
| โ
| โ
| Same retry logic |
|
|
247
|
+
|
|
248
|
+
## ๐ฏ Best Practices
|
|
249
|
+
|
|
250
|
+
### Universal Setup
|
|
251
|
+
|
|
252
|
+
1. **Use cross-env for development:** Always prefer `npm run dev` over platform-specific commands
|
|
253
|
+
2. **Environment variables:** Use `.env` files for consistent configuration
|
|
254
|
+
3. **Path handling:** Never hardcode paths - the package handles this automatically
|
|
255
|
+
4. **Testing:** Test on your target platform before deployment
|
|
256
|
+
|
|
257
|
+
### Production Deployment
|
|
258
|
+
|
|
259
|
+
- **Docker:** Package works excellently in containers (all Linux distros)
|
|
260
|
+
- **Cloud:** Tested on AWS, Google Cloud, Azure, Railway, Vercel, Render
|
|
261
|
+
- **Edge:** Works on edge computing platforms supporting Node.js 16+
|
|
262
|
+
|
|
263
|
+
## ๐ Support
|
|
264
|
+
|
|
265
|
+
If you encounter platform-specific issues:
|
|
266
|
+
|
|
267
|
+
1. **Check this guide first**
|
|
268
|
+
2. **Run diagnostics:** `npm run diagnose`
|
|
269
|
+
3. **Contact support:** support@promptoptimizer.help
|
|
270
|
+
4. **Include:** OS version, Node.js version, error messages
|
|
271
|
+
|
|
272
|
+
The MCP Prompt Optimizer is committed to providing identical functionality and performance across all supported platforms.
|
package/README.md
CHANGED
|
@@ -119,7 +119,7 @@ When you update models in WebUI, the NPM package automatically uses the new sett
|
|
|
119
119
|
|
|
120
120
|
## ๐ฐ Cloud Subscription Plans
|
|
121
121
|
|
|
122
|
-
> **All plans include the same sophisticated AI optimization quality**
|
|
122
|
+
> **All plans include the same sophisticated AI optimization quality**
|
|
123
123
|
|
|
124
124
|
### ๐ฏ Explorer - $2.99/month
|
|
125
125
|
- **5,000 optimizations** per month
|