PromptLab MCP Server

PromptLab MCP Server

Serves prompt templates through a standardized protocol for transforming basic user queries into optimized prompts for AI systems.

Category
Visit Server

README

PromptLab: AI Query Enhancement Engine

PromptLab transforms basic user queries into optimized prompts for AI systems. It automatically detects content type (essays, emails, technical explanations, creative writing), applies tailored templates, and validates that enhanced prompts maintain the original intent.

🔍 Overview

PromptLab is built on a modular architecture with a YAML-based template system that enables anyone to create and manage prompt templates without coding knowledge. The system ultimately produces higher-quality AI responses through better-structured inputs.

🏗️ Architecture

PromptLab consists of three primary components:

  1. Template System (prompt_templates.yaml) - Structured templates for different content types
  2. MCP Server (promptlab_server.py) - Serves templates through a standardized protocol with LangGraph Workflow
  3. Processing Client (promptlab_client.py) - Thin client that processes user query

Workflow Process

  1. Query Input: User submits a natural language query
  2. Classification: System determines the content type (essay, email, etc.)
  3. Parameter Extraction: Key parameters are identified (topic, audience, etc.)
  4. Template Application: The appropriate template is retrieved and filled
  5. Validation: The enhanced prompt is checked against the original intent
  6. Adjustment: Any needed refinements are made automatically
  7. Response Generation: The optimized prompt produces a high-quality response

alt text

📋 Features

  • Content Type Detection - Automatically classifies user queries into essay, email, technical, or creative writing requests
  • Parameter Extraction - Intelligently extracts key parameters like topics, recipients, and audience levels
  • Template Library - Pre-configured templates for common content types with structured guidance
  • Validation System - Ensures enhanced prompts maintain the original user intent
  • Feedback Loop - Adjusts prompts when validation identifies misalignments
  • Modular Design - MCP server can be plugged into any LLM system
  • Non-Technical Management - Templates can be updated without coding knowledge

🚀 Getting Started

Prerequisites

  • Python 3.8+
  • Dependencies:
    • mcp[cli]
    • langchain-openai
    • langgraph>=0.0.20
    • python-dotenv
    • pyyaml

Installation

# Clone the repository
git clone https://github.com/iRahulPandey/PromptLab.git
cd PromptLab

# Install dependencies
pip install -r requirements.txt

# Set up environment variables
cp .env
# Edit .env to add your OpenAI API key

Usage

  1. Start by running the server:
# The server loads templates from prompt_templates.yaml
python promptlab_server.py
  1. Run the client with your query:
python promptlab_client.py "Write an essay about climate change"
  1. The system will output:
    • Original query
    • Classified content type
    • Enhanced prompt
    • Validation result
    • Final response

📝 Template System

Templates are defined in prompt_templates.yaml using a structured format:

templates:
  essay_prompt:
    description: "Generate an optimized prompt template for writing essays."
    template: |
      Write a well-structured essay on {topic} that includes:
      - A compelling introduction that provides context and states your thesis
      ...
    parameters:
      - name: topic
        type: string
        description: The topic of the essay
        required: true

Adding New Templates

  1. Open prompt_templates.yaml
  2. Add a new template following the existing format
  3. Define parameters and transformations
  4. Define a tool on server side and load the template
  5. The server will automatically load the new template on restart

🛠️ Advanced Configuration

Environment Variables

  • TEMPLATES_FILE - Path to the templates YAML file (default: prompt_templates.yaml)
  • OPENAI_API_KEY - Your OpenAI API key for LLM access
  • MODEL_NAME - The OpenAI model to use (default: gpt-3.5-turbo)
  • PERSONA_SERVER_SCRIPT - Path to the server script (default: promptlab_server.py)

Custom Transformations

Templates can include transformations that dynamically adjust parameters:

transformations:
  - name: formality
    value: "formal if recipient_type.lower() in ['boss', 'client'] else 'semi-formal'"

📊 Example Outputs

Input Query

"Write something about renewable energy for my professor"

Enhanced Prompt

Write a well-structured essay on renewable energy that includes:
- A compelling introduction that provides context and states your thesis
- 2-3 body paragraphs, each with a clear topic sentence and supporting evidence
- Logical transitions between paragraphs that guide the reader
- A conclusion that synthesizes your main points and offers final thoughts

The essay should be informative, well-reasoned, and demonstrate critical thinking.

📄 License

MIT License - See LICENSE file for details

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

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
E2B

E2B

Using MCP to run code via e2b.

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
Qdrant Server

Qdrant Server

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

Official
Featured