mcp-prompt-optimizer 3.3.0 → 3.4.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 (3) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/index.js +146 -10
  3. package/package.json +11 -2
package/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.4.0] - 2026-05-26
9
+
10
+ ### Added
11
+ - `explore_sop_approaches` tool: generates 3 parallel SOP variants (process-oriented, decision-tree, role-based) for comparison. Optionally accepts `blend_description` to blend variants directly into a single SOP. Innovator tier required.
12
+
8
13
  ## [3.1.3] - 2026-04-13
9
14
 
10
15
  ### Changed
package/index.js CHANGED
@@ -65,9 +65,17 @@ const ENDPOINTS = {
65
65
  TRANSFORM: '/api/v1/context-engineer/transform',
66
66
  QUOTA: '/api/v1/context-engineer/quota',
67
67
  HARNESS_BUNDLE: '/api/v1/context-engineer/harness-bundle',
68
+ SOP_EXPLORE: '/api/v1/context-engineer/sop-explore',
69
+ SOP_BLEND: '/api/v1/context-engineer/sop-blend',
68
70
  },
69
71
  };
70
72
 
73
+ const DEPLOY_TARGET_ENUM = [
74
+ "claude_code", "claude_desktop", "cursor", "copilot",
75
+ "windsurf", "cline", "zed", "replit", "openai_agents", "ollama",
76
+ "amazon_q", "aider", "continue_dev", "crewai"
77
+ ];
78
+
71
79
  class MCPPromptOptimizer {
72
80
  constructor() {
73
81
  this.server = new Server(
@@ -392,9 +400,27 @@ class MCPPromptOptimizer {
392
400
  description: "The workflow goal the harness is built for."
393
401
  },
394
402
  deploy_target: {
395
- type: "string",
396
- enum: ["claude_code", "claude_desktop", "cursor", "copilot", "windsurf", "cline", "zed", "replit", "openai_agents", "ollama"],
397
- description: "Target deployment platform. Default: claude_code."
403
+ oneOf: [
404
+ {
405
+ type: "string",
406
+ enum: DEPLOY_TARGET_ENUM,
407
+ description: "Single deploy target."
408
+ },
409
+ {
410
+ type: "array",
411
+ minItems: 1,
412
+ items: {
413
+ type: "string",
414
+ enum: DEPLOY_TARGET_ENUM
415
+ },
416
+ description: "Multiple deploy targets simultaneously (Creator+ required)."
417
+ }
418
+ ],
419
+ description: (
420
+ "Target deployment platform(s). Single string (Explorer+) or array (Creator+). "
421
+ + "amazon_q, aider, continue_dev, crewai require Creator+. "
422
+ + "Default: claude_code."
423
+ )
398
424
  },
399
425
  session_id: {
400
426
  type: "string",
@@ -408,6 +434,37 @@ class MCPPromptOptimizer {
408
434
  required: ["goal"]
409
435
  }
410
436
  },
437
+ {
438
+ name: "explore_sop_approaches",
439
+ description: (
440
+ "Generate 3 parallel SOP variants (process-oriented, decision-tree, role-based) for comparison before committing. " +
441
+ "Returns exploration_html (self-contained comparison grid), variants array, and a recommended variant. " +
442
+ "Innovator tier required. " +
443
+ "Optionally provide blend_description to skip comparison and receive a single blended SOP instead."
444
+ ),
445
+ inputSchema: {
446
+ type: "object",
447
+ properties: {
448
+ goal: {
449
+ type: "string",
450
+ description: "The workflow goal to generate SOP variants for"
451
+ },
452
+ context: {
453
+ type: "string",
454
+ description: "Optional background context or documentation excerpt"
455
+ },
456
+ blend_description: {
457
+ type: "string",
458
+ description: "Optional: if provided, skips variant comparison and blends all 3 into one SOP using this description"
459
+ },
460
+ perspective: { type: "string", description: "Agent role or viewpoint (IntentFrame)" },
461
+ out_of_scope: { type: "string", description: "What is explicitly excluded (IntentFrame)" },
462
+ success_definition: { type: "string", description: "Measurable success criteria (IntentFrame)" },
463
+ },
464
+ required: ["goal"],
465
+ additionalProperties: false
466
+ }
467
+ },
411
468
  ];
412
469
 
413
470
  // Add advanced tools if Bayesian optimization is enabled
@@ -466,6 +523,7 @@ class MCPPromptOptimizer {
466
523
  case "transform_for_framework": return await this.handleTransformForFramework(args);
467
524
  case "get_ce_quota_status": return await this.handleGetCEQuotaStatus();
468
525
  case "generate_harness_bundle": return await this.handleGenerateHarnessBundle(args);
526
+ case "explore_sop_approaches": return await this.handleExploreSopApproaches(args);
469
527
  default: throw new Error(`Unknown tool: ${name}`);
470
528
  }
471
529
  } catch (error) {
@@ -653,7 +711,7 @@ class MCPPromptOptimizer {
653
711
  const baseResult = {
654
712
  ...rulesResult,
655
713
  rules_based: false, // Show as normal optimized output in mock mode
656
- tier: 'explorer',
714
+ tier: 'free',
657
715
  mock_mode: true,
658
716
  template_saved: true,
659
717
  template_id: 'test-template-123',
@@ -1175,11 +1233,24 @@ class MCPPromptOptimizer {
1175
1233
  if (!args.sop_content && !args.session_id) {
1176
1234
  return { content: [{ type: "text", text: "Error: provide either sop_content or session_id." }] };
1177
1235
  }
1178
- const deployTarget = args.deploy_target || "claude_code";
1236
+ // Normalize deploy_target: string → [string], array → array, undefined → ["claude_code"]
1237
+ let deployTargets;
1238
+ if (!args.deploy_target) {
1239
+ deployTargets = ["claude_code"];
1240
+ } else if (Array.isArray(args.deploy_target)) {
1241
+ deployTargets = args.deploy_target;
1242
+ } else {
1243
+ deployTargets = [args.deploy_target];
1244
+ }
1245
+ // Guard: empty array falls back to default
1246
+ if (deployTargets.length === 0) {
1247
+ deployTargets = ["claude_code"];
1248
+ }
1249
+
1179
1250
  const payload = {
1180
1251
  goal: args.goal,
1181
- deploy_target: deployTarget,
1182
- platform: deployTarget,
1252
+ deploy_target: deployTargets.length === 1 ? deployTargets[0] : deployTargets,
1253
+ platform: deployTargets[0],
1183
1254
  user_goal: args.goal,
1184
1255
  sop_content: args.sop_content || "",
1185
1256
  };
@@ -1201,18 +1272,83 @@ class MCPPromptOptimizer {
1201
1272
  return {
1202
1273
  content: [{
1203
1274
  type: "text",
1204
- text: `# Harness Bundle Requested\n\nDeploy target: **${deployTarget}**\nGoal: ${args.goal}\n\nDownload from the CE dashboard or via the /harness-bundle API endpoint.`
1275
+ text: `# Harness Bundle Requested\n\nDeploy target: **${deployTargets.join(", ")}**\nGoal: ${args.goal}\n\nDownload from the CE dashboard or via the /harness-bundle API endpoint.`
1205
1276
  }]
1206
1277
  };
1207
1278
  } catch (error) {
1208
1279
  const msg = error?.message || String(error);
1209
1280
  if (msg.includes("TIER_LIMIT_REACHED")) {
1210
- return { content: [{ type: "text", text: `Upgrade required: Deploy target requires Explorer tier. Upgrade at /pricing.` }] };
1281
+ return { content: [{ type: "text",
1282
+ text: `Upgrade required: this deploy target requires Pro tier or higher. Upgrade at /pricing.`
1283
+ }] };
1211
1284
  }
1212
1285
  throw error;
1213
1286
  }
1214
1287
  }
1215
1288
 
1289
+ async handleExploreSopApproaches(args) {
1290
+ if (!args.goal) {
1291
+ return { content: [{ type: "text", text: "Error: goal is required." }] };
1292
+ }
1293
+
1294
+ // If blend_description provided, explore then blend in one call chain
1295
+ if (args.blend_description) {
1296
+ try {
1297
+ const explorePayload = {
1298
+ goal: args.goal,
1299
+ context: args.context || undefined,
1300
+ perspective: args.perspective || undefined,
1301
+ out_of_scope: args.out_of_scope || undefined,
1302
+ success_definition: args.success_definition || undefined,
1303
+ };
1304
+ const exploreResult = await this.callBackendAPI(ENDPOINTS.CE.SOP_EXPLORE, explorePayload);
1305
+ const blendPayload = {
1306
+ variants: exploreResult.variants,
1307
+ blend_description: args.blend_description,
1308
+ goal: args.goal,
1309
+ };
1310
+ const blendResult = await this.callBackendAPI(ENDPOINTS.CE.SOP_BLEND, blendPayload);
1311
+ return {
1312
+ content: [{
1313
+ type: "text",
1314
+ text: `# Blended SOP\n\n${blendResult.sop_content}`
1315
+ }]
1316
+ };
1317
+ } catch (error) {
1318
+ throw new Error(`Failed to blend SOP approaches: ${error.message}`);
1319
+ }
1320
+ }
1321
+
1322
+ // Standard exploration: return 3 variant summaries
1323
+ try {
1324
+ const payload = {
1325
+ goal: args.goal,
1326
+ context: args.context || undefined,
1327
+ perspective: args.perspective || undefined,
1328
+ out_of_scope: args.out_of_scope || undefined,
1329
+ success_definition: args.success_definition || undefined,
1330
+ };
1331
+ const result = await this.callBackendAPI(ENDPOINTS.CE.SOP_EXPLORE, payload);
1332
+
1333
+ const variantSummaries = result.variants.map(v => {
1334
+ const rec = v.id === result.recommended ? " *(Recommended)*" : "";
1335
+ return `## Variant ${v.id} — ${v.approach.replace('_', '-')}${rec}\n\n${v.content.slice(0, 600)}${v.content.length > 600 ? '\n\n...(truncated)' : ''}`;
1336
+ }).join('\n\n---\n\n');
1337
+
1338
+ return {
1339
+ content: [{
1340
+ type: "text",
1341
+ text: `# SOP Exploration Results\n\n**Goal:** ${args.goal}\n**Recommended:** Variant ${result.recommended}\n\n---\n\n${variantSummaries}\n\n---\n\n*To select a variant, call generate_skill_package with the full content of your chosen variant as sop_content. To blend variants, re-call explore_sop_approaches with blend_description.*`
1342
+ }]
1343
+ };
1344
+ } catch (error) {
1345
+ if (error.message && error.message.includes('403')) {
1346
+ return { content: [{ type: "text", text: "Error: SOP exploration requires Innovator tier. Upgrade at /pricing." }] };
1347
+ }
1348
+ throw new Error(`Failed to explore SOP approaches: ${error.message}`);
1349
+ }
1350
+ }
1351
+
1216
1352
  _formatSkillPackage(result) {
1217
1353
  const sections = ['# Skill Package Generated'];
1218
1354
  const artifacts = result.artifacts || result.steps || {};
@@ -1413,7 +1549,7 @@ class MCPPromptOptimizer {
1413
1549
  }
1414
1550
 
1415
1551
  formatQuotaStatus(result) {
1416
- let output = `# 📊 Account Status\n\n**Plan:** ${result.tier || 'explorer'}\n`;
1552
+ let output = `# 📊 Account Status\n\n**Plan:** ${result.tier || 'free'}\n`;
1417
1553
 
1418
1554
  const quota = result.quota || {};
1419
1555
  if (quota.unlimited) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-prompt-optimizer",
3
- "version": "3.3.0",
3
+ "version": "3.4.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": {
@@ -191,9 +191,18 @@
191
191
  "feature_parity": true,
192
192
  "bayesian_support": true,
193
193
  "agui_support": true,
194
- "last_sync": "2026-05-23T00:00:00Z"
194
+ "last_sync": "2026-06-01T00:00:00Z"
195
195
  },
196
196
  "release_notes": {
197
+ "v3.4.1": {
198
+ "major_features": [
199
+ "D6 pricing migration: tier names updated to free/pro/enterprise (was free_trial/explorer/creator/innovator)",
200
+ "Tier-limit error message simplified to 'Pro tier or higher' matching new backend tier model",
201
+ "Mock mode and account status display default to 'free' tier"
202
+ ],
203
+ "breaking_changes": [],
204
+ "migration_guide": "No migration required. Existing API keys and configurations remain valid."
205
+ },
197
206
  "v3.3.0": {
198
207
  "major_features": [
199
208
  "New tool: generate_harness_bundle — generate a deployment-ready Agentic Harness ZIP for 9 platforms (claude_code, claude_desktop, cursor, copilot, windsurf, cline, zed, replit, openai_agents)",