mcp-prompt-optimizer 3.7.2 → 3.7.3

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 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.7.3] - 2026-07-16
9
+
10
+ ### Fixed
11
+ - **Stale free-tier quota in README**: docs said 7 optimizations/month, live enforcement is 20. Docs-only fix, no code change.
12
+
8
13
  ## [3.7.2] - 2026-07-05
9
14
 
10
15
  ### Fixed
package/README.md CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
  **1. Get your API key:**
28
28
 
29
- - **🆓 Free Tier** (`sk-opt-*`): 7 LLM optimizations/month, 1 API key — no credit card required
29
+ - **🆓 Free Tier** (`sk-opt-*`): 20 LLM optimizations/month, 1 API key — no credit card required
30
30
  - **⭐ Pro** (`sk-opt-*`): 500 optimizations/month, full model config, Context Engineer
31
31
  - **🏢 Enterprise** (`sk-team-*`): Unlimited optimizations, team keys, shared quotas
32
32
 
@@ -352,7 +352,7 @@ Configure custom models in the WebUI and the MCP server uses them automatically.
352
352
 
353
353
  | Plan | Price | Optimizations/month | CE Credits | API Keys |
354
354
  |---|---|---|---|---|
355
- | 🆓 Free | $0 | 7 LLM | — | 1 |
355
+ | 🆓 Free | $0 | 20 LLM | — | 1 |
356
356
  | ⭐ Pro | $19/mo | 500 | 5 | 1 |
357
357
  | 🏢 Enterprise | Custom | Unlimited | 50 | 10 (shared) |
358
358
 
@@ -501,4 +501,4 @@ Windsurf, Cline, VS Code, Zed, Replit, JetBrains IDEs, and Neovim are all suppor
501
501
 
502
502
  ---
503
503
 
