Skip to main content
AI-Powered Context Detection & Professional Optimization

Documentation

Complete guide to integrating and using Prompt Optimizer's AI-powered prompt engineering platform with intelligent context detection and universal MCP compatibility

Cloud Edition CLI

A lightweight client for the Prompt Optimizer Cloud Edition. Requires an internet connection and a cloud subscription.

npm install -g mcp-prompt-optimizer

Local Edition CLI

A self-contained MCP server for 100% local processing. Works offline and ensures complete privacy.

npm install -g mcp-prompt-optimizer-local

Platform Overview

Our ecosystem is designed to empower professional AI development with intelligent prompt optimization and workflow automation. It comprises two core components: the **Cloud Edition** (a comprehensive web platform) and the **MCP Server** (a high-performance local engine), accessible via our powerful **CLI Tools**.

Key Features Across the Platform:

• **AI Context Detection** - Automatically detects image generation (Midjourney, DALL-E), LLM interaction, and technical automation contexts, while preserving parameters like --ar, --v, and code blocks.

• **Intent Formation (NEW)** - AI-powered clarification assistant that asks smart questions when prompts are vague, improving optimization quality by 55% with minimal cost.

• **Professional Optimization** - 50+ sophisticated optimization techniques including clarity, specificity, and technical accuracy. Our hybrid approach combines a comprehensive rules engine with AI-powered optimization for nuanced prompts.

• **Universal MCP Integration** - Our CLI tools work seamlessly with Claude Desktop, Cursor, Windsurf, and 17+ MCP clients.

• **Enterprise Security Foundation** - Multi-tenant architecture with role-based access, comprehensive audit trails, and industry-standard encryption at rest and in transit. Your data is never used for training.

• **High Performance** - Sub-50ms response times with intelligent routing between rules and LLM optimization, hosted on an auto-scaling infrastructure with a global CDN.

Integration Instructions

Follow these steps to get both the Cloud Edition and MCP Server running quickly.

Cloud Edition (Managed)

1) Create an account at https://prompt-blog-six.vercel.app/signup and choose the plan that fits your team.

2) From your dashboard, copy your API key.

3) Install the CLI: npm install -g mcp-prompt-optimizer

4) Export your key: export PROMPT_OPTIMIZER_API_KEY=<your-key>

5) Run your first optimization: mcp-prompt-optimizer optimize --prompt "Rewrite my onboarding email"

MCP Server (Local Edition)

1) Install the local package: npm install -g mcp-prompt-optimizer-local

2) Start the server: mcp-prompt-optimizer-local --port 3002 --log-level info

3) Add the MCP server to your client (Claude Desktop, Cursor, Windsurf).

4) Confirm health: visit http://localhost:3002/health and expect {"status":"ok"}.

5) Run a local optimization: curl -X POST http://localhost:3002/optimize -H "Content-Type: application/json" -d "{\"prompt\":\"Draft a release note about the new API\"}"

**Need a walkthrough?** Visit the demo page or contact us for tailored setup support.

The Cloud Edition

The Cloud Edition is our comprehensive web platform, offering a collaborative environment for teams and advanced features for managing your AI workflows.

Key Features:

• **Web UI** - An intuitive browser-based interface for all optimization and management tasks.

• **Team Collaboration** - Multi-user subscriptions with shared quotas, collaborative template libraries, and role-based access (Admin and Member roles). Quotas reset on your Stripe billing date.

• **Advanced Analytics** - Track usage, optimization effectiveness, and team performance with detailed dashboards. Export usage data for reporting.

• **Context Engineer Studio** - Integrated application for generating comprehensive SOPs and skill packages from documentation.

• **SOP History Management** - Save, search, and manage Standard Operating Procedures with favorites and filtering.

• **Centralized Management** - Manage all your team\'s prompts, templates, and SOPs from a single, secure web interface.

• **Always Up-to-Date** - Automatically uses the latest AI models and features without needing manual updates.

Chrome Extension

The Chrome Extension brings the power of Prompt Optimizer directly to any text input field in your browser. Optimize prompts on ChatGPT, Claude, Midjourney, or any AI platform without leaving your workflow.

Overview:

