mcp-prompt-optimizer 3.3.0 → 3.4.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/index.js +150 -8
  3. package/package.json +1 -1
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) {
@@ -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,89 @@ 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
+ const CREATOR_ONLY = ["amazon_q", "aider", "continue_dev", "crewai"];
1282
+ const needsCreator =
1283
+ msg.includes("creator") ||
1284
+ deployTargets.length > 1 ||
1285
+ CREATOR_ONLY.some(t => deployTargets.includes(t));
1286
+ const tierNeeded = needsCreator ? "Creator" : "Explorer";
1287
+ return { content: [{ type: "text",
1288
+ text: `Upgrade required: this deploy target requires ${tierNeeded} tier or higher. Upgrade at /pricing.`
1289
+ }] };
1211
1290
  }
1212
1291
  throw error;
1213
1292
  }
1214
1293
  }
1215
1294
 
1295
+ async handleExploreSopApproaches(args) {
1296
+ if (!args.goal) {
1297
+ return { content: [{ type: "text", text: "Error: goal is required." }] };
1298
+ }
1299
+
1300
+ // If blend_description provided, explore then blend in one call chain
1301
+ if (args.blend_description) {
1302
+ try {
1303
+ const explorePayload = {
1304
+ goal: args.goal,
1305
+ context: args.context || undefined,
1306
+ perspective: args.perspective || undefined,
1307
+ out_of_scope: args.out_of_scope || undefined,
1308
+ success_definition: args.success_definition || undefined,
1309
+ };
1310
+ const exploreResult = await this.callBackendAPI(ENDPOINTS.CE.SOP_EXPLORE, explorePayload);
1311
+ const blendPayload = {
1312
+ variants: exploreResult.variants,
1313
+ blend_description: args.blend_description,
1314
+ goal: args.goal,
1315
+ };
1316
+ const blendResult = await this.callBackendAPI(ENDPOINTS.CE.SOP_BLEND, blendPayload);
1317
+ return {
1318
+ content: [{
1319
+ type: "text",
1320
+ text: `# Blended SOP\n\n${blendResult.sop_content}`
1321
+ }]
1322
+ };
1323
+ } catch (error) {
1324
+ throw new Error(`Failed to blend SOP approaches: ${error.message}`);
1325
+ }
1326
+ }
1327
+
1328
+ // Standard exploration: return 3 variant summaries
1329
+ try {
1330
+ const payload = {
1331
+ goal: args.goal,
1332
+ context: args.context || undefined,
1333
+ perspective: args.perspective || undefined,
1334
+ out_of_scope: args.out_of_scope || undefined,
1335
+ success_definition: args.success_definition || undefined,
1336
+ };
1337
+ const result = await this.callBackendAPI(ENDPOINTS.CE.SOP_EXPLORE, payload);
1338
+
1339
+ const variantSummaries = result.variants.map(v => {
1340
+ const rec = v.id === result.recommended ? " *(Recommended)*" : "";
1341
+ return `## Variant ${v.id} — ${v.approach.replace('_', '-')}${rec}\n\n${v.content.slice(0, 600)}${v.content.length > 600 ? '\n\n...(truncated)' : ''}`;
1342
+ }).join('\n\n---\n\n');
1343
+
1344
+ return {
1345
+ content: [{
1346
+ type: "text",
1347
+ 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.*`
1348
+ }]
1349
+ };
1350
+ } catch (error) {
1351
+ if (error.message && error.message.includes('403')) {
1352
+ return { content: [{ type: "text", text: "Error: SOP exploration requires Innovator tier. Upgrade at /pricing." }] };
1353
+ }
1354
+ throw new Error(`Failed to explore SOP approaches: ${error.message}`);
1355
+ }
1356
+ }
1357
+
1216
1358
  _formatSkillPackage(result) {
1217
1359
  const sections = ['# Skill Package Generated'];
1218
1360
  const artifacts = result.artifacts || result.steps || {};
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.0",
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": {