504
- *Start free at [promptoptimizer.xyz](https://promptoptimizer.xyz) — 7 LLM optimizations/month, no credit card required.*
504
+ *Start free at [promptoptimizer.xyz](https://promptoptimizer.xyz) — 20 LLM optimizations/month, no credit card required.*
package/index.js CHANGED
@@ -57,6 +57,18 @@ const ENDPOINTS = {
57
57
  /** AG‑UI status (GET) */
58
58
  AGUI_STATUS: '/api/status',
59
59
 
60
+ /** Prompt delivery by slug */
61
+ GET_PROMPT_BY_SLUG: (slug) => `/api/v1/prompts/${slug}`,
62
+ COMPILE_PROMPT: (slug) => `/api/v1/prompts/${slug}/compiled`,
63
+
64
+ /** Template governance (versioning, publish) */
65
+ TEMPLATE_VERSIONS: (id) => `/api/v1/templates/${id}/versions`,
66
+ ROLLBACK_TEMPLATE: (id, n) => `/api/v1/templates/${id}/rollback/${n}`,
67
+ PUBLISH_TEMPLATE: (id) => `/api/v1/templates/${id}/publish`,
68
+
69
+ /** Quick evaluation (stateless) */
70
+ QUICK_EVALUATE: '/api/v1/evaluations/quick-evaluate',
71
+
60
72
  /** Context Engineer (CE) endpoints */
61
73
  CE: {
62
74
  SOP: '/api/v1/context-engineer/sop',
@@ -73,7 +85,8 @@ const ENDPOINTS = {
73
85
  const DEPLOY_TARGET_ENUM = [
74
86
  "claude_code", "claude_desktop", "cursor", "copilot",
75
87
  "windsurf", "cline", "zed", "replit", "openai_agents", "ollama",
76
- "amazon_q", "aider", "continue_dev", "crewai"
88
+ "amazon_q", "aider", "continue_dev", "crewai",
89
+ "codex_cli",
77
90
  ];
78
91
 
79
92
  class MCPPromptOptimizer {
@@ -465,6 +478,79 @@ class MCPPromptOptimizer {
465
478
  additionalProperties: false
466
479
  }
467
480
  },
481
+ {
482
+ name: "get_prompt_by_slug",
483
+ description: "Fetch your latest published prompt template by slug for runtime use — decouple prompts from deploys.",
484
+ inputSchema: {
485
+ type: "object",
486
+ properties: {
487
+ slug: { type: "string", description: "The URL-safe slug of the prompt template (e.g., product-writer-a3f9c21b)" }
488
+ },
489
+ required: ["slug"]
490
+ }
491
+ },
492
+ {
493
+ name: "compile_prompt",
494
+ description: "Compile a prompt template with variable interpolation for runtime delivery — returns the fully interpolated prompt string ready for use.",
495
+ inputSchema: {
496
+ type: "object",
497
+ properties: {
498
+ slug: { type: "string", description: "The URL-safe slug of the prompt template" },
499
+ variables: {
500
+ type: "object",
501
+ description: "Variable values to interpolate (e.g. {\"user_name\": \"Alex\", \"plan\": \"Pro\"})",
502
+ additionalProperties: { type: "string" }
503
+ }
504
+ },
505
+ required: ["slug"]
506
+ }
507
+ },
508
+ {
509
+ name: "list_template_versions",
510
+ description: "List all version snapshots of a saved template — every update creates a snapshot you can inspect or restore.",
511
+ inputSchema: {
512
+ type: "object",
513
+ properties: {
514
+ template_id: { type: "string", description: "The ID of the template" }
515
+ },
516
+ required: ["template_id"]
517
+ }
518
+ },
519
+ {
520
+ name: "rollback_template",
521
+ description: "Restore a template to a previous version snapshot — undo unwanted changes instantly.",
522
+ inputSchema: {
523
+ type: "object",
524
+ properties: {
525
+ template_id: { type: "string", description: "The ID of the template" },
526
+ version_number: { type: "number", description: "The version number to roll back to (use list_template_versions to find available versions)" }
527
+ },
528
+ required: ["template_id", "version_number"]
529
+ }
530
+ },
531
+ {
532
+ name: "publish_template",
533
+ description: "Publish a template — makes it available for runtime delivery via get_prompt_by_slug.",
534
+ inputSchema: {
535
+ type: "object",
536
+ properties: {
537
+ template_id: { type: "string", description: "The ID of the template to publish" }
538
+ },
539
+ required: ["template_id"]
540
+ }
541
+ },
542
+ {
543
+ name: "run_quick_evaluation",
544
+ description: "Run a stateless one-shot evaluation of an optimized prompt using LLM judges — get actionable quality scoring without creating a dataset.",
545
+ inputSchema: {
546
+ type: "object",
547
+ properties: {
548
+ prompt: { type: "string", description: "The optimized prompt to evaluate" },
549
+ original_prompt: { type: "string", description: "The original prompt for comparison scoring" }
550
+ },
551
+ required: ["prompt", "original_prompt"]
552
+ }
553
+ },
468
554
  ];
469
555
 
470
556
  // Add advanced tools if Bayesian optimization is enabled
@@ -524,6 +610,12 @@ class MCPPromptOptimizer {
524
610
  case "get_ce_quota_status": return await this.handleGetCEQuotaStatus();
525
611
  case "generate_harness_bundle": return await this.handleGenerateHarnessBundle(args);
526
612
  case "explore_sop_approaches": return await this.handleExploreSopApproaches(args);
613
+ case "get_prompt_by_slug": return await this.handleGetPromptBySlug(args);
614
+ case "compile_prompt": return await this.handleCompilePrompt(args);
615
+ case "list_template_versions": return await this.handleListTemplateVersions(args);
616
+ case "rollback_template": return await this.handleRollbackTemplate(args);
617
+ case "publish_template": return await this.handlePublishTemplate(args);
618
+ case "run_quick_evaluation": return await this.handleRunQuickEvaluation(args);
527
619
  default: throw new Error(`Unknown tool: ${name}`);
528
620
  }
529
621
  } catch (error) {
@@ -1349,6 +1441,129 @@ class MCPPromptOptimizer {
1349
1441
  }
1350
1442
  }
1351
1443
 
1444
+ async handleGetPromptBySlug(args) {
1445
+ if (!args.slug) throw new Error('Slug is required');
1446
+ try {
1447
+ const result = await this.callBackendAPI(ENDPOINTS.GET_PROMPT_BY_SLUG(args.slug), null, 'GET');
1448
+ let output = `# 📦 Prompt by Slug: \`${args.slug}\`\n\n`;
1449
+ output += `**Title:** ${result.title || 'N/A'}\n`;
1450
+ output += `**Body:**\n\`\`\`\n${result.optimized_prompt || result.body || ''}\n\`\`\`\n`;
1451
+ return { content: [{ type: "text", text: output }] };
1452
+ } catch (error) {
1453
+ const msg = error.message || '';
1454
+ if (msg.includes('403') || msg.includes('TIER')) {
1455
+ return { content: [{ type: "text", text: `Upgrade required: runtime prompt delivery requires Pro tier or higher. Upgrade at /pricing.\n\nBackend error: ${msg}` }] };
1456
+ }
1457
+ throw new Error(`Failed to fetch prompt by slug: ${error.message}`);
1458
+ }
1459
+ }
1460
+
1461
+ async handleCompilePrompt(args) {
1462
+ if (!args.slug) throw new Error('Slug is required');
1463
+ try {
1464
+ const result = await this.callBackendAPI(ENDPOINTS.COMPILE_PROMPT(args.slug), { variables: args.variables || {} });
1465
+ const compiled = result.compiled_prompt || result.body || JSON.stringify(result, null, 2);
1466
+ return { content: [{ type: "text", text: `# Compiled Prompt\n\n\`\`\`\n${compiled}\n\`\`\`\n` }] };
1467
+ } catch (error) {
1468
+ const msg = error.message || '';
1469
+ if (msg.includes('403') || msg.includes('TIER')) {
1470
+ return { content: [{ type: "text", text: `Upgrade required: prompt compilation requires Pro tier or higher. Upgrade at /pricing.\n\nBackend error: ${msg}` }] };
1471
+ }
1472
+ throw new Error(`Failed to compile prompt: ${error.message}`);
1473
+ }
1474
+ }
1475
+
1476
+ async handleListTemplateVersions(args) {
1477
+ if (!args.template_id) throw new Error('Template ID is required');
1478
+ try {
1479
+ const result = await this.callBackendAPI(ENDPOINTS.TEMPLATE_VERSIONS(args.template_id), null, 'GET');
1480
+ const versions = result.versions || result.data || [];
1481
+ let output = `# 📋 Template Versions\n\n`;
1482
+ output += `**Template ID:** \`${args.template_id}\`\n\n`;
1483
+ if (versions.length === 0) {
1484
+ output += 'No version history found for this template.';
1485
+ } else {
1486
+ versions.forEach((v, i) => {
1487
+ output += `**${i + 1}.** Version ${v.version_number || 'N/A'}`;
1488
+ if (v.created_at) output += ` — ${v.created_at}`;
1489
+ if (v.change_summary) output += `\n _${v.change_summary}_`;
1490
+ output += `\n`;
1491
+ });
1492
+ output += `\nUse \`rollback_template\` with a version number to restore.`;
1493
+ }
1494
+ return { content: [{ type: "text", text: output }] };
1495
+ } catch (error) {
1496
+ const msg = error.message || '';
1497
+ if (msg.includes('403') || msg.includes('TIER')) {
1498
+ return { content: [{ type: "text", text: `Upgrade required: template versioning requires Pro tier or higher. Upgrade at /pricing.\n\nBackend error: ${msg}` }] };
1499
+ }
1500
+ throw new Error(`Failed to list template versions: ${error.message}`);
1501
+ }
1502
+ }
1503
+
1504
+ async handleRollbackTemplate(args) {
1505
+ if (!args.template_id) throw new Error('Template ID is required');
1506
+ if (args.version_number === undefined || args.version_number === null) throw new Error('version_number is required');
1507
+ try {
1508
+ const result = await this.callBackendAPI(ENDPOINTS.ROLLBACK_TEMPLATE(args.template_id, args.version_number), {});
1509
+ const msg = result.message || `Template rolled back to version ${args.version_number}`;
1510
+ return { content: [{ type: "text", text: `# ✅ Rollback Complete\n\n${msg}\n\n**Template ID:** \`${args.template_id}\`\n**Version:** ${args.version_number}` }] };
1511
+ } catch (error) {
1512
+ const msg = error.message || '';
1513
+ if (msg.includes('403') || msg.includes('TIER')) {
1514
+ return { content: [{ type: "text", text: `Upgrade required: template rollback requires Pro tier or higher. Upgrade at /pricing.\n\nBackend error: ${msg}` }] };
1515
+ }
1516
+ throw new Error(`Failed to rollback template: ${error.message}`);
1517
+ }
1518
+ }
1519
+
1520
+ async handlePublishTemplate(args) {
1521
+ if (!args.template_id) throw new Error('Template ID is required');
1522
+ try {
1523
+ const result = await this.callBackendAPI(ENDPOINTS.PUBLISH_TEMPLATE(args.template_id), {});
1524
+ const msg = result.message || `Template ${args.template_id} published successfully`;
1525
+ return { content: [{ type: "text", text: `# ✅ Template Published\n\n${msg}\n\nThe template is now available for runtime delivery via \`get_prompt_by_slug\`.` }] };
1526
+ } catch (error) {
1527
+ const msg = error.message || '';
1528
+ if (msg.includes('403') || msg.includes('TIER')) {
1529
+ return { content: [{ type: "text", text: `Upgrade required: template publishing requires Pro tier or higher. Upgrade at /pricing.\n\nBackend error: ${msg}` }] };
1530
+ }
1531
+ throw new Error(`Failed to publish template: ${error.message}`);
1532
+ }
1533
+ }
1534
+
1535
+ async handleRunQuickEvaluation(args) {
1536
+ if (!args.prompt) throw new Error('prompt is required');
1537
+ if (!args.original_prompt) throw new Error('original_prompt is required');
1538
+ try {
1539
+ const result = await this.callBackendAPI(ENDPOINTS.QUICK_EVALUATE, {
1540
+ prompt: args.prompt,
1541
+ original_prompt: args.original_prompt,
1542
+ assertions: [
1543
+ {
1544
+ type: "llm-rubric",
1545
+ value: "The optimized prompt is clearer, more specific, and better achieves the original intent than the input prompt.",
1546
+ weight: 1.0
1547
+ }
1548
+ ]
1549
+ });
1550
+ let output = `# 📊 Quick Evaluation Result\n\n`;
1551
+ output += `**Score:** ${result.overall_score != null ? (result.overall_score * 100).toFixed(1) + '%' : 'N/A'}\n`;
1552
+ output += `**Passed:** ${result.passed ? '✅ Yes' : '❌ No'}\n`;
1553
+ if (result.context_detected) output += `**Context:** ${result.context_detected}\n`;
1554
+ if (result.actionable_feedback && result.actionable_feedback.length) {
1555
+ output += `\n**Feedback:**\n${result.actionable_feedback.map(f => `- ${f}`).join('\n')}\n`;
1556
+ }
1557
+ return { content: [{ type: "text", text: output }] };
1558
+ } catch (error) {
1559
+ const msg = error.message || '';
1560
+ if (msg.includes('403') || msg.includes('TIER')) {
1561
+ return { content: [{ type: "text", text: `Upgrade required: evaluations require Pro tier or higher. Upgrade at /pricing.\n\nBackend error: ${msg}` }] };
1562
+ }
1563
+ throw new Error(`Failed to run quick evaluation: ${error.message}`);
1564
+ }
1565
+ }
1566
+
1352
1567
  _formatSkillPackage(result) {
1353
1568
  const sections = ['# Skill Package Generated'];
1354
1569
  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.7.2",
3
+ "version": "3.7.3",
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": {
@@ -195,6 +195,13 @@
195
195
  "last_sync": "2026-06-01T00:00:00Z"
196
196
  },
197
197
  "release_notes": {
198
+ "v3.7.3": {
199
+ "major_features": [
200
+ "Docs only: corrected stale free-tier quota in README (7 optimizations/month -> 20), matching the backend enforcement fix"
201
+ ],
202
+ "breaking_changes": [],
203
+ "migration_guide": "No migration required."
204
+ },
198
205
  "v3.7.2": {
199
206
  "major_features": [
200
207
  "MCP server startup logs (banner, status lines, mode indicators, key validation messages) now write to stderr so stdout stays a clean JSON-RPC channel for stdio MCP clients"