• **Universal Integration** - Works on any website with text inputs (ChatGPT, Claude.ai, Midjourney, Gemini, etc.)

• **Cloud-Powered** - Connects to the Cloud Edition backend for full optimization capabilities

• **User-Configurable Models** - Choose from 15+ AI models (GPT-4o, Claude 3.5 Sonnet, Gemini, free models, etc.)

• **One-Click Optimization** - Click the ✨ button next to any text input to optimize

• **Quota Tracking** - Real-time quota usage display in the extension popup

• **Persistent Preferences** - Model selection and settings saved across sessions

Installation:

1. **From Chrome Web Store** (Recommended):

• Visit the Chrome Web Store (link coming soon)

• Click "Add to Chrome"

• Grant permissions for text input detection

2. **Manual Installation (Developer Mode)**:

• Download the extension files from GitHub

• Open Chrome and navigate to chrome://extensions

• Enable "Developer mode" (top right)

• Click "Load unpacked" and select the extension directory

How to Use:

Step 1: Sign In

• Click the extension icon in your browser toolbar

• Sign in with your Cloud Edition credentials

• Your subscription quota will be displayed

Step 2: Select Your AI Model

• In the extension popup, use the "🤖 AI Model" dropdown

• Choose from 4 categories:

- **Recommended** (GPT-4o Mini, Claude 3.5 Sonnet, Gemini Flash 1.5)

- **Premium** (GPT-4o Latest, GPT-4 Turbo, Gemini Pro 1.5)

- **Free Models** (Kimi K2, Mistral 7B, Llama 3 8B)

- **Budget** (GPT-3.5 Turbo, Claude 3 Haiku)

• Your selection is saved automatically and persists across sessions

Step 3: Optimize Prompts

1. **Focus on any text input** - Click into a textarea, input field, or contenteditable element

2. **Click the ✨ button** - A floating button appears near the input field

3. **Choose action**:

• **⚡ Optimize Prompt** - Enhances your prompt with AI-powered optimization

• **📝 Generate S.O.P.** - Creates an optimized prompt structure (see limitations below)

4. **Review the result** - Preview the optimized prompt in a modal dialog

5. **Insert** - Click "Insert" to replace your original text with the optimized version

Model Selection Feature:

The extension supports the same models as the Cloud Edition via OpenRouter integration:

Recommended Models (Default: GPT-4o Mini):

• gpt-4o-mini - Fast, low cost, excellent quality

• anthropic/claude-3.5-sonnet - Best overall quality

• google/gemini-flash-1.5 - Ultra-fast processing

Premium Models:

• openai/gpt-4o-2024-11-20 - Latest OpenAI model

• openai/gpt-4-turbo - High-performance GPT-4

• google/gemini-pro-1.5 - 2M token context window

Free Models (No API cost):

• moonshotai/kimi-k2:free - High-quality free model

• mistralai/mistral-7b-instruct:free - Good for basic tasks

• meta-llama/llama-3-8b-instruct:free - Strong instruction following

Budget Models:

• openai/gpt-3.5-turbo - Cost-effective OpenAI

• anthropic/claude-3-haiku - Fast Anthropic model

⚠️ Important: S.O.P. Generation Differences

The Chrome Extension and Web Version have **different S.O.P. generation approaches**:

Chrome Extension Approach:

• **What it does**: Prepends "Create a Standard Operating Procedure (SOP) for:" to your prompt

• **Endpoint used**: /api/v1/optimize (standard optimization endpoint)

• **Output**: An **optimized prompt** that you can use to generate an S.O.P.

• **Example**:

- Input: "user authentication"

- Output: "Create a comprehensive Standard Operating Procedure for implementing secure user authentication with multi-factor authentication, password hashing, session management, and audit logging. Include step-by-step instructions..."

• **Use case**: Quick prompt enhancement for S.O.P. generation elsewhere

Web Version (Context Engineer Studio) Approach:

• **What it does**: Generates a **complete S.O.P. document** with sections, steps, and artifacts

• **Endpoint used**: /api/v1/context-engineer/generate-sop (dedicated S.O.P. endpoint)

• **Features**:

- File upload support (TXT, MD, PDF)

- URL context extraction

- Multi-section document structure

