mcp-prompt-optimizer
v3.0.5
Published
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 collabo
Maintainers
Keywords
Readme
MCP Prompt Optimizer v3.0.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.
✨ Key Features
🧠 AI Context Detection — Automatically detects and optimizes for code, creative writing, image generation, communication, and more 📁 Template Management — Auto-save high-confidence optimizations, search & reuse patterns 👥 Team Collaboration — Shared quotas, team templates, role-based access 📊 Confidence Scoring — Honest quality signal with per-tier annotations ☁️ Cloud Processing — Always up-to-date AI models via backend LLM pipeline 🔧 Resilient Fallback — Structured local optimization if the backend is unreachable 🎛️ Personal Model Choice — Use your own OpenRouter models via WebUI configuration 🔧 Universal MCP — Works with Claude Desktop, Cursor, Windsurf, Cline, VS Code, Zed, Replit
🚀 Quick Start
1. Get your API key (required):
- 🆓 Free Tier (
sk-local-*): 5 daily optimizations — promptoptimizer-blog.vercel.app/pricing - ⭐ Paid Tiers (
sk-opt-*,sk-team-*): Higher quotas, team features, advanced capabilities
2. Install:
npm install -g mcp-prompt-optimizer3. Configure your MCP client:
Add to ~/.claude/claude_desktop_config.json (Claude Desktop):
{
"mcpServers": {
"prompt-optimizer": {
"command": "npx",
"args": ["mcp-prompt-optimizer"],
"env": {
"OPTIMIZER_API_KEY": "sk-local-your-key-here"
}
}
}
}4. Restart your MCP client and start optimizing.
Note: API keys are validated against the backend server. An internet connection is required (responses are cached for up to 2 hours for reliability).
⚙️ How Optimization Works
Prompts are routed through a three-tier pipeline based on complexity and context. Each tier produces a different output format and confidence range.
Tier 1 — LLM Optimization (backend, confidence 70–95%)
The backend routes complex or high-sophistication prompts through a Gemini Flash LLM pass that genuinely rewrites and enriches the prompt. This is the highest-quality output.
# 🎯 Optimized Prompt
My Python script crashes with a KeyError on line 47. I need help diagnosing
the root cause. I am using Python 3.11 with pandas 2.0. The error occurs
when accessing dictionary keys after a merge operation.
**Confidence:** 82.0%
**AI Context:** code_generationTier 2 — Backend Rules Optimization (backend, confidence < 25%)
For simpler or lower-sophistication prompts the backend applies rules-based optimization without an LLM. When this happens, confidence will be below 25% and a note will appear explaining what to check if you expected full LLM enhancement.
# 🎯 Optimized Prompt
My Python script crashes with a KeyError. Please provide the error message
and relevant code.
> ℹ️ *Low confidence indicates the backend applied rules-based optimization
> (no LLM). Ensure `OPENROUTER_API_KEY` is configured in the backend for
> full LLM enhancement.*
**Confidence:** 18.0%
**AI Context:** code_generationTier 3 — Local Rules Fallback (npm, confidence 35–55%)
If the backend is unreachable, the npm package applies optimization locally using a library of domain-specific templates. The output is a structured, user-facing prose prompt — no XML scaffolding. The confidence annotation makes the quality tier explicit.
# 🔧 Rules-Based Optimization Applied
⚠️ *Backend unreachable — your prompt has been structured using local rule
templates (no LLM). Re-run when the backend is available for full LLM
optimization.*
**Template:** `debugging_request`
**Optimized Prompt:**My Python script crashes with a KeyError
To address this effectively:
- Identify the most likely root causes given the error description.
- Request the full error message and stack trace, plus the relevant code snippet.
- Ask about expected vs. actual behavior, programming language, and library versions.
Response format: Step-by-step debugging walkthrough with a specific fix or next diagnostic steps.
**Confidence:** 51.0% *(rules-based — LLM optimization typically 70–95%)*
**AI Context:** code_generation🧠 AI Context Detection
The server automatically detects your prompt type and routes it to the appropriate optimization template. You can also specify ai_context manually in the tool call.
| Context | ai_context value | Example patterns |
|---|---|---|
| Code & debugging | code_generation | debug, fix, error, python, sql, refactor |
| Web development | code_generation | landing page, react, css, html, tailwind |
| API & integration | api_automation | api, rest, endpoint, oauth, webhook |
| DevOps & automation | technical_automation | deploy, docker, ci/cd, terraform, bash |
| Data & schemas | structured_output | json, schema, csv, yaml, transform |
| Analysis & research | llm_interaction | analyze, explain, compare, research |
| Creative writing | creative_writing | story, poem, script, blog, copywriting |
| Email & communication | human_communication | email, letter, memo, formal, reply |
| Image generation | image_generation | photorealistic, midjourney, dall-e, portrait |
| General | general_assistant | Everything else |
Image Generation
Image prompts are handled separately. The local fallback appends style-matched quality boosters directly to the prompt (comma-separated), rather than producing structured bullets. This matches how image generation models consume prompts.
Input: "Draw a photorealistic portrait of an astronaut"
Output: "Draw a photorealistic portrait of an astronaut, ultra realistic,
sharp focus, professional photography, dynamic lighting, balanced
composition, high quality, 4K"🛠️ Available MCP Tools
optimize_prompt
AI optimization with context detection, auto-save, and insights.
{
"prompt": "Your prompt text",
"goals": ["clarity", "specificity"],
"ai_context": "code_generation",
"enable_bayesian": true
}detect_ai_context
Detect the AI context for a given prompt.
{
"prompt": "The prompt text for which to detect the AI context"
}create_template
Save an optimization as a reusable template.
{
"title": "Template title",
"description": "Optional description",
"original_prompt": "The original prompt",
"optimized_prompt": "The optimized prompt",
"optimization_goals": ["clarity"],
"confidence_score": 0.9,
"ai_context_detected": "code_generation",
"is_public": false,
"tags": ["debugging", "python"]
}get_template
Retrieve a saved template by ID.
{
"template_id": "the-template-id"
}update_template
Update an existing template.
{
"template_id": "the-template-id",
"title": "Updated title",
"is_public": true
}search_templates
Search your saved template library.
{
"query": "debugging",
"ai_context": "code_generation",
"limit": 5,
"sort_by": "confidence_score",
"sort_order": "desc"
}get_quota_status
Check subscription status and quota usage. No parameters required.
get_optimization_insights (conditional)
Bayesian optimization insights and parameter tuning recommendations. Requires the feature to be enabled in the backend; returns mock data otherwise.
{
"analysis_depth": "detailed",
"include_recommendations": true
}get_real_time_status (conditional)
Real-time optimization status and AG-UI capabilities. Requires the feature to be enabled in the backend; returns mock data otherwise. No parameters required.
🎛️ Advanced Model Configuration (Optional)
Configure custom models in the WebUI and the MCP server uses them automatically.
Step 1 — Configure in WebUI:
- Visit Dashboard
- Go to Settings → User Settings
- Add your OpenRouter API key (from openrouter.ai)
- Select your preferred models for optimization and evaluation
Step 2 — Use the npm package as normal. Your WebUI model settings are applied automatically — no changes to the MCP configuration required.
Model Selection Priority
1. Your WebUI-configured models (highest priority)
2. Request-specific model override
3. System default (google/gemini-flash-1.5-8b)Example Model Recommendations
| Use case | Optimization model | Evaluation model |
|---|---|---|
| Creative / complex | anthropic/claude-3-5-sonnet | google/gemini-pro-1.5 |
| Fast / simple | openai/gpt-4o-mini | openai/gpt-3.5-turbo |
| Code / technical | anthropic/claude-3-5-sonnet | anthropic/claude-3-haiku |
Two different API keys:
- Service key (
sk-opt-*) — your MCP Prompt Optimizer subscription- OpenRouter key — your personal OpenRouter account for model usage costs
💰 Subscription Plans
| Plan | Price | Optimizations/month | Team members | |---|---|---|---| | 🎯 Explorer | $2.99/mo | 5,000 | 1 | | 🎨 Creator | $25.99/mo | 18,000 | 2 + 3 keys | | 🚀 Innovator | $69.99/mo | 75,000 | 5 + 10 keys |
🆓 Free trial: 5 optimizations with full feature access.
All plans include AI context detection, template management, personal model configuration, and optimization insights.
🔧 CLI Commands
mcp-prompt-optimizer check-status # Check API key and quota status
mcp-prompt-optimizer validate-key # Validate API key with backend
mcp-prompt-optimizer test # Test backend integration
mcp-prompt-optimizer diagnose # Run comprehensive diagnostic
mcp-prompt-optimizer clear-cache # Clear validation cache
mcp-prompt-optimizer help # Show help and setup instructions
mcp-prompt-optimizer version # Show version information🏢 Team Collaboration
Team API Keys (sk-team-*)
- Shared quotas across team members
- Centralized billing and management
- Team template libraries for consistency
- Role-based access control
Individual API Keys (sk-opt-*)
- Personal quotas and billing
- Individual template libraries
- Account self-management
🔐 Security & Privacy
- Encrypted data transmission
- API key validation with secure backend authentication
- Quota enforcement with real-time usage tracking
- No prompt data retained — processed and discarded immediately
- GDPR compliant
🔧 Universal MCP Client Support
Claude Desktop
{
"mcpServers": {
"prompt-optimizer": {
"command": "npx",
"args": ["mcp-prompt-optimizer"],
"env": { "OPTIMIZER_API_KEY": "sk-opt-your-key-here" }
}
}
}Cursor IDE
Add to ~/.cursor/mcp.json:
{
"mcpServers": {
"prompt-optimizer": {
"command": "npx",
"args": ["mcp-prompt-optimizer"],
"env": { "OPTIMIZER_API_KEY": "sk-opt-your-key-here" }
}
}
}Other clients
Windsurf, Cline, VS Code, Zed, Replit, JetBrains IDEs, and Neovim are all supported via standard MCP server configuration.
📦 Changelog
v3.0.3
- Rules fallback output rewritten — local optimization now produces user-facing prose prompts instead of raw XML scaffolding. The output is directly usable as a prompt without modification.
- All 18 local templates reworded — template principles are now phrased as user request guidance rather than AI-assistant directives, producing more natural and actionable structured prompts.
creative_writingcontext now routes correctly to the creative writing template (previously fell through to a generic fallback).general_assistantcontext now maps explicitly to the LLM interaction template.- Backend rules-tier detection — when the backend returns confidence below 25% (indicating it ran its own rules tier without an LLM), a note appears explaining the cause and how to resolve it (
OPENROUTER_API_KEYconfiguration). - Confidence scale annotation — rules-based fallback confidence now shows
*(rules-based — LLM optimization typically 70–95%)*so users understand where their result sits relative to full LLM optimization.
v3.0.2
- Cross-platform binary compatibility improvements
- Bayesian optimization integration
- AG-UI feature flag support
v3.0.0
- API key now required for all operations
- Development mode and offline mode removed for security
- All keys validated against backend server
📞 Support & Resources
- Documentation: https://promptoptimizer-blog.vercel.app/docs
- Dashboard & model config: https://promptoptimizer-blog.vercel.app/dashboard
- Troubleshooting: https://promptoptimizer-blog.vercel.app/docs/troubleshooting
- Community support: GitHub Discussions
- Email support: [email protected] (Creator/Innovator plans)
- Enterprise: [email protected]
Get started with 5 free optimizations at promptoptimizer-blog.vercel.app/pricing
