mcp-prompt-optimizer 1.0.1

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 ADDED
@@ -0,0 +1,117 @@
1
+ # Changelog
2
+
3
+ All notable changes to the MCP Prompt Optimizer package will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.1] - 2025-06-05
9
+
10
+ ### Changed
11
+ - **CRITICAL**: Updated default backend URL from placeholder to production deployment
12
+ - Changed from `https://your-app.code.run` to `https://p01--project-optimizer--fvrdk8m9k9j.code.run`
13
+ - Ensures out-of-the-box functionality without manual configuration
14
+ - Updated package repository information to proper GitHub URLs
15
+ - Enhanced error handling in API client for server errors (500 status)
16
+ - Improved documentation with backend infrastructure details
17
+
18
+ ### Added
19
+ - Added comprehensive backend connectivity documentation
20
+ - Added troubleshooting section for backend connection issues
21
+ - Added environment variable documentation for debugging
22
+ - Added changelog file for version tracking
23
+ - Enhanced test suite with backend URL validation
24
+ - Added npm test script for package validation
25
+
26
+ ### Fixed
27
+ - Fixed default backend URL configuration in `lib/config.js`
28
+ - Ensured consistency between API client and config defaults
29
+ - Improved package metadata and author information
30
+
31
+ ### Documentation
32
+ - Updated README.md with production backend information
33
+ - Enhanced client configuration guide with backend details
34
+ - Added backend health check endpoints
35
+ - Improved troubleshooting documentation
36
+
37
+ ## [1.0.0] - 2025-05-XX
38
+
39
+ ### Added
40
+ - Initial release of MCP Prompt Optimizer package
41
+ - Support for Claude Desktop, Cursor, and Windsurf MCP clients
42
+ - API key authentication system with secure local storage
43
+ - Complete optimization goal support (10 different goals)
44
+ - MCP Protocol 2024-11-05 compliance
45
+ - Real-time quota tracking and usage monitoring
46
+ - Comprehensive error handling and validation
47
+ - Interactive setup command for API key configuration
48
+ - Global npm package installation support
49
+ - Cross-platform compatibility (Windows, macOS, Linux)
50
+
51
+ ### Features
52
+ - **optimize_prompt** tool with advanced goal selection
53
+ - Secure API key management with local storage
54
+ - Base64 configuration encoding for MCP protocol compliance
55
+ - Automatic retry logic and rate limiting handling
56
+ - Health check and connectivity validation
57
+ - Development and production environment support
58
+
59
+ ### Security
60
+ - HTTPS-only communication with backend
61
+ - Local-only API key storage
62
+ - No persistent data storage on servers
63
+ - Enterprise-grade security compliance
64
+
65
+ ---
66
+
67
+ ## Backend Compatibility
68
+
69
+ | Package Version | Backend API Version | Deployment URL |
70
+ |-----------------|--------------------|--------------------|
71
+ | 1.0.1 | v0.2.2+ | https://p01--project-optimizer--fvrdk8m9k9j.code.run |
72
+ | 1.0.0 | v0.2.0+ | Placeholder URL (manual configuration required) |
73
+
74
+ ## Migration Guide
75
+
76
+ ### From 1.0.0 to 1.0.1
77
+
78
+ No breaking changes. The update automatically configures the correct backend URL.
79
+
80
+ **If you previously configured a custom backend URL:**
81
+ - Your configuration will be preserved
82
+ - To use the new default: delete `~/.prompt-optimizer/config.json` and run `mcp-prompt-optimizer --setup`
83
+
84
+ **For existing installations:**
85
+ ```bash
86
+ # Update the package
87
+ npm update -g mcp-prompt-optimizer
88
+
89
+ # Verify new version
90
+ mcp-prompt-optimizer --version
91
+
92
+ # Test connectivity (optional)
93
+ npm test
94
+ ```
95
+
96
+ ## Known Issues
97
+
98
+ ### 1.0.1
99
+ - None known at release time
100
+
101
+ ### 1.0.0
102
+ - Required manual backend URL configuration
103
+ - Placeholder URLs in documentation
104
+
105
+ ## Support
106
+
107
+ For version-specific support:
108
+ - [GitHub Issues](https://github.com/prompt-optimizer/mcp-prompt-optimizer/issues)
109
+ - [Support Portal](https://promptoptimizer-blog.vercel.app/support)
110
+ - [Documentation](https://promptoptimizer-blog.vercel.app/docs)
111
+
112
+ When reporting issues, please include:
113
+ - Package version (`mcp-prompt-optimizer --version`)
114
+ - Node.js version (`node --version`)
115
+ - Operating system
116
+ - MCP client type and version
117
+ - Error messages and logs
package/LICENSE ADDED
@@ -0,0 +1,63 @@
1
+ COMMERCIAL SOFTWARE LICENSE
2
+
3
+ Copyright (c) 2025 Prompt Optimizer Team
4
+
5
+ TERMS AND CONDITIONS
6
+
7
+ 1. GRANT OF LICENSE
8
+ Subject to the terms of this license, the Licensor grants you a non-exclusive,
9
+ non-transferable license to use this software in accordance with the terms below.
10
+
11
+ 2. PERMITTED USES
12
+ a) Personal Use: You may use this software for personal, non-commercial purposes
13
+ b) Educational Use: Educational institutions may use this software for teaching purposes
14
+ c) Evaluation: You may evaluate this software for up to 30 days for potential commercial use
15
+
16
+ 3. COMMERCIAL USE
17
+ Commercial use of this software requires a separate commercial license.
18
+ Contact support@promptoptimizer.com for commercial licensing terms.
19
+
20
+ 4. RESTRICTIONS
21
+ You may NOT:
22
+ a) Distribute, sublicense, or sell copies of this software
23
+ b) Create derivative works for commercial distribution
24
+ c) Use this software to provide competing services
25
+ d) Reverse engineer, decompile, or disassemble this software
26
+ e) Remove or modify any copyright notices
27
+
28
+ 5. INTELLECTUAL PROPERTY
29
+ a) Your Content: You retain all intellectual property rights in prompts, templates,
30
+ and content you create using this software
31
+ b) Software: This software and its original code remain the property of the Licensor
32
+ c) Templates: Optimization templates you create remain your intellectual property
33
+
34
+ 6. DATA AND PRIVACY
35
+ a) Template Storage: Your optimization templates are stored securely and remain private
36
+ b) API Keys: Stored locally on your device and transmitted securely
37
+ c) Usage Data: Anonymous usage statistics may be collected for service improvement
38
+
39
+ 7. DISCLAIMER OF WARRANTIES
40
+ THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
41
+ INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
42
+ PURPOSE, AND NON-INFRINGEMENT.
43
+
44
+ 8. LIMITATION OF LIABILITY
45
+ IN NO EVENT SHALL THE LICENSOR BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY,
46
+ WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN
47
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
48
+
49
+ 9. TERMINATION
50
+ This license is effective until terminated. Your rights under this license will
51
+ terminate automatically without notice if you fail to comply with any term of this license.
52
+
53
+ 10. UPDATES AND SUPPORT
54
+ Updates and support are provided through the official distribution channels.
55
+ Support is available at: https://promptoptimizer-blog.vercel.app/support
56
+
57
+ For questions about this license or to obtain a commercial license, contact:
58
+ Prompt Optimizer Team
59
+ Email: support@promptoptimizer.com
60
+ Website: https://promptoptimizer-blog.vercel.app
61
+
62
+ This license governs the use of the MCP Prompt Optimizer client software.
63
+ The backend API service is governed by separate terms of service.
package/README.md ADDED
@@ -0,0 +1,392 @@
1
+ # MCP Prompt Optimizer
2
+
3
+ Local MCP server for accessing the Prompt Optimizer API from Claude Desktop, Cursor, Windsurf, and other MCP-compatible clients.
4
+
5
+ ## Features
6
+
7
+ - 🤖 **Universal MCP Support** - Works with Claude Desktop, Cursor, Windsurf, and any MCP-compatible client
8
+ - 🔐 **Secure API Key Authentication** - Uses your personal API key for secure access
9
+ - 🎯 **Advanced Optimization Goals** - Support for clarity, conciseness, technical accuracy, and more
10
+ - 📊 **Real-time Quota Tracking** - See your usage and remaining quota
11
+ - 💾 **Automatic Template Saving** - All optimizations saved with rich metadata for future reference
12
+ - 🚀 **Easy Setup** - Simple configuration process
13
+ - ⚡ **Production Backend** - Powered by enterprise-grade FastAPI deployment on Northflank
14
+
15
+ ## Installation
16
+
17
+ ### Global Installation (Recommended)
18
+
19
+ ```bash
20
+ npm install -g mcp-prompt-optimizer
21
+ ```
22
+
23
+ ### Local Installation
24
+
25
+ ```bash
26
+ npm install mcp-prompt-optimizer
27
+ ```
28
+
29
+ ## Quick Start
30
+
31
+ ### 1. Get Your API Key
32
+
33
+ 1. Visit [Prompt Optimizer Dashboard](https://promptoptimizer-blog.vercel.app/dashboard)
34
+ 2. Subscribe to Creator ($12.99/month) or Innovator ($24.99/month) plan
35
+ 3. Generate your API key from the dashboard
36
+
37
+ ### 2. Setup
38
+
39
+ ```bash
40
+ mcp-prompt-optimizer --setup
41
+ ```
42
+
43
+ Enter your API key when prompted. The package will automatically connect to the production backend at `https://p01--project-optimizer--fvrdk8m9k9j.code.run`.
44
+
45
+ ### 3. Configure Your MCP Client
46
+
47
+ #### Claude Desktop
48
+
49
+ Add to `~/.claude/claude_desktop_config.json`:
50
+
51
+ ```json
52
+ {
53
+ "mcpServers": {
54
+ "prompt-optimizer": {
55
+ "command": "npx",
56
+ "args": ["mcp-prompt-optimizer"]
57
+ }
58
+ }
59
+ }
60
+ ```
61
+
62
+ #### Cursor
63
+
64
+ Add to `~/.cursor/mcp.json`:
65
+
66
+ ```json
67
+ {
68
+ "mcpServers": {
69
+ "prompt-optimizer": {
70
+ "command": "npx",
71
+ "args": ["mcp-prompt-optimizer"]
72
+ }
73
+ }
74
+ }
75
+ ```
76
+
77
+ #### Windsurf
78
+
79
+ Add via Windsurf settings or configuration file:
80
+
81
+ ```json
82
+ {
83
+ "mcpServers": {
84
+ "prompt-optimizer": {
85
+ "command": "npx",
86
+ "args": ["mcp-prompt-optimizer"]
87
+ }
88
+ }
89
+ }
90
+ ```
91
+
92
+ ### 4. Use the Tool
93
+
94
+ Once configured, the `optimize_prompt` tool will be available in your MCP client. You can:
95
+
96
+ - **prompt** (required): The prompt you want to optimize
97
+ - **goals** (optional): Array of optimization goals
98
+
99
+ ## Template Saving & History
100
+
101
+ Your optimizations are automatically saved as templates for comprehensive tracking and future reference:
102
+
103
+ ### Automatic Template Saving
104
+ - **Every Optimization Saved**: All successful optimizations are automatically saved as structured templates
105
+ - **Rich Metadata**: Templates include timestamps, optimization goals, confidence scores, and model information
106
+ - **Request Tracking**: Each optimization includes unique request IDs for audit trails
107
+ - **User Association**: Templates are linked to your account for privacy and organization
108
+
109
+ ### Template Structure
110
+ Each saved template contains:
111
+ ```json
112
+ {
113
+ "saved_at_utc": "2025-06-05T12:00:00.000Z",
114
+ "optimization_tier": "LLM",
115
+ "confidence_score": 0.95,
116
+ "original_prompt": "Your original prompt",
117
+ "optimized_prompt": "The improved version",
118
+ "optimization_goals": ["clarity", "technical_accuracy"],
119
+ "context_snapshot": {
120
+ "domain": "General",
121
+ "target_audience": "Default"
122
+ },
123
+ "request_id": "unique-request-identifier",
124
+ "request_metadata": {
125
+ "api_request_type": "POST_non_streaming",
126
+ "user_id": "your-user-id"
127
+ },
128
+ "model_optimized_with": "openai/gpt-4o-mini"
129
+ }
130
+ ```
131
+
132
+ ### Template Access
133
+ - **Dashboard Access**: View your optimization history at [the dashboard](https://promptoptimizer-blog.vercel.app/dashboard)
134
+ - **Server-Side Storage**: Templates are securely stored on the backend infrastructure
135
+ - **Privacy Protected**: Only you can access your templates through authenticated sessions
136
+ - **Export Capability**: Templates can be exported through the web dashboard
137
+
138
+ ### Template Benefits
139
+ - **Learning Tool**: Review how different goals affect optimization outcomes
140
+ - **Consistency**: Maintain consistent optimization approaches across projects
141
+ - **Analytics**: Track your optimization patterns and improvement over time
142
+ - **Audit Trail**: Complete history of optimization requests for compliance and review
143
+
144
+ ## Optimization Goals
145
+
146
+ Choose from these optimization strategies:
147
+
148
+ - **clarity** - Make the prompt clearer and more understandable
149
+ - **conciseness** - Remove unnecessary words while preserving meaning
150
+ - **technical_accuracy** - Improve technical precision and correctness
151
+ - **contextual_relevance** - Better alignment with context and purpose
152
+ - **specificity** - Add specific details and reduce ambiguity
153
+ - **actionability** - Make the prompt more actionable and directive
154
+ - **structure** - Improve organization and logical flow
155
+ - **technical_precision** - Enhance exactness of technical terms
156
+ - **linguistic_precision** - Refine language for exact meaning
157
+ - **holistic_effectiveness** - Overall optimization for best results
158
+
159
+ ## Example Usage
160
+
161
+ In Claude Desktop, you might ask:
162
+
163
+ ```
164
+ Please optimize this prompt using the optimize_prompt tool:
165
+ "Write me some code for a login system"
166
+
167
+ Use goals: ["clarity", "specificity", "technical_accuracy"]
168
+ ```
169
+
170
+ The tool will return an optimized version like:
171
+
172
+ ```
173
+ Create a secure user authentication system with the following specifications:
174
+
175
+ ## Requirements:
176
+ - Implement login functionality with username/email and password
177
+ - Include proper input validation and sanitization
178
+ - Add password hashing using bcrypt or similar
179
+ - Implement session management
180
+ - Include error handling for invalid credentials
181
+ - Add rate limiting to prevent brute force attacks
182
+
183
+ ## Deliverables:
184
+ - Backend authentication logic
185
+ - Frontend login form
186
+ - Database schema for user accounts
187
+ - Security best practices implementation
188
+
189
+ Confidence Score: 0.87
190
+ Quota Remaining: 195/200
191
+ ```
192
+
193
+ ## Subscription Tiers
194
+
195
+ - **Explorer** ($5.99/month): 20 optimizations via Web UI only
196
+ - **Creator** ($12.99/month): 200 optimizations + 1 API key + Template history
197
+ - **Innovator** ($24.99/month): 450 optimizations + up to 10 API keys + Advanced analytics
198
+
199
+ ## Backend Infrastructure
200
+
201
+ This package connects to a production-grade backend infrastructure:
202
+
203
+ - **FastAPI Backend** - High-performance Python API server with async processing
204
+ - **Northflank Hosting** - Enterprise cloud deployment platform with 99.9% uptime
205
+ - **Supabase Database** - PostgreSQL database with real-time features and automatic backups
206
+ - **Stripe Integration** - Secure payment processing and subscription management
207
+ - **Template Storage System** - Automatic optimization history with rich metadata
208
+ - **Advanced Analytics** - Usage tracking, performance monitoring, and optimization insights
209
+
210
+ ### Backend Endpoints
211
+ - **Production API**: `https://p01--project-optimizer--fvrdk8m9k9j.code.run`
212
+ - **Health Check**: `https://p01--project-optimizer--fvrdk8m9k9j.code.run/health`
213
+ - **API Documentation**: Available through the web dashboard
214
+
215
+ ### Server Features
216
+ - **Real-time Quota Tracking** - Live usage monitoring and limits
217
+ - **Template Persistence** - Automatic saving with comprehensive metadata
218
+ - **Rate Limiting** - Intelligent throttling to prevent abuse
219
+ - **Security Monitoring** - Advanced threat detection and prevention
220
+ - **Performance Optimization** - Sub-second response times for most requests
221
+
222
+ ## Commands
223
+
224
+ ```bash
225
+ # Start the MCP server (usually called by MCP client)
226
+ mcp-prompt-optimizer
227
+
228
+ # Configure API key
229
+ mcp-prompt-optimizer --setup
230
+
231
+ # Show help
232
+ mcp-prompt-optimizer --help
233
+
234
+ # Show version
235
+ mcp-prompt-optimizer --version
236
+
237
+ # Test package functionality
238
+ npm test
239
+ ```
240
+
241
+ ## Troubleshooting
242
+
243
+ ### API Key Issues
244
+
245
+ ```bash
246
+ # Reconfigure your API key
247
+ mcp-prompt-optimizer --setup
248
+ ```
249
+
250
+ ### Connection Issues
251
+
252
+ 1. Verify your internet connection
253
+ 2. Check that your API key is valid at [the dashboard](https://promptoptimizer-blog.vercel.app/dashboard)
254
+ 3. Ensure your subscription is active
255
+ 4. Try regenerating your API key from the dashboard
256
+ 5. Check backend status: `curl https://p01--project-optimizer--fvrdk8m9k9j.code.run/health`
257
+
258
+ ### MCP Client Configuration
259
+
260
+ 1. Make sure the configuration file path is correct
261
+ 2. Restart your MCP client after configuration changes
262
+ 3. Check that Node.js is installed and accessible
263
+ 4. Verify the package is installed globally: `npm list -g mcp-prompt-optimizer`
264
+
265
+ ### Backend Connection
266
+
267
+ If you experience backend connectivity issues:
268
+
269
+ ```bash
270
+ # Test backend directly
271
+ curl -X GET "https://p01--project-optimizer--fvrdk8m9k9j.code.run/health"
272
+
273
+ # Test with your API key
274
+ curl -X POST "https://p01--project-optimizer--fvrdk8m9k9j.code.run/api/v1/validate-key" \
275
+ -H "X-API-Key: your-api-key-here"
276
+ ```
277
+
278
+ ## Configuration File Location
279
+
280
+ Your API key is stored securely at:
281
+ - **Windows**: `%USERPROFILE%\.prompt-optimizer\config.json`
282
+ - **macOS/Linux**: `~/.prompt-optimizer/config.json`
283
+
284
+ The configuration includes:
285
+ ```json
286
+ {
287
+ "apiKey": "sk-opt-your-key-here",
288
+ "backendUrl": "https://p01--project-optimizer--fvrdk8m9k9j.code.run",
289
+ "updatedAt": "2025-06-05T12:00:00.000Z"
290
+ }
291
+ ```
292
+
293
+ ## Environment Variables
294
+
295
+ Override configuration with environment variables:
296
+
297
+ - `PROMPT_OPTIMIZER_API_KEY`: Override stored API key
298
+ - `PROMPT_OPTIMIZER_BACKEND_URL`: Override backend URL
299
+ - `NODE_ENV`: Set to 'development' for debug logging
300
+
301
+ Example:
302
+ ```bash
303
+ PROMPT_OPTIMIZER_API_KEY=sk-opt-your-key mcp-prompt-optimizer
304
+ ```
305
+
306
+ ## API Compatibility
307
+
308
+ This package is compatible with the FastAPI backend API version 0.2.2+ and supports:
309
+
310
+ - ✅ **MCP Protocol 2024-11-05** - Latest MCP specification
311
+ - ✅ **API Key Authentication** - Secure `sk-opt-` format keys
312
+ - ✅ **Base64 Config Encoding** - MCP protocol compliance
313
+ - ✅ **Real-time Quota Tracking** - Usage monitoring with template saving
314
+ - ✅ **Error Handling** - Comprehensive error responses
315
+ - ✅ **Rate Limiting** - Automatic retry logic
316
+ - ✅ **Template Persistence** - Automatic optimization history
317
+
318
+ ## Intellectual Property
319
+
320
+ - **Your Prompts, Your IP**: You retain full intellectual property rights over all prompts you create and optimize
321
+ - **Service Provision**: We provide optimization as a service - we do not claim ownership over your content
322
+ - **Template Storage**: Saved templates are for your reference and remain your intellectual property
323
+ - **Privacy Protected**: Your prompts and templates are private and accessible only to your account
324
+ - **Data Export**: You can export your optimization history and templates at any time
325
+
326
+ ## Support
327
+
328
+ - 📚 [Documentation](https://promptoptimizer-blog.vercel.app/docs)
329
+ - 🎫 [Support Portal](https://promptoptimizer-blog.vercel.app/support)
330
+ - 🐛 [Report Issues](https://github.com/prompt-optimizer/mcp-prompt-optimizer/issues)
331
+ - 💬 [Community Discord](https://discord.gg/prompt-optimizer)
332
+
333
+ ## Security
334
+
335
+ - API keys are stored locally and never shared
336
+ - All communication uses HTTPS encryption with the backend
337
+ - No prompt data is stored permanently beyond template history (which you control)
338
+ - Full audit trail of API usage available in dashboard
339
+ - Compliance with enterprise security standards
340
+ - Template data encrypted at rest and in transit
341
+
342
+ ## Development
343
+
344
+ ### Testing
345
+
346
+ ```bash
347
+ # Run package tests
348
+ npm test
349
+
350
+ # Manual server test
351
+ node test-package.js
352
+ ```
353
+
354
+ ### Local Development
355
+
356
+ ```bash
357
+ # Clone the repository
358
+ git clone https://github.com/prompt-optimizer/mcp-prompt-optimizer
359
+ cd mcp-prompt-optimizer
360
+
361
+ # Install dependencies
362
+ npm install
363
+
364
+ # Test locally
365
+ npm test
366
+ ```
367
+
368
+ ## Changelog
369
+
370
+ ### v1.0.1
371
+ - ✅ Updated backend URL to production deployment
372
+ - ✅ Enhanced error handling for server responses
373
+ - ✅ Improved repository information
374
+ - ✅ Added comprehensive backend infrastructure documentation
375
+ - ✅ Added template saving feature documentation
376
+
377
+ ### v1.0.0
378
+ - 🎉 Initial release with MCP protocol support
379
+ - ✅ Claude Desktop, Cursor, and Windsurf compatibility
380
+ - ✅ API key authentication system
381
+ - ✅ Complete optimization goal support
382
+
383
+ ## License
384
+
385
+ **Commercial License** - This software is licensed for commercial use. See LICENSE file for details.
386
+
387
+ **Your Content**: You retain full intellectual property rights over all prompts, templates, and content you create using this service.
388
+
389
+ ---
390
+
391
+ **Made with ❤️ by the Prompt Optimizer Team**
392
+ *Empowering better AI interactions through optimized prompts*
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../index.js');