- Prerequisites and outcomes

- Required files and templates

- Comprehensive formatting

• **Output**: A **full S.O.P. document** ready to use

• **Use case**: Complete S.O.P. creation with documentation context

Recommendation:

• Use **Chrome Extension** for quick prompt enhancement on any AI platform

• Use **Web Version** for comprehensive S.O.P. document generation with file/URL context

Features:

✨ Floating Button UI:

• Appears automatically when you focus on any text input

• Positioned near the bottom-right of the input field

• Disappears on scroll to avoid obstruction

• Works on standard inputs, textareas, contenteditable divs, and role="textbox" elements

🔄 Modern Insert Functionality:

• Uses native property setters for React/Vue/Angular compatibility

• Triggers comprehensive events (input, change, blur) for framework detection

• Positions cursor correctly at the end of inserted text

• Works on first attempt (no double-clicking required)

📊 Quota Display:

• Real-time usage tracking in extension popup

• Visual progress bar with color-coded warnings

• Low quota alerts when approaching limit

• Upgrade prompts for free tier users

• Unlimited quota indicator for premium users

🔒 Security & Privacy:

• Requires Supabase authentication

• API tokens stored securely in chrome.storage.local

• No prompt data stored locally - sent directly to Cloud Edition API

• Uses your Cloud Edition subscription quota

Limitations:

S.O.P. Generation:

• Extension generates **optimized prompts**, not full S.O.P. documents

• No file upload or URL context support

• For complete S.O.P. documents, use the Web Version's Context Engineer Studio

Text Input Compatibility:

• Works on most modern websites (ChatGPT, Claude.ai, Midjourney, Notion, etc.)

• May not work on heavily customized input components

• Some frameworks may require page refresh after extension installation

Quota Usage:

• Uses your Cloud Edition subscription quota

• Each optimization counts as 1 quota usage

• Quota resets monthly on your Stripe billing date

Offline Usage:

• Requires internet connection (cloud-powered)

• No offline optimization capability

• For offline use, consider the MCP Server (Local Edition)

Troubleshooting:

Extension Not Showing ✨ Button:

# Solution 1: Refresh the page after installing extension

# Press F5 or Ctrl+R

# Solution 2: Check extension permissions

# Go to chrome://extensions

# Ensure "Prompt Optimizer AI" has permissions enabled

# Solution 3: Verify extension is enabled

# Extension icon should appear in browser toolbar

# Click icon to check login status

Insert Not Working:

• **Symptom**: Insert button does nothing or requires multiple clicks

• **Cause**: Page loaded before extension initialized

• **Solution**: Refresh the page (F5) after installing the extension

• **Note**: Modern insert functionality works on first attempt after page refresh

"Extension was reloaded" Error:

• **Symptom**: Modal shows "Extension was reloaded. Please refresh this page (F5) to continue."

• **Cause**: Chrome extension updated or reloaded while page was open

• **Solution**: Refresh the page (F5) to reconnect extension to page

Quota Exhausted:

• **Symptom**: Optimization returns shorter fallback text instead of full optimization

• **Cause**: Monthly quota limit reached

• **Solution 1**: Switch to a free model (Kimi K2, Mistral 7B, Llama 3 8B)

• **Solution 2**: Upgrade to a higher tier (Creator: 18k/month, Innovator: 75k/month)

• **Solution 3**: Wait until your quota resets (shown in extension popup)

Model Selection Not Persisting:

• **Symptom**: Model resets to default after closing browser

• **Cause**: chrome.storage.local permission issue

• **Solution**: Reinstall extension and grant all permissions

Authentication Failed:

# Check 1: Verify credentials

# Use the same email/password as Cloud Edition login

# Check 2: Verify subscription status

# Log into https://prompt-blog-six.vercel.app/login

# Ensure you have an active subscription

# Check 3: Clear extension storage

# Right-click extension icon → Options → Clear Data

# Then sign in again

Performance Tips:

• Use **GPT-4o Mini** (default) for best speed/cost balance

• Use **Gemini Flash 1.5** for ultra-fast optimizations

• Use **Free Models** to conserve quota on simple prompts

• Use **Premium Models** (GPT-4o, Claude 3.5 Sonnet) only for complex, critical prompts

