mcp-prompt-optimizer 3.0.1 → 3.0.2
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/index.js +21 -36
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -16,49 +16,44 @@ const CloudApiKeyManager = require('./lib/api-key-manager');
|
|
|
16
16
|
const packageJson = require('./package.json');
|
|
17
17
|
|
|
18
18
|
const API_KEYS_PREFIX = '/api/v1/api-keys';
|
|
19
|
+
const MCP_PREFIX = '/api/v1/mcp';
|
|
19
20
|
|
|
20
21
|
const ENDPOINTS = {
|
|
21
|
-
/** Detect AI context (POST)
|
|
22
|
-
DETECT_CONTEXT:
|
|
22
|
+
/** Detect AI context (POST) — MCP endpoint, API-key auth */
|
|
23
|
+
DETECT_CONTEXT: `${MCP_PREFIX}/detect-context`,
|
|
23
24
|
|
|
24
|
-
/** Prompt optimization (POST) */
|
|
25
|
-
OPTIMIZE:
|
|
25
|
+
/** Prompt optimization (POST) — MCP endpoint, API-key auth */
|
|
26
|
+
OPTIMIZE: `${MCP_PREFIX}/optimize`,
|
|
26
27
|
|
|
27
|
-
/** CRUD on templates */
|
|
28
|
+
/** CRUD on templates — MCP endpoints, API-key auth */
|
|
28
29
|
TEMPLATE: {
|
|
29
30
|
/** Create (POST) */
|
|
30
|
-
CREATE:
|
|
31
|
+
CREATE: `${MCP_PREFIX}/templates`,
|
|
31
32
|
|
|
32
33
|
/** Read (GET) */
|
|
33
|
-
GET: (id) =>
|
|
34
|
+
GET: (id) => `${MCP_PREFIX}/templates/${id}`,
|
|
34
35
|
|
|
35
36
|
/** Update (PATCH) */
|
|
36
|
-
UPDATE: (id) =>
|
|
37
|
+
UPDATE: (id) => `${MCP_PREFIX}/templates/${id}`,
|
|
37
38
|
|
|
38
39
|
/** Delete (DELETE) */
|
|
39
|
-
DELETE: (id) =>
|
|
40
|
+
DELETE: (id) => `${MCP_PREFIX}/templates/${id}`,
|
|
40
41
|
},
|
|
41
42
|
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
* (In the current code‑base this is *not* a dedicated `/search` path –
|
|
45
|
-
* the original implementation appends query‑params to `/api/v1/templates/`.
|
|
46
|
-
* We keep the original path here so that the existing `handleSearchTemplates`
|
|
47
|
-
* handler does not need any change other than using the constant.
|
|
48
|
-
*/
|
|
49
|
-
SEARCH_TEMPLATES: '/api/v1/templates/',
|
|
43
|
+
/** Search templates (GET) — MCP endpoint, API-key auth */
|
|
44
|
+
SEARCH_TEMPLATES: `${MCP_PREFIX}/templates`,
|
|
50
45
|
|
|
51
|
-
/** Quota status (GET)
|
|
52
|
-
QUOTA_STATUS: `${
|
|
46
|
+
/** Quota status (GET) — MCP endpoint, API-key auth */
|
|
47
|
+
QUOTA_STATUS: `${MCP_PREFIX}/quota-status`,
|
|
53
48
|
|
|
54
|
-
/** Validate API key (POST)
|
|
49
|
+
/** Validate API key (POST) — standard api-keys router */
|
|
55
50
|
VALIDATE_KEY: `${API_KEYS_PREFIX}/validate`,
|
|
56
51
|
|
|
57
52
|
/** Bayesian insights (GET) */
|
|
58
53
|
ANALYTICS_BAYESIAN_INSIGHTS:
|
|
59
54
|
'/api/v1/analytics/bayesian-insights',
|
|
60
55
|
|
|
61
|
-
/** AG‑UI status (GET)
|
|
56
|
+
/** AG‑UI status (GET) */
|
|
62
57
|
AGUI_STATUS: '/api/status',
|
|
63
58
|
};
|
|
64
59
|
|
|
@@ -422,25 +417,15 @@ class MCPPromptOptimizer {
|
|
|
422
417
|
}
|
|
423
418
|
|
|
424
419
|
// 2. Call the main optimization endpoint
|
|
425
|
-
const
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
context: {
|
|
430
|
-
ai_context: detectedContext
|
|
431
|
-
},
|
|
432
|
-
enable_bayesian: enableBayesian,
|
|
433
|
-
metadata: {
|
|
434
|
-
mcp_version: packageJson.version,
|
|
435
|
-
feature_flags: {
|
|
436
|
-
bayesian_optimization: this.bayesianOptimizationEnabled,
|
|
437
|
-
agui_features: this.aguiFeatures
|
|
438
|
-
}
|
|
439
|
-
}
|
|
420
|
+
const optimizationPayload = {
|
|
421
|
+
prompt: args.prompt,
|
|
422
|
+
goals: args.goals || ['clarity'],
|
|
423
|
+
ai_context: detectedContext,
|
|
440
424
|
};
|
|
441
425
|
|
|
442
426
|
const result = await this.callBackendAPI(ENDPOINTS.OPTIMIZE, optimizationPayload);
|
|
443
427
|
|
|
428
|
+
const enableBayesian = args.enable_bayesian !== false && this.bayesianOptimizationEnabled;
|
|
444
429
|
return { content: [{ type: "text", text: this.formatOptimizationResult(result, { detectedContext, enableBayesian }) }] };
|
|
445
430
|
|
|
446
431
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-prompt-optimizer",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
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": {
|