mcp-prompt-optimizer 3.0.5 → 3.1.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 +6 -0
- package/README.md +55 -8
- package/index.js +159 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ 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.1.1] - 2026-04-10
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- 💰 **Pricing Alignment**: Updated README to reflect current subscription tiers and optimization quotas.
|
|
12
|
+
- 📦 **Version Bump**: Incremented version to v3.1.1 to resolve npm publishing conflict with existing v3.1.0 on the registry.
|
|
13
|
+
|
|
8
14
|
## [3.0.1] - 2025-12-09
|
|
9
15
|
|
|
10
16
|
### Fixed
|
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
# MCP Prompt Optimizer v3.
|
|
1
|
+
# MCP Prompt Optimizer v3.1.1
|
|
2
|
+
|
|
3
|
+
🚀 **Professional cloud-based MCP server** for AI-powered prompt optimization with intelligent context detection, template management, team collaboration, and enterprise-grade reliability. Starting at $0/month.
|
|
2
4
|
|
|
3
|
-
🚀 **Professional cloud-based MCP server** for AI-powered prompt optimization with intelligent context detection, template management, team collaboration, and enterprise-grade reliability. Starting at $2.99/month.
|
|
4
5
|
|
|
5
6
|
## ✨ Key Features
|
|
6
7
|
|
|
@@ -120,7 +121,7 @@ To address this effectively:
|
|
|
120
121
|
|
|
121
122
|
## 🧠 AI Context Detection
|
|
122
123
|
|
|
123
|
-
The server automatically detects your prompt type and routes it to the appropriate optimization template.
|
|
124
|
+
The server automatically detects your prompt type and routes it to the appropriate optimization template.
|
|
124
125
|
|
|
125
126
|
| Context | `ai_context` value | Example patterns |
|
|
126
127
|
|---|---|---|
|
|
@@ -133,6 +134,11 @@ The server automatically detects your prompt type and routes it to the appropria
|
|
|
133
134
|
| Creative writing | `creative_writing` | `story`, `poem`, `script`, `blog`, `copywriting` |
|
|
134
135
|
| Email & communication | `human_communication` | `email`, `letter`, `memo`, `formal`, `reply` |
|
|
135
136
|
| Image generation | `image_generation` | `photorealistic`, `midjourney`, `dall-e`, `portrait` |
|
|
137
|
+
| Business & Strategy | `business_strategy` | `market analysis`, `swot`, `business plan` |
|
|
138
|
+
| Technical Strategy | `technical_strategy` | `architecture`, `system design`, `migration plan` |
|
|
139
|
+
| Legal & Compliance | `legal_compliance` | `contract`, `gdpr`, `terms of service`, `audit` |
|
|
140
|
+
| Medical & Health | `medical_healthcare` | `clinical`, `diagnosis`, `treatment`, `hipaa` |
|
|
141
|
+
| Education | `educational_content` | `lesson plan`, `syllabus`, `curriculum`, `quiz` |
|
|
136
142
|
| General | `general_assistant` | Everything else |
|
|
137
143
|
|
|
138
144
|
### Image Generation
|
|
@@ -232,6 +238,47 @@ Real-time optimization status and AG-UI capabilities. Requires the feature to be
|
|
|
232
238
|
|
|
233
239
|
---
|
|
234
240
|
|
|
241
|
+
## 🤖 Context Engineer (CE) Tools
|
|
242
|
+
|
|
243
|
+
Requires a Creator or Innovator subscription. CE tools generate agentic scaffolding artifacts (SOPs, skill packages, framework code) directly in your IDE.
|
|
244
|
+
|
|
245
|
+
### `generate_agent_sop`
|
|
246
|
+
Generate a structured SOP document for an AI agent from a goal description. Returns markdown SOP ready for use.
|
|
247
|
+
```json
|
|
248
|
+
{
|
|
249
|
+
"goal": "What the agent should accomplish",
|
|
250
|
+
"context": "Additional context, constraints, or domain info (optional)",
|
|
251
|
+
"model_id": "Model to use (optional)"
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### `generate_skill_package`
|
|
256
|
+
Generate a complete skill package (SOP + SKILL.md + reference + examples + helper.py) for a given agent goal. Takes 30–90 seconds (async with polling).
|
|
257
|
+
```json
|
|
258
|
+
{
|
|
259
|
+
"goal": "What the agent should accomplish",
|
|
260
|
+
"format": "knowledge_doc",
|
|
261
|
+
"model_id": "Model to use (optional)"
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
`format` is one of `knowledge_doc` (default) or `agent_spec`.
|
|
265
|
+
|
|
266
|
+
### `transform_for_framework`
|
|
267
|
+
Transform a SOP into native code for your agent framework: LangChain tool, AutoGen agent, or Claude Code skill.
|
|
268
|
+
```json
|
|
269
|
+
{
|
|
270
|
+
"sop_content": "The SOP markdown content",
|
|
271
|
+
"goal": "What the agent should accomplish",
|
|
272
|
+
"framework": "langchain_tool"
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
`framework` is one of `langchain_tool`, `autogen_agent`, or `claude_skill`.
|
|
276
|
+
|
|
277
|
+
### `get_ce_quota_status`
|
|
278
|
+
Check your Context Engineer credit balance and what workflows are available at your tier. No parameters required.
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
235
282
|
## 🎛️ Advanced Model Configuration (Optional)
|
|
236
283
|
|
|
237
284
|
Configure custom models in the WebUI and the MCP server uses them automatically.
|
|
@@ -267,11 +314,11 @@ Configure custom models in the WebUI and the MCP server uses them automatically.
|
|
|
267
314
|
|
|
268
315
|
## 💰 Subscription Plans
|
|
269
316
|
|
|
270
|
-
| Plan | Price | Optimizations/month | Team members |
|
|
271
|
-
|
|
272
|
-
| 🎯 Explorer | $2.99/mo | 5
|
|
273
|
-
| 🎨 Creator | $
|
|
274
|
-
| 🚀 Innovator | $
|
|
317
|
+
| Plan | Price | Optimizations/month | CE Credits | Team members |
|
|
318
|
+
|---|---|---|---|---|
|
|
319
|
+
| 🎯 Explorer | $2.99/mo | 20 | 5 | 1 |
|
|
320
|
+
| 🎨 Creator | $29/mo | 18,000 | 30 | 2 + 1 key |
|
|
321
|
+
| 🚀 Innovator | $99/mo | 75,000 | Unlimited | 5 + 10 keys |
|
|
275
322
|
|
|
276
323
|
🆓 **Free trial:** 5 optimizations with full feature access.
|
|
277
324
|
|
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.0
|
|
8
|
+
* Version: 3.1.0 - CE tools: generate_agent_sop, generate_skill_package, transform_for_framework, get_ce_quota_status
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
const { Server } = require('@modelcontextprotocol/sdk/server/index.js');
|
|
@@ -53,6 +53,15 @@ const ENDPOINTS = {
|
|
|
53
53
|
|
|
54
54
|
/** AG‑UI status (GET) */
|
|
55
55
|
AGUI_STATUS: '/api/status',
|
|
56
|
+
|
|
57
|
+
/** Context Engineer (CE) endpoints */
|
|
58
|
+
CE: {
|
|
59
|
+
SOP: '/api/v1/context-engineer/sop',
|
|
60
|
+
GENERATE_SKILL_PACKAGE: '/api/v1/context-engineer/generate-skill-package',
|
|
61
|
+
SESSION: (id) => `/api/v1/context-engineer/sessions/${id}`,
|
|
62
|
+
TRANSFORM: '/api/v1/context-engineer/transform',
|
|
63
|
+
QUOTA: '/api/v1/context-engineer/quota',
|
|
64
|
+
},
|
|
56
65
|
};
|
|
57
66
|
|
|
58
67
|
class MCPPromptOptimizer {
|
|
@@ -105,7 +114,9 @@ class MCPPromptOptimizer {
|
|
|
105
114
|
type: "string",
|
|
106
115
|
enum: [
|
|
107
116
|
"human_communication", "llm_interaction", "image_generation", "technical_automation",
|
|
108
|
-
"structured_output", "code_generation", "api_automation"
|
|
117
|
+
"structured_output", "code_generation", "api_automation", "data_analysis",
|
|
118
|
+
"creative_writing", "business_strategy", "technical_strategy", "academic_research",
|
|
119
|
+
"legal_compliance", "medical_healthcare", "educational_content"
|
|
109
120
|
],
|
|
110
121
|
description: "The context for the AI's task (auto-detected if not specified with enhanced detection)"
|
|
111
122
|
},
|
|
@@ -259,6 +270,50 @@ class MCPPromptOptimizer {
|
|
|
259
270
|
required: ["prompt"]
|
|
260
271
|
}
|
|
261
272
|
},
|
|
273
|
+
{
|
|
274
|
+
name: "generate_agent_sop",
|
|
275
|
+
description: "Generate a structured SOP document for an AI agent from a goal description.",
|
|
276
|
+
inputSchema: {
|
|
277
|
+
type: "object",
|
|
278
|
+
properties: {
|
|
279
|
+
goal: { type: "string", description: "What the agent should accomplish" },
|
|
280
|
+
context: { type: "string", description: "Additional context (optional)" },
|
|
281
|
+
model_id: { type: "string", description: "Model to use (optional)" }
|
|
282
|
+
},
|
|
283
|
+
required: ["goal"]
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
name: "generate_skill_package",
|
|
288
|
+
description: "Generate a complete skill package (SOP + SKILL.md + examples + helper.py) for an AI agent. Takes 30-120 seconds (async).",
|
|
289
|
+
inputSchema: {
|
|
290
|
+
type: "object",
|
|
291
|
+
properties: {
|
|
292
|
+
goal: { type: "string", description: "What the agent should accomplish" },
|
|
293
|
+
format: { type: "string", enum: ["knowledge_doc", "agent_spec"], description: "Output format" },
|
|
294
|
+
model_id: { type: "string", description: "Model to use (optional)" }
|
|
295
|
+
},
|
|
296
|
+
required: ["goal"]
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
name: "transform_for_framework",
|
|
301
|
+
description: "Transform a SOP into native code for LangChain, AutoGen, or Claude Code.",
|
|
302
|
+
inputSchema: {
|
|
303
|
+
type: "object",
|
|
304
|
+
properties: {
|
|
305
|
+
sop_content: { type: "string", description: "SOP content to transform" },
|
|
306
|
+
goal: { type: "string", description: "What the agent should accomplish" },
|
|
307
|
+
framework: { type: "string", enum: ["langchain_tool", "autogen_agent", "claude_skill"], description: "Target framework" }
|
|
308
|
+
},
|
|
309
|
+
required: ["sop_content", "goal", "framework"]
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
name: "get_ce_quota_status",
|
|
314
|
+
description: "Check your Context Engineer credit balance and available workflow types.",
|
|
315
|
+
inputSchema: { type: "object", properties: {}, additionalProperties: false }
|
|
316
|
+
},
|
|
262
317
|
];
|
|
263
318
|
|
|
264
319
|
// Add advanced tools if Bayesian optimization is enabled
|
|
@@ -311,6 +366,10 @@ class MCPPromptOptimizer {
|
|
|
311
366
|
case "update_template": return await this.handleUpdateTemplate(args);
|
|
312
367
|
case "get_optimization_insights": return await this.handleGetOptimizationInsights(args);
|
|
313
368
|
case "get_real_time_status": return await this.handleGetRealTimeStatus();
|
|
369
|
+
case "generate_agent_sop": return await this.handleGenerateAgentSop(args);
|
|
370
|
+
case "generate_skill_package": return await this.handleGenerateSkillPackage(args);
|
|
371
|
+
case "transform_for_framework": return await this.handleTransformForFramework(args);
|
|
372
|
+
case "get_ce_quota_status": return await this.handleGetCEQuotaStatus();
|
|
314
373
|
default: throw new Error(`Unknown tool: ${name}`);
|
|
315
374
|
}
|
|
316
375
|
} catch (error) {
|
|
@@ -899,7 +958,7 @@ class MCPPromptOptimizer {
|
|
|
899
958
|
const { template_id, ...updateData } = args;
|
|
900
959
|
// Filter out undefined values so we only send fields that are being updated
|
|
901
960
|
Object.keys(updateData).forEach(key => updateData[key] === undefined && delete updateData[key]);
|
|
902
|
-
|
|
961
|
+
|
|
903
962
|
const result = await this.callBackendAPI(ENDPOINTS.TEMPLATE.UPDATE(template_id), updateData, 'PATCH'); // PATCH is better for partial updates
|
|
904
963
|
let output = `# ✅ Template Updated Successfully!\n\n`;
|
|
905
964
|
output += `**ID:** \`${result.id}\`\n`;
|
|
@@ -911,7 +970,103 @@ class MCPPromptOptimizer {
|
|
|
911
970
|
}
|
|
912
971
|
}
|
|
913
972
|
|
|
914
|
-
async
|
|
973
|
+
async handleGenerateAgentSop(args) {
|
|
974
|
+
if (!args.goal) throw new Error('goal is required');
|
|
975
|
+
const payload = { goal: args.goal };
|
|
976
|
+
if (args.context) payload.context = args.context;
|
|
977
|
+
if (args.model_id) payload.model_id = args.model_id;
|
|
978
|
+
try {
|
|
979
|
+
const result = await this.callBackendAPI(ENDPOINTS.CE.SOP, payload);
|
|
980
|
+
const sopContent = result.sop || result.content || result.result || JSON.stringify(result, null, 2);
|
|
981
|
+
return { content: [{ type: "text", text: `# Agent SOP Generated\n\n${sopContent}\n\n---\n*Generated by MCP Prompt Optimizer CE*` }] };
|
|
982
|
+
} catch (error) {
|
|
983
|
+
throw new Error(`Failed to generate SOP: ${error.message}`);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
async handleGenerateSkillPackage(args) {
|
|
988
|
+
if (!args.goal) throw new Error('goal is required');
|
|
989
|
+
const payload = { goal: args.goal, format: args.format || 'knowledge_doc' };
|
|
990
|
+
if (args.model_id) payload.model_id = args.model_id;
|
|
991
|
+
let workflowError = null;
|
|
992
|
+
try {
|
|
993
|
+
const startResult = await this.callBackendAPI(ENDPOINTS.CE.GENERATE_SKILL_PACKAGE, payload);
|
|
994
|
+
const sessionId = startResult.session_id;
|
|
995
|
+
if (!sessionId) {
|
|
996
|
+
return { content: [{ type: "text", text: this._formatSkillPackage(startResult) }] };
|
|
997
|
+
}
|
|
998
|
+
for (let i = 0; i < 24; i++) {
|
|
999
|
+
await new Promise(resolve => setTimeout(resolve, 5000));
|
|
1000
|
+
const status = await this.callBackendAPI(ENDPOINTS.CE.SESSION(sessionId), null, 'GET');
|
|
1001
|
+
const state = status.workflow_state || status.current_state;
|
|
1002
|
+
if (state === 'complete') return { content: [{ type: "text", text: this._formatSkillPackage(status) }] };
|
|
1003
|
+
if (state === 'failed') {
|
|
1004
|
+
workflowError = new Error(`Generation failed: ${status.error || 'Unknown error'}`);
|
|
1005
|
+
throw workflowError;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
workflowError = new Error(`Timed out after 120s. Session ID: ${sessionId}`);
|
|
1009
|
+
throw workflowError;
|
|
1010
|
+
} catch (error) {
|
|
1011
|
+
if (error === workflowError) throw error;
|
|
1012
|
+
throw new Error(`Failed to generate skill package: ${error.message}`);
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
async handleTransformForFramework(args) {
|
|
1017
|
+
if (!args.sop_content) throw new Error('sop_content is required');
|
|
1018
|
+
if (!args.goal) throw new Error('goal is required');
|
|
1019
|
+
if (!args.framework) throw new Error('framework is required');
|
|
1020
|
+
const valid = ['langchain_tool', 'autogen_agent', 'claude_skill'];
|
|
1021
|
+
if (!valid.includes(args.framework)) throw new Error(`framework must be one of: ${valid.join(', ')}`);
|
|
1022
|
+
try {
|
|
1023
|
+
const result = await this.callBackendAPI(ENDPOINTS.CE.TRANSFORM, {
|
|
1024
|
+
sop_content: args.sop_content, goal: args.goal, framework: args.framework
|
|
1025
|
+
});
|
|
1026
|
+
const code = result.code || result.content || result.result || JSON.stringify(result, null, 2);
|
|
1027
|
+
return { content: [{ type: "text", text: `# ${args.framework} Implementation\n\n\`\`\`python\n${code}\n\`\`\`\n\n---\n*Transformed by MCP Prompt Optimizer CE*` }] };
|
|
1028
|
+
} catch (error) {
|
|
1029
|
+
throw new Error(`Failed to transform: ${error.message}`);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
async handleGetCEQuotaStatus() {
|
|
1034
|
+
try {
|
|
1035
|
+
const result = await this.callBackendAPI(ENDPOINTS.CE.QUOTA, null, 'GET');
|
|
1036
|
+
const lines = ['## CE Credit Balance', ''];
|
|
1037
|
+
if (result.is_unlimited) {
|
|
1038
|
+
lines.push(`Credits: **Unlimited** (${result.credits_used || 0} used this period)`);
|
|
1039
|
+
} else {
|
|
1040
|
+
lines.push(`Credits: **${result.credits_remaining ?? 'N/A'}** of ${result.credits_limit} remaining (${result.credits_used || 0} used)`);
|
|
1041
|
+
}
|
|
1042
|
+
lines.push('', '## Available Workflows');
|
|
1043
|
+
if (result.workflow_availability) {
|
|
1044
|
+
for (const [type, info] of Object.entries(result.workflow_availability)) {
|
|
1045
|
+
lines.push(`- ${info.available ? '✓' : '✗'} ${type}: ${info.cost_credits} credit(s)`);
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
if (result.message) lines.push('', result.message);
|
|
1049
|
+
return { content: [{ type: "text", text: lines.join('\n') }] };
|
|
1050
|
+
} catch (error) {
|
|
1051
|
+
throw new Error(`Failed to get CE quota: ${error.message}`);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
_formatSkillPackage(result) {
|
|
1056
|
+
const sections = ['# Skill Package Generated'];
|
|
1057
|
+
const artifacts = result.artifacts || result.steps || {};
|
|
1058
|
+
if (typeof artifacts === 'object' && Object.keys(artifacts).length > 0) {
|
|
1059
|
+
for (const [key, value] of Object.entries(artifacts)) {
|
|
1060
|
+
if (value && typeof value === 'string') sections.push(`\n## ${key}\n\n${value}`);
|
|
1061
|
+
}
|
|
1062
|
+
} else {
|
|
1063
|
+
sections.push('\n```json\n' + JSON.stringify(result, null, 2) + '\n```');
|
|
1064
|
+
}
|
|
1065
|
+
sections.push('\n---\n*Generated by MCP Prompt Optimizer CE*');
|
|
1066
|
+
return sections.join('\n');
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
_buildUrl(path) {
|
|
915
1070
|
return `${this.backendUrl}${path}`;
|
|
916
1071
|
}
|
|
917
1072
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-prompt-optimizer",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.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": {
|