The MCP Server

The MCP Server is a high-performance, local-first Model Context Protocol server that provides the core optimization engine. It is designed for maximum privacy and offline use, powering our CLI - Local Edition.

Key Features:

• **100% Local Processing** - All prompt optimization is done on your machine, ensuring complete privacy and confidentiality.

• **Offline Capability** - Works without an internet connection, making it ideal for secure or air-gapped environments.

• **Advanced Local Prompt Intelligence** - Sophisticated content analysis and optimization performed directly on your machine, including context-aware optimization for debugging and technical prompts.

• **Cross-Platform Support** - Universal compatibility for Windows, macOS, and Linux.

• **Binary Integrity Verification** - SHA256 hash validation ensures the integrity of the local server.

• **Technical Parameter Preservation** - Maintains code blocks, API calls, and other technical details during optimization, including parameters like --ar and --v.

• **Debugging Scenario Detection** - Context-aware optimization tailored for debugging and technical prompts.

Our CLI Tools

We offer two powerful Command Line Interface (CLI) tools to integrate our optimization engine directly into your development workflow. Both are MCP-compatible and work seamlessly with popular AI development environments.

CLI - Cloud Edition (`mcp-prompt-optimizer`)

• **Description:** A lightweight client that connects to the Prompt Optimizer Cloud Edition.

• **Best for:** Users who want a managed, always-up-to-date solution with team features and cloud-based analytics.

• **Installation:**

npm install -g mcp-prompt-optimizer

• **Usage:**

echo "your prompt here" | mcp-prompt-optimizer

• **Configuration (Example for Claude Desktop in ~/.claude/claude_desktop_config.json):**

{

"mcpServers": {

"prompt-optimizer": {

"command": "npx",

"args": ["mcp-prompt-optimizer"],

"env": {

"OPTIMIZER_API_KEY": "sk-opt-your-key-here"

}

}

}

}

CLI - Local Edition (`mcp-prompt-optimizer-local`)

• **Description:** A self-contained MCP server that runs 100% locally on your machine.

• **Best for:** Users who prioritize complete privacy, offline access, and local processing.

• **Installation:**

npm install -g mcp-prompt-optimizer-local

• **Setup:**

mcp-prompt-optimizer-local --setup

• **Usage:**

echo "your prompt here" | mcp-prompt-optimizer-local

• **Configuration (Example for Claude Desktop):**

{

"mcpServers": {

"prompt-optimizer-local": {

"command": "npx",

"args": ["mcp-prompt-optimizer-local"],

"env": {

"OPTIMIZER_API_KEY": "sk-local-your-key-here"

}

}

}

}

Supported MCP Clients:

• Claude Desktop, Cursor, Windsurf, Cline, VS Code, Zed, Replit, and any other MCP-compatible client.

Context Engineer Studio

The Context Engineer Studio is an integrated application within the Cloud Edition, designed to automate the generation of comprehensive Standard Operating Procedures (SOPs) and skill packages from your existing documentation and workflows.

Key Capabilities:

• **Basic SOP Generation:** Create step-by-step procedures from simple prompts.

• **Advanced Context Analysis:** Upload files (TXT, MD, PDF) and reference URLs for comprehensive SOP generation.

• **Complete Skill Packages:** Generate documentation, examples, scripts, templates, and troubleshooting guides.

• **SOP History & Management:** Save, organize, and manage all your generated SOPs in a centralized library with powerful search and filtering capabilities.

Intent Formation (AI Clarification)

Intent Formation is an intelligent feature that helps improve optimization quality by asking clarifying questions when prompts are vague or ambiguous. This AI-powered assistant ensures you get the best possible optimization by understanding your true intent.

How It Works:

1. **Automatic Detection** - When you submit a prompt with low confidence (< 50%), the system detects it needs clarification.

2. **Smart Questions** - The AI generates contextual questions using LLM enhancement and template-based approaches.

3. **Guided Refinement** - You answer critical questions (marked with ⚡) about your intent, target audience, technical requirements, etc.

4. **Enhanced Optimization** - Your answers are used to reconstruct a refined prompt for optimal results.

Key Features:

