MCP Prompt Optimizer

MCP Prompt Optimizer

This MCP server provides research-backed prompt optimization tools and professional domain templates designed to improve AI performance through strategies like Tree of Thoughts and Medprompt. It enables users to analyze, auto-optimize, and refine prompts using advanced reasoning patterns and safety-critical alignment techniques.

Category
Visit Server

README

MCP Prompt Optimizer

Python 3.8+ License: MIT MCP Compatible

A professional-grade MCP (Model Context Protocol) server that provides cutting-edge prompt optimization tools with research-backed strategies delivering 15-74% performance improvements.

โœจ Features

๐ŸŽฏ Basic Optimization Strategies

  • Clarity: Simplifies prompts for directness and precision
  • Specificity: Adds detailed constraints and requirements
  • Chain of Thought: Incorporates step-by-step reasoning
  • Few-Shot: Includes example formats for guidance
  • Structured Output: Defines clear output organization
  • Role-Based: Adds expert role context

๐Ÿš€ Advanced Optimization Strategies

  • Tree of Thoughts (ToT): Multi-path reasoning with 74% success rate on complex tasks
  • Constitutional AI: Self-critique and alignment with safety principles
  • Automatic Prompt Engineer (APE): AI-discovered optimal instruction patterns
  • Meta-Prompting: AI generates its own optimized prompts
  • Self-Refine: Iterative improvement with 20% performance gains
  • TEXTGRAD: Natural language feedback as optimization gradients
  • Medprompt: Multi-technique ensemble achieving 90%+ accuracy
  • PromptWizard: Feedback-driven self-evolving prompts

๐Ÿ“‹ Professional Domain Templates

Production-ready templates across 11 domains:

  • Business Analysis: Competitive analysis frameworks
  • Product Management: User research synthesis
  • Content Creation: Technical blog posts with SEO optimization
  • Development: Comprehensive code review checklists
  • Communication: Stakeholder updates and project reports
  • Strategy: OKR planning frameworks
  • Operations: Standard Operating Procedures (SOPs)
  • Legal: Contract termination and compliance
  • Customer Experience: Feedback surveys and insights
  • Data Analysis: Data insights and reporting
  • Meeting Management: Effective meeting agendas

๐Ÿ› ๏ธ Installation

Quick Setup

# Clone the repository
git clone <repository-url>
cd mcp-prompt-optimizer

# Create virtual environment (recommended)
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
./install.sh

# Or install manually
pip install -r requirements.txt

# Configure Claude Desktop
python3 setup_interactive.py

Manual Configuration

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "prompt-optimizer": {
      "command": "python3",
      "args": ["/path/to/mcp-prompt-optimizer/prompt_optimizer.py"],
      "env": {}
    }
  }
}

๐ŸŽฎ Usage

Basic Commands

# Analyze prompt quality
"Analyze this prompt: write a blog post about AI"

# Apply specific optimization
"Optimize this prompt using chain_of_thought: explain machine learning"

# Auto-select best strategy
"Auto-optimize: help me debug this code"

# Get domain template
"Get domain template for code_review_checklist"

Advanced Commands

# Use Tree of Thoughts for complex problems
"Apply advanced optimization with tree_of_thoughts: design a microservices architecture"

# Use Constitutional AI for safety-critical tasks
"Apply advanced optimization with constitutional_ai: create content moderation guidelines"

# Use Medprompt for high-accuracy classification
"Apply advanced optimization with medprompt: categorize customer support tickets"

# List available templates
"List all domain templates"

๐Ÿ—๏ธ Architecture

mcp-prompt-optimizer/
โ”œโ”€โ”€ prompt_optimizer.py      # Main MCP server
โ”œโ”€โ”€ advanced_strategies.py   # Research-backed optimization strategies
โ”œโ”€โ”€ domain_templates.py      # Professional domain templates
โ”œโ”€โ”€ examples.py              # Usage examples and demonstrations
โ”œโ”€โ”€ setup_interactive.py     # Automated setup script
โ””โ”€โ”€ README.md               # This file

๐Ÿงช Testing

# Run basic tests
./test.sh

# Run usage examples
python3 examples.py

๐Ÿ“Š Performance Benchmarks

Strategy Use Case Performance Improvement
Tree of Thoughts Complex reasoning 70-74% success rate
Medprompt Classification tasks 90%+ accuracy
Self-Refine Iterative improvement 20% per iteration
Constitutional AI Safety alignment High compliance
Chain of Thought Step-by-step tasks 15-25% improvement

๐Ÿ”ง Available Tools

Core Tools

  1. analyze_prompt: Analyzes prompt quality and identifies issues
  2. optimize_prompt: Applies specific optimization strategies
  3. auto_optimize: Automatically selects optimal strategy
  4. get_prompt_template: Returns basic templates

Advanced Tools

  1. advanced_optimize: Applies research-backed strategies
  2. get_domain_template: Returns professional domain templates
  3. list_domain_templates: Lists available templates by domain

๐ŸŽฏ Strategy Selection Guide

Prompt Type Recommended Strategy
Complex problems tree_of_thoughts
Classification tasks medprompt
Safety-critical constitutional_ai
Vague requirements meta_prompting
Needs refinement self_refine
General optimization auto

๐Ÿค Contributing

We welcome contributions! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Update documentation
  5. Submit a pull request

Adding New Features

  • New Strategy: Add to advanced_strategies.py
  • New Template: Add to domain_templates.py
  • Examples: Add to examples.py

๐Ÿ› Troubleshooting

Common Issues

MCP not working?

  • Check Python version: python3 --version (requires 3.8+)
  • Install dependencies: Run ./install.sh or pip install -r requirements.txt
  • Verify MCP installation: pip show mcp
  • Check Claude Desktop logs
  • Restart Claude Desktop

Commands not recognized?

  • Verify configuration file location
  • Check file paths in configuration
  • Run setup script again

Debug Mode

# Test server directly
python3 prompt_optimizer.py

# Verbose logging
export MCP_LOG_LEVEL=debug
python3 prompt_optimizer.py

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Research from Princeton, Google DeepMind, Microsoft Research
  • Anthropic's Constitutional AI framework
  • Stanford's DSPy framework
  • OpenAI's prompt engineering guidelines

๐Ÿ“ˆ Citation

If you use this tool in your research or projects, please cite:

@software{mcp_prompt_optimizer,
  title={MCP Prompt Optimizer: Research-Backed Prompt Optimization for AI Systems},
  author={Bubobot},
  year={2024},
  url={https://github.com/Bubobot-Team/mcp-prompt-optimizer}
}

Built with โค๏ธ for the AI community

For questions, issues, or contributions, please visit our GitHub repository.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured