MCP Prompt Optimizer
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MCP Prompt Optimizer
š 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.
New here? A free API key takes no card and includes 20 optimizations a month. Start free, or try one optimization with no account first.
⨠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
Related MCP server: PromptVault MCP Server
š Quick Start
1. Get your API key:
š Free Tier (
sk-opt-*): 20 LLM optimizations/month, 1 API key ā no credit card requiredā Pro (
sk-opt-*): 500 optimizations/month, full model config, Context Engineerš¢ Enterprise (
sk-team-*): Unlimited optimizations, team keys, shared quotas
Sign up and generate your key at promptoptimizer.xyz/dashboard.
2. Install:
npm install -g mcp-prompt-optimizer3. Connect to Claude Desktop (one command):
npx mcp-prompt-optimizer connectThis wizard reads your API key and writes the MCP server entry to Claude Desktop config automatically. Cross-platform (macOS, Windows, Linux).
Or configure manually ā add to ~/.claude/claude_desktop_config.json:
{
"mcpServers": {
"mcp-prompt-optimizer": {
"command": "npx",
"args": ["-y", "mcp-prompt-optimizer"],
"env": {
"OPTIMIZER_API_KEY": "sk-opt-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.
Context |
| Example patterns |
Code & debugging |
|
|
Web development |
|
|
API & integration |
|
|
DevOps & automation |
|
|
Data & schemas |
|
|
Analysis & research |
|
|
Creative writing |
|
|
Email & communication |
|
|
Image generation |
|
|
Business & Strategy |
|
|
Technical Strategy |
|
|
Legal & Compliance |
|
|
Medical & Health |
|
|
Education |
|
|
General |
| 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"
}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)
Experimental and off by default (set ENABLE_BAYESIAN_OPTIMIZATION=true to list it). It calls an analytics endpoint that the hosted service does not currently provide, so it reports that insights are unavailable; it never returns made-up data.
{
"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.
š¤ Context Engineer (CE) Tools
Free accounts get a limited monthly Context Engineering allowance on the default model; Pro and Enterprise get more, and generate_harness_bundle requires Pro or Enterprise. CE tools generate agentic scaffolding artifacts (SOPs, skill packages, framework code) directly in your IDE.
generate_agent_sop
Generate a structured SOP document for an AI agent from a goal description. Returns markdown SOP ready for use.
{
"goal": "What the agent should accomplish",
"context": "Additional context, constraints, or domain info (optional)",
"model_id": "Model to use (optional)"
}generate_skill_package
Generate a complete skill package (SOP + SKILL.md + reference + examples + helper.py) for a given agent goal. Takes 30ā90 seconds (async with polling).
{
"goal": "What the agent should accomplish",
"format": "knowledge_doc",
"model_id": "Model to use (optional)"
}format currently accepts only knowledge_doc (the default); it is optional.
generate_harness_bundle
Generate a deployment-ready Agentic Harness ZIP bundle for a specific platform. Returns a confirmation when the bundle is queued for download.
{
"goal": "The workflow goal the harness is built for",
"deploy_target": "claude_code",
"sop_content": "The SOP markdown content (required if no session_id)",
"session_id": "Optional: session ID from a prior generate_skill_package call"
}deploy_target accepts a single string (Pro+) or an array of strings (Enterprise ā multi-platform simultaneously). Supported targets include claude_code, langchain, autogen, crewai, amazon_q, aider, continue_dev, and more. amazon_q, aider, continue_dev, crewai require Enterprise.
explore_sop_approaches
Generate 3 parallel SOP variants (process-oriented, decision-tree, role-based) for comparison before committing to one. Returns an HTML comparison grid, a variants array, and a recommended variant. Enterprise required.
{
"goal": "The workflow goal to generate SOP variants for",
"context": "Optional background context",
"blend_description": "Optional: blend all 3 variants into one SOP using this description"
}IntentFrame fields (perspective, out_of_scope, success_definition) are also accepted to scope the generation.
transform_for_framework
Transform a SOP into native code for your agent framework: LangChain tool, AutoGen agent, or Claude Code skill.
{
"sop_content": "The SOP markdown content",
"goal": "What the agent should accomplish",
"framework": "langchain_tool"
}framework is one of langchain_tool, autogen_agent, or claude_skill.
get_ce_quota_status
Check your Context Engineer credit balance and what workflows are available at your tier. 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 |
|
|
Fast / simple |
|
|
Code / technical |
|
|
Two different API keys:
Service key (
sk-opt-*orsk-team-*) ā your MCP Prompt Optimizer subscriptionOpenRouter key ā your personal OpenRouter account for model usage costs
š° Subscription Plans
Plan | Price | Optimizations/month | CE Credits | API Keys |
š Free | $0 | 20 LLM | ā | 1 |
ā Pro | $19/mo | 500 | 5 | 1 |
š¢ Enterprise | Custom | Unlimited | 50 | 10 (shared) |
All plans include AI context detection, template management, personal model configuration, and optimization insights.
š§ CLI Commands
npx mcp-prompt-optimizer connect # Interactive wizard: add API key to Claude Desktop config
mcp-prompt-optimizer check-status # Check API key and quota status
mcp-prompt-optimizer validate-key # Validate API key with backend
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 ā available on Free and Pro tiers
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
Prompts you optimize and the results are sent to the Prompt Optimizer API over HTTPS and stored in your account's optimization history. You can delete that history and your saved templates in the dashboard, or request account deletion. See the privacy policy
If the backend is unreachable, the package falls back to a limited optimization that runs on your machine
GDPR compliant
Files this package writes on your machine
~/.mcp-cloud-api-cache.jsonand~/.mcp-cloud-health.json: a cache of your key's validation result and network-health counters.mcp-prompt-optimizer clear-cacheremoves them.generate_harness_bundlesaves the ZIP it generates underOPTIMIZER_OUTPUT_DIR(default: amcp-prompt-optimizerfolder in the system temp directory), with a timestamped name; it never overwrites. The tool's optionaloutput_dirargument may only name a subfolder of that location. To save elsewhere, setOPTIMIZER_OUTPUT_DIRin your own environment.npx mcp-prompt-optimizer connectedits your MCP client's config file (a.bakbackup is written first).
š§ Universal MCP Client Support
Claude Desktop
{
"mcpServers": {
"mcp-prompt-optimizer": {
"command": "npx",
"args": ["-y", "mcp-prompt-optimizer"],
"env": { "OPTIMIZER_API_KEY": "sk-opt-your-key-here" }
}
}
}Cursor IDE
Add to ~/.cursor/mcp.json:
{
"mcpServers": {
"mcp-prompt-optimizer": {
"command": "npx",
"args": ["-y", "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.7.2
Stdout / JSON-RPC safety ā All MCP server startup logs (banner, status, mode indicators, key validation) now route to stderr instead of stdout. On stdio transports stdout is the JSON-RPC channel; previously any non-protocol writes there risk corrupting the stream. No user-facing change beyond logging.
Contract test ā
npm run test:contractpins the/optimizeresponse shape (Pydantic fields + runtime-injectedquota_used/quota_limit+ metadatarouting_score/routing_tier/model_used) against a canonical fixture. Catches backend drift before publish.CI workflow ā
.github/workflows/ci.ymlrunsnpm ci+ health check + contract check on push/PR across Node 18, 20, and 22.
v3.6.0
Free tier MCP access ā Free users can now create an API key (
sk-opt-*) and use the MCP server at no cost (currently 20 LLM optimizations/month). Previously, key creation was blocked in the live service due to a bug introduced when the free-tier launch landed in an unused module. Keys withsubscription_status: NULL(all free accounts) now validate correctly.connectwizard ānpx mcp-prompt-optimizer connectinteractively writes your API key to Claude Desktop config on macOS, Windows, and Linux. Replaces manual JSON editing for new users.Upsell block ā Local rules fallback output now includes a concise upgrade prompt with a one-command onboarding path when no API key is configured.
v3.5.0
LLM upsell block added to local fallback output
connectsubcommand added (interactive Claude Desktop config wizard)
v3.4.1
Tier names migrated from Explorer/Creator/Innovator to Free/Pro/Enterprise (D6 pricing)
v3.4.0
explore_sop_approachestool: generates 3 parallel SOP variants (process-oriented, decision-tree, role-based) for comparison before committing. Optionally acceptsblend_descriptionto blend variants directly. Enterprise tier required.
v3.3.0
generate_harness_bundletool: generates deployment-ready ZIP harness for 14+ platforms. Single deploy target (Pro+) or multi-platform array (Enterprise).Intent frame fields (
perspective,out_of_scope,success_definition) added togenerate_agent_sopfor scoped SOP generation.
v3.2.x
transform_for_frameworktool: converts SOP to native LangChain tool, AutoGen agent, or Claude Code skillCE harness HTML review layer with interactive DAG visualization
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: promptoptimizer.xyz/docs
š Dashboard & model config: promptoptimizer.xyz/dashboard
š Pricing & API Keys: promptoptimizer.xyz/pricing
š Issues: GitHub Issues
š License: Commercial License
š Security: Security Policy
š¤ Contributing: Contributing Guide
š Code of Conduct: Contributor Covenant
š Changelog: Release History
š§ Email support: support@promptoptimizer.xyz
Start free at promptoptimizer.xyz ā 20 LLM optimizations/month, no credit card required.
This server cannot be deployed
Maintenance
Related MCP Connectors
Generate contextual prompts and reusable agent skills, evaluate prompts with the 16-dimension Prompt Score, and manage saved work in PromptDrive. Twelve MCP tools also provide authorized access to private Memory for source-grounded answers. Connect over Streamable HTTP using OAuth 2.1 and PKCE. Generation consumes account quota and automatically saves successful results; Memory access follows account permissions and plan limits.
Your prompt library in any MCP client: list, fetch, save and version prompt templates.
Scan prompts for injection attacks, redact PII, and audit LLM SDK usage from any MCP client
Professional prompt library over remote MCP: 13 verticals, free discovery scope.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides prompt management, resource management, and tool call capabilities (content analysis, article analysis) based on the MCP protocol.3MIT
- AlicenseNot gradedqualityCmaintenanceEnables prompt versioning, evaluation, and management via MCP, CLI, and REST APIs, with support for multiple LLM providers.MIT
- FlicenseNot gradedqualityCmaintenanceEnables developers to explain error messages, validate and format JSON, generate regex patterns from descriptions, and summarize text via an LLM, all through MCP-connected clients.-
- AlicenseNot gradedqualityCmaintenanceEnables MCP clients to list, retrieve, compile, create, and update prompts, including managing versions, labels, tags, configuration, and production promotion.MIT