• **AI-Enhanced Questions** - Leverages LLM to generate contextual, relevant questions based on detected context.

• **Critical Question Validation** - Ensures essential information is provided before optimization.

• **Template + LLM Hybrid** - Combines proven templates with AI-generated questions for comprehensive coverage.

• **Skip Option** - Users can bypass clarification and use the original prompt if preferred.

• **Question Source Indicators** - Visual badges show which questions are AI-generated vs template-based.

Benefits:

• **55% Quality Improvement** - Tests show significant increase in optimization confidence.

• **Cost Effective** - Estimated cost of ~$0.49/year for typical usage.

• **Better Results** - Clarified prompts produce more accurate and useful optimizations.

• **User-Friendly** - Intuitive interface guides users through the clarification process.

Usage:

Intent Formation is **enabled by default** for all Cloud Edition users. You can toggle it on/off in the Advanced Settings of the optimizer interface.

Example Flow:

User Input: "make something for my business"

Confidence: 35% (Low)

System Response: Clarification Needed

Questions:

1. ⚡ What business problem are you trying to solve?

[Track orders] [Manage inventory] [Analyze sales]

2. ⚡ Who will use this tool?

[Just me] [My team] [External customers]

3. What programming language should I use?

[Python] [JavaScript] [Go] [Other]

After Answering:

Refined Prompt: "Create a Python web application to track customer orders for a small team of 5-10 people"

Confidence: 85% (High)

Subscription Plans (Cloud Edition)

Our subscription plans are tailored for the **Cloud Edition** of the Prompt Optimizer, offering access to its web UI, team features, and cloud-based optimization engine. Plans differ in usage quotas, team size, and support level.

Explorer ($2.99/month)

*Perfect for individual developers exploring professional prompt engineering*

• **5,000 optimizations/month** - Generous quota for personal projects

• **1 API key included** - Individual access with full MCP integration

• **Full AI engine access** - Complete optimization capabilities

• **Web UI access** - Browser-based optimization interface

• **Template management** - Save and review all optimizations

• **AI context detection** - Automatic context recognition and routing

• **All optimization techniques** - Access to all 50+ professional goals

• **Community support** - Standard support channels

Creator ($25.99/month)

*Ideal for creators and small teams*

• **18,000 optimizations/month** - Perfect for active development teams

• **Up to 3 API keys** - Team collaboration support

• **2 team members included** - Shared access and collaboration

• **Full AI engine access** - Complete optimization capabilities

• **Priority processing** - Faster response times

• **Batch file processing** - Process multiple files simultaneously

• **Template analytics** - Track optimization patterns and effectiveness

• **Team collaboration** - Shared templates and usage tracking

• **Email support** - Standard support with 12-24 hour response

Innovator ($69.99/month)

*Enterprise-grade for large teams and agencies*

• **75,000 optimizations/month** - Enterprise-level capacity

• **Up to 10 API keys** - Large team management

• **5 team members included** - Full team collaboration

• **Full AI engine access** - Complete optimization capabilities

• **Advanced analytics dashboard** - Comprehensive usage insights

• **Priority processing** - Fastest response times

• **Priority support** - Dedicated support with 2-6 hour response

• **Team management tools** - Admin/member roles and permissions

• **Dedicated support channel** - Enhanced support experience

Optimization Goals

Our platform offers a comprehensive suite of optimization goals, tailored to both the Cloud and MCP (Local) editions. These goals allow you to fine-tune the optimization process to meet your specific needs.

Cloud Edition Goals

The Cloud Edition provides a wide range of goals for advanced prompt engineering and content creation:

CLARITY - Enhance readability and understanding.

CONCISENESS - Reduce length while preserving meaning.

SIMPLICITY - Make the prompt easier to understand.

TECHNICAL_ACCURACY - Improve technical correctness.

CONTEXTUAL_RELEVANCE - Align with a specific domain.

SEMANTIC_PRESERVATION - Ensure the core meaning is retained.

TECHNICAL_PRECISION - Enhance technical terminology.

DOMAIN_SPECIFIC - Optimize for a specific field.

SPECIFICITY - Add concrete details.

ACTIONABILITY - Make the prompt more practical.

STRUCTURE - Organize information logically.

