mcp-prompt-optimizer 3.4.1 ā 3.5.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.
- package/index.js +92 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1454,9 +1454,8 @@ class MCPPromptOptimizer {
|
|
|
1454
1454
|
let output;
|
|
1455
1455
|
if (result.rules_based) {
|
|
1456
1456
|
if (result.fallback_mode) {
|
|
1457
|
-
output = `# š§
|
|
1458
|
-
output +=
|
|
1459
|
-
output += `Re-run when the backend is available for full LLM optimization.*\n\n`;
|
|
1457
|
+
output = `# š§ Prompt Optimized (Local Rules)\n\n`;
|
|
1458
|
+
output += `*Optimized using local rule templates ā LLM quality available once you connect your API key.*\n\n`;
|
|
1460
1459
|
} else {
|
|
1461
1460
|
output = `# š§ Rules-Based Optimization Applied\n\n`;
|
|
1462
1461
|
output += `*API key not validated ā optimized using local rule templates. `;
|
|
@@ -1542,9 +1541,21 @@ class MCPPromptOptimizer {
|
|
|
1542
1541
|
}
|
|
1543
1542
|
|
|
1544
1543
|
if (!result.fallback_mode) {
|
|
1545
|
-
output += `\nš **Quick Actions**\n- Dashboard: https://promptoptimizer
|
|
1544
|
+
output += `\nš **Quick Actions**\n- Dashboard: https://promptoptimizer.xyz/dashboard\n- Analytics: https://promptoptimizer.xyz/analytics\n`;
|
|
1545
|
+
} else {
|
|
1546
|
+
const confPct = Math.round((result.confidence_score || 0) * 100);
|
|
1547
|
+
output += `\n---\n`;
|
|
1548
|
+
output += `\nš” **Unlock LLM Optimization ā Free**\n\n`;
|
|
1549
|
+
output += `Local rules reached **${confPct}% confidence**. LLM optimization typically achieves **70ā95%** ā `;
|
|
1550
|
+
output += `more specific, context-aware, and effective for your actual intent.\n\n`;
|
|
1551
|
+
output += `**Get started free** (no credit card):\n`;
|
|
1552
|
+
output += `1. Sign up at https://promptoptimizer.xyz\n`;
|
|
1553
|
+
output += `2. Generate your API key at https://promptoptimizer.xyz/dashboard\n`;
|
|
1554
|
+
output += `3. Run in your terminal:\n\n`;
|
|
1555
|
+
output += `\`\`\`\nnpx mcp-prompt-optimizer connect\n\`\`\`\n\n`;
|
|
1556
|
+
output += `You get **7 LLM optimizations/month free**. Upgrade anytime for more.\n`;
|
|
1546
1557
|
}
|
|
1547
|
-
|
|
1558
|
+
|
|
1548
1559
|
return output;
|
|
1549
1560
|
}
|
|
1550
1561
|
|
|
@@ -1788,8 +1799,83 @@ async function startValidatedMCPServer() {
|
|
|
1788
1799
|
}
|
|
1789
1800
|
}
|
|
1790
1801
|
|
|
1802
|
+
async function runConnectWizard() {
|
|
1803
|
+
const readline = require('readline');
|
|
1804
|
+
const fs = require('fs');
|
|
1805
|
+
const path = require('path');
|
|
1806
|
+
const os = require('os');
|
|
1807
|
+
|
|
1808
|
+
const configPaths = {
|
|
1809
|
+
win32: path.join(os.homedir(), 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json'),
|
|
1810
|
+
darwin: path.join(os.homedir(), 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json'),
|
|
1811
|
+
linux: path.join(os.homedir(), '.config', 'Claude', 'claude_desktop_config.json'),
|
|
1812
|
+
};
|
|
1813
|
+
const configPath = configPaths[process.platform] || configPaths.linux;
|
|
1814
|
+
|
|
1815
|
+
console.log('\nš Prompt Optimizer ā Connect Wizard\n');
|
|
1816
|
+
|
|
1817
|
+
if (!fs.existsSync(configPath)) {
|
|
1818
|
+
console.log('ā Claude Desktop config not found at:');
|
|
1819
|
+
console.log(` ${configPath}`);
|
|
1820
|
+
console.log('\nOpen Claude Desktop first to create the config file, then re-run this command.');
|
|
1821
|
+
process.exit(1);
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
let config;
|
|
1825
|
+
try {
|
|
1826
|
+
config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
1827
|
+
} catch (e) {
|
|
1828
|
+
console.log(`ā Could not read config: ${e.message}`);
|
|
1829
|
+
process.exit(1);
|
|
1830
|
+
}
|
|
1831
|
+
if (!config.mcpServers) config.mcpServers = {};
|
|
1832
|
+
|
|
1833
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
1834
|
+
rl.question('Paste your API key (get one free at https://promptoptimizer.xyz/dashboard): ', (apiKey) => {
|
|
1835
|
+
rl.close();
|
|
1836
|
+
apiKey = (apiKey || '').trim();
|
|
1837
|
+
|
|
1838
|
+
if (!apiKey.startsWith('sk-')) {
|
|
1839
|
+
console.log('\nā Invalid key ā must start with "sk-". Get one at https://promptoptimizer.xyz/dashboard');
|
|
1840
|
+
process.exit(1);
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
const serverName = 'mcp-prompt-optimizer';
|
|
1844
|
+
if (config.mcpServers[serverName]) {
|
|
1845
|
+
if (!config.mcpServers[serverName].env) config.mcpServers[serverName].env = {};
|
|
1846
|
+
config.mcpServers[serverName].env.OPTIMIZER_API_KEY = apiKey;
|
|
1847
|
+
console.log(`\nā
Updated "${serverName}" entry with your API key.`);
|
|
1848
|
+
} else {
|
|
1849
|
+
config.mcpServers[serverName] = {
|
|
1850
|
+
command: 'npx',
|
|
1851
|
+
args: ['-y', 'mcp-prompt-optimizer'],
|
|
1852
|
+
env: { OPTIMIZER_API_KEY: apiKey },
|
|
1853
|
+
};
|
|
1854
|
+
console.log(`\nā
Added "${serverName}" to Claude Desktop config.`);
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
try {
|
|
1858
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf8');
|
|
1859
|
+
} catch (e) {
|
|
1860
|
+
console.log(`\nā Could not write config: ${e.message}`);
|
|
1861
|
+
console.log('Try running as administrator, or edit the file manually.');
|
|
1862
|
+
process.exit(1);
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
console.log(` Config: ${configPath}`);
|
|
1866
|
+
console.log('\nš Restart Claude Desktop to activate LLM optimization.');
|
|
1867
|
+
console.log(' Free plan: 7 LLM optimizations/month.');
|
|
1868
|
+
console.log(' Upgrade at https://promptoptimizer.xyz/pricing\n');
|
|
1869
|
+
});
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1791
1872
|
if (require.main === module) {
|
|
1792
|
-
|
|
1873
|
+
const args = process.argv.slice(2);
|
|
1874
|
+
if (args[0] === 'connect') {
|
|
1875
|
+
runConnectWizard();
|
|
1876
|
+
} else {
|
|
1877
|
+
startValidatedMCPServer();
|
|
1878
|
+
}
|
|
1793
1879
|
}
|
|
1794
1880
|
|
|
1795
1881
|
module.exports = { MCPPromptOptimizer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-prompt-optimizer",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.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": {
|