mcp-prompt-optimizer 3.1.3 → 3.2.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.
Files changed (2) hide show
  1. package/index.js +50 -1
  2. package/package.json +12 -3
package/index.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * Production-grade with Bayesian optimization, AG-UI real-time features, enhanced network resilience,
6
6
  * development mode, and complete backend alignment
7
7
  *
8
- * Version: 3.1.0 - CE tools: generate_agent_sop, generate_skill_package, transform_for_framework, get_ce_quota_status
8
+ * Version: 3.2.0 - add delete_template tool (15 tools total)
9
9
  */
10
10
 
11
11
  const { Server } = require('@modelcontextprotocol/sdk/server/index.js');
@@ -36,6 +36,9 @@ const ENDPOINTS = {
36
36
 
37
37
  /** Update (PATCH) */
38
38
  UPDATE: (id) => `${MCP_PREFIX}/templates/${id}`,
39
+
40
+ /** Delete (DELETE) */
41
+ DELETE: (id) => `${MCP_PREFIX}/templates/${id}`,
39
42
  },
40
43
 
41
44
  /** Search templates (GET) — MCP endpoint, API-key auth */
@@ -124,6 +127,25 @@ class MCPPromptOptimizer {
124
127
  type: "boolean",
125
128
  description: "Enable Bayesian optimization features for parameter tuning (if available)",
126
129
  default: true
130
+ },
131
+ value_hierarchy: {
132
+ type: "array",
133
+ description: "Ordered list of values/constraints the optimizer must respect. NON_NEGOTIABLE entries force LLM-tier routing and inject hard constraints into the system prompt. Example: [{label:'NON_NEGOTIABLE',description:'Never suggest removing error handling'},{label:'HIGH',description:'Preserve technical terminology'}]",
134
+ items: {
135
+ type: "object",
136
+ properties: {
137
+ label: {
138
+ type: "string",
139
+ enum: ["NON_NEGOTIABLE", "HIGH", "MEDIUM", "LOW"],
140
+ description: "Priority level for this constraint"
141
+ },
142
+ description: {
143
+ type: "string",
144
+ description: "The value or constraint to enforce during optimization"
145
+ }
146
+ },
147
+ required: ["label", "description"]
148
+ }
127
149
  }
128
150
  },
129
151
  required: ["prompt"]
@@ -188,6 +210,17 @@ class MCPPromptOptimizer {
188
210
  required: ["template_id"]
189
211
  }
190
212
  },
213
+ {
214
+ name: "delete_template",
215
+ description: "🗑️ Delete a saved optimization template by ID.",
216
+ inputSchema: {
217
+ type: "object",
218
+ properties: {
219
+ template_id: { type: "string", description: "The ID of the template to delete" }
220
+ },
221
+ required: ["template_id"]
222
+ }
223
+ },
191
224
  {
192
225
  name: "search_templates",
193
226
  description: "🔍 Search your saved template library with AI-aware filtering, context-based search, and sophisticated template matching",
@@ -364,6 +397,7 @@ class MCPPromptOptimizer {
364
397
  case "create_template": return await this.handleCreateTemplate(args);
365
398
  case "get_template": return await this.handleGetTemplate(args);
366
399
  case "update_template": return await this.handleUpdateTemplate(args);
400
+ case "delete_template": return await this.handleDeleteTemplate(args);
367
401
  case "get_optimization_insights": return await this.handleGetOptimizationInsights(args);
368
402
  case "get_real_time_status": return await this.handleGetRealTimeStatus();
369
403
  case "generate_agent_sop": return await this.handleGenerateAgentSop(args);
@@ -674,6 +708,10 @@ class MCPPromptOptimizer {
674
708
  ai_context: detectedContext,
675
709
  };
676
710
 
711
+ if (args.value_hierarchy && args.value_hierarchy.length > 0) {
712
+ optimizationPayload.value_hierarchy = args.value_hierarchy;
713
+ }
714
+
677
715
  const result = await this.callBackendAPI(ENDPOINTS.OPTIMIZE, optimizationPayload);
678
716
 
679
717
  const enableBayesian = args.enable_bayesian !== false && this.bayesianOptimizationEnabled;
@@ -970,6 +1008,17 @@ class MCPPromptOptimizer {
970
1008
  }
971
1009
  }
972
1010
 
1011
+ async handleDeleteTemplate(args) {
1012
+ if (!args.template_id) throw new Error('Template ID is required');
1013
+ try {
1014
+ const result = await this.callBackendAPI(ENDPOINTS.TEMPLATE.DELETE(args.template_id), null, 'DELETE');
1015
+ const title = result.message || `Template ${args.template_id}`;
1016
+ return { content: [{ type: "text", text: `# 🗑️ Template Deleted\n\n${title}` }] };
1017
+ } catch (error) {
1018
+ throw new Error(`Failed to delete template: ${error.message}`);
1019
+ }
1020
+ }
1021
+
973
1022
  async handleGenerateAgentSop(args) {
974
1023
  if (!args.goal) throw new Error('goal is required');
975
1024
  const payload = { goal: args.goal };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-prompt-optimizer",
3
- "version": "3.1.3",
3
+ "version": "3.2.1",
4
4
  "description": "Professional cloud-based MCP server for AI-powered prompt optimization with intelligent context detection, Bayesian optimization, AG-UI real-time optimization, template auto-save, optimization insights, personal model configuration via WebUI, team collaboration, enterprise-grade features, production resilience, and startup validation. Universal compatibility with Claude Desktop, Cursor, Windsurf, and 17+ MCP clients.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -185,15 +185,24 @@
185
185
  }
186
186
  },
187
187
  "backend_alignment": {
188
- "version": "production-v2.2.0-stable",
188
+ "version": "production-v2.3.0",
189
189
  "api_version": "v1",
190
190
  "endpoints_aligned": true,
191
191
  "feature_parity": true,
192
192
  "bayesian_support": true,
193
193
  "agui_support": true,
194
- "last_sync": "2026-03-13T00:00:00Z"
194
+ "last_sync": "2026-05-19T00:00:00Z"
195
195
  },
196
196
  "release_notes": {
197
+ "v3.2.1": {
198
+ "major_features": [
199
+ "optimize_prompt now accepts value_hierarchy parameter for constraint-driven optimization",
200
+ "NON_NEGOTIABLE entries force LLM-tier routing and inject hard constraints into system prompt",
201
+ "HIGH/MEDIUM/LOW entries add ordered priority directives to optimization context"
202
+ ],
203
+ "breaking_changes": [],
204
+ "migration_guide": "No migration required. value_hierarchy is fully optional; existing calls are unaffected."
205
+ },
197
206
  "v3.0.5": {
198
207
  "major_features": [
199
208
  "Updated homepage and support links to promptoptimizer.xyz"