LINGUISTIC_PRECISION - Enhance language quality.

HOLISTIC_EFFECTIVENESS - Comprehensive optimization.

ENGAGEMENT - Make the prompt more engaging.

COHERENCE - Improve the logical flow.

KEYWORD_DENSITY - Optimize for keyword inclusion.

PARAMETER_PRESERVATION - Preserve technical parameters.

TOKEN_EFFICIENCY - Reduce token count.

EMBEDDING_STRENGTH - Improve embedding performance.

AI_MODEL_COMPATIBILITY - Enhance compatibility with AI models.

CONFIDENCE - Increase the confidence of the output.

DIRECTNESS - Make the prompt more direct.

QUALITY_ENHANCEMENT - Improve overall quality.

PROFESSIONALISM - Enhance the professional tone.

SAFETY - Improve the safety of the prompt.

RESPONSE_OPTIMIZATION - Optimize the expected response.

ORGANIZATION - Improve the organization of the prompt.

ELABORATION - Expand on the prompt.

EXCELLENCE - Aim for the highest quality.

ANALYTICAL_DEPTH - Increase the depth of analysis.

EDUCATIONAL_VALUE - Enhance the educational content.

INNOVATION - Encourage creative and novel outputs.

EFFICIENCY - Improve the efficiency of the prompt.

AUTHORITY - Enhance the authoritative tone.

COMPREHENSIVENESS - Increase the level of detail.

PERSUASIVENESS - Make the prompt more persuasive.

PROFESSIONAL_TONE - Enhance the professional tone.

AUDIENCE_AWARENESS - Tailor to a specific audience.

OUTPUT_FORMATTING - Specify the output format.

ROLE_PROMPTING - Use a specific role for the AI.

EXPERTISE_LEVEL - Specify the level of expertise.

EMOTIONAL_ENGAGEMENT - Increase emotional engagement.

ATTENTION_FOCUS - Focus the AI\'s attention.

INSTRUCTION_CLARITY - Make instructions clearer.

STEP_BY_STEP_GUIDANCE - Provide step-by-step guidance.

PRACTICAL_APPLICATION - Focus on practical applications.

EXAMPLE_INTEGRATION - Integrate examples.

DEPTH_ENHANCEMENT - Increase the depth of the content.

SYSTEMATIC_APPROACH - Use a systematic approach.

GOAL_ORIENTATION - Focus on a specific goal.

OUTCOME_SPECIFICATION - Specify the desired outcome.

METHODOLOGY_ENHANCEMENT - Improve the methodology.

EXPERTISE_INJECTION - Inject expertise into the prompt.

ENGAGEMENT_OPTIMIZATION - Optimize for engagement.

COMPREHENSION_ENHANCEMENT - Enhance comprehension.

RETENTION_IMPROVEMENT - Improve information retention.

APPLICATION_FOCUS - Focus on the application.

LEARNING_ACCELERATION - Accelerate learning.

KNOWLEDGE_TRANSFER - Facilitate knowledge transfer.

SKILL_DEVELOPMENT - Promote skill development.

PROBLEM_SOLVING - Focus on problem-solving.

CRITICAL_THINKING - Encourage critical thinking.

CREATIVE_ENHANCEMENT - Enhance creativity.

COMPREHENSIVE_ANALYSIS - Provide a comprehensive analysis.

DEBUGGING_ASSISTANCE - Assist with debugging.

DETAILED_EXAMPLES - Provide detailed examples.

STYLE_ENHANCEMENT - Enhance the writing style.

COMPARATIVE_ANALYSIS - Provide a comparative analysis.

PERSUASIVE_ENHANCEMENT - Enhance persuasiveness.

EXPANSION_REQUEST - Request an expansion of the content.

QUESTION_REFINEMENT - Refine a question.

SPECIFICITY_ENHANCEMENT - Enhance specificity.

STRUCTURED_OUTPUT - Specify a structured output.

BUSINESS_PROFESSIONALISM - Enhance business professionalism.

STRUCTURED_DOCUMENTATION - Create structured documentation.

CODE_REVIEW_QUALITY - Improve the quality of a code review.

MCP (Local) Edition Goals

