PromptLab MCP Server
Serves prompt templates through a standardized protocol for transforming basic user queries into optimized prompts for AI systems.
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:
- Template System (
prompt_templates.yaml) - Structured templates for different content types - MCP Server (
promptlab_server.py) - Serves templates through a standardized protocol with LangGraph Workflow - Processing Client (
promptlab_client.py) - Thin client that processes user query
Workflow Process
- Query Input: User submits a natural language query
- Classification: System determines the content type (essay, email, etc.)
- Parameter Extraction: Key parameters are identified (topic, audience, etc.)
- Template Application: The appropriate template is retrieved and filled
- Validation: The enhanced prompt is checked against the original intent
- Adjustment: Any needed refinements are made automatically
- Response Generation: The optimized prompt produces a high-quality response

📋 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-openailanggraph>=0.0.20python-dotenvpyyaml
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
- Start by running the server:
# The server loads templates from prompt_templates.yaml
python promptlab_server.py
- Run the client with your query:
python promptlab_client.py "Write an essay about climate change"
- 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
- Open
prompt_templates.yaml - Add a new template following the existing format
- Define parameters and transformations
- Define a tool on server side and load the template
- 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 accessMODEL_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.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.