The MCP (Local) Edition provides a focused set of goals for core optimization tasks:

CLARITY - Enhance readability and understanding.

CONCISENESS - Reduce length while preserving meaning.

SPECIFICITY - Add concrete details.

ACTIONABILITY - Make the prompt more practical.

TECHNICAL_PRECISION - Enhance technical terminology.

COMPREHENSIVENESS - Increase the level of detail.

PROFESSIONALISM - Enhance the professional tone.

SAFETY - Improve the safety of the prompt.

PARAMETER_PRESERVATION - Preserve technical parameters.

STRUCTURE - Organize information logically.

ANALYTICAL_DEPTH - Increase the depth of analysis.

QUALITY_ENHANCEMENT - Improve overall quality.

CREATIVE_ENHANCEMENT - Enhance creativity.

PERSUASIVENESS - Make the prompt more persuasive.

EDUCATIONAL_VALUE - Enhance the educational content.

CONTEXT_SPECIFICITY - Align with a specific domain.

OUTCOME_SPECIFICATION - Specify the desired outcome.

CONFIDENCE - Increase the confidence of the output.

DIRECTNESS - Make the prompt more direct.

TOKEN_EFFICIENCY - Reduce token count.

EFFECTIVENESS - Improve the overall effectiveness.

API Reference (Cloud Edition)

This API reference is for the **Cloud Edition** of the Prompt Optimizer, providing programmatic access to its optimization and management features.

**Base URL:** https://p01--project-optimizer--fvrdk8m9k9j.code.run

Authentication:

• All requests require API key in X-API-Key header

• API keys format: sk-opt-[random-string]

• Generate keys from your dashboard after subscribing

Core Optimization Endpoints:

POST /api/v1/optimize - Standard optimization with AI context detection

POST /api/v1/optimize/stream - Streaming optimization with SSE

GET /api/v1/optimize/quota - Team quota status

Optimize Request Parameters:

{

"prompt": "Your prompt to optimize",

"goals": ["clarity", "conciseness"],

"ai_context": "llm_interaction",

"enable_intent_formation": true, // NEW: Enable clarification for vague prompts

"context": {

"domain": "General",

"optimization_model_id": "optional-model-id"

},

"metadata": {

"user_tags": ["tag1", "tag2"]

}

}

Optimize Response (Normal):

{

"status": "optimized",

"original_prompt": "Your original prompt",

"optimized_prompt": "Your optimized prompt",

"confidence_score": 0.85,

"metadata": { ... }

}

Optimize Response (Clarification Needed):

{

"status": "clarification_needed",

"intent_formation": {

"needs_clarification": true,

"confidence": 0.35,

"detected_context": "code_generation",

"guidance": "To give you the best optimization...",

"clarification_questions": [

{

"question": "What programming language?",

"category": "language",

"priority": 1,

"suggested_answers": ["Python", "JavaScript", "Go"],

"rationale": "Language determines syntax...",

"source": "llm"

}

],

"suggested_prompt_structure": "Write a [LANGUAGE] [TASK]...",

"enhancement_method": "llm_enhanced"

}

}

Template Management:

GET /api/v1/templates - List saved templates

POST /api/v1/templates - Save optimization as template

Context Engineer Studio Endpoints:

POST /api/v1/context-engineer/generate-sop - Generate SOP from prompt/files

GET /api/v1/sop-history - List generated SOPs

GET /api/v1/sop-history/{sop_id} - Retrieve specific SOP

Health & Status:

GET /health - Service health check

Troubleshooting

Common Issues:

CLI Connection Problems:

# Verify installation for Cloud Edition CLI

npm list -g mcp-prompt-optimizer

# Verify installation for Local Edition CLI

npm list -g mcp-prompt-optimizer-local

# Check Node.js version

node --version # Should be >=16.0.0

# Restart MCP client after configuration changes

API Authentication Issues (Cloud Edition):

• Verify API key format (should start with sk-opt- or sk-local- for Local Edition CLI)

• Check subscription status in dashboard

• Ensure you have an active subscription for API access

• Test key validation:

curl -X POST "https://p01--project-optimizer--fvrdk8m9k9j.code.run/api/v1/validate-key" -H "X-API-Key: your-key"