About Prompt Gen Mcp
Prompt Gen Mcp is a local MCP server that combines local code context with prompt techniques from PromptGen API to expand simple questions. It is for developers seeking structured, context-aware prompts in Cursor.
Key features
- 01Scans local code context
- 02Selects prompt techniques via PromptGen API
- 03Analyzes questions with an LLM
- 04Combines context and techniques locally
- 05Offline fallback support
Use cases
- 01Turn coding questions into structured prompts
- 02Include project code context in prompt refinement
- 03Continue prompt enhancement when offline
MCP support
It runs as a local MCP server configured in Cursor and provides the `enhance_prompt` interaction. Local code is scanned on the machine; only question text is sent to PromptGen API for techniques.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEPromptGen MCP - Local Server
Transform simple questions into comprehensive, context-aware prompts using advanced prompt engineering techniques fetched from PromptGen API and your local code context.
🚀 Quick Start
1. Get Your PromptGen API Key
- Visit: https://promptgenmcp-production.up.railway.app
- Sign up and generate your API key
- Copy your API key starting with
pg_sk_
2. Get Other Required API Keys
- GROQ API Key: Get from https://console.groq.com/
- Tavily API Key: Get from https://tavily.com/
3. Install Dependencies
# Navigate to the directory
cd prompt-gen-mcp
# Install dependencies
pip install mcp sentence-transformers httpx groq
4. Configure Cursor
Copy the configuration to your Cursor MCP settings file (~/.cursor/mcp_servers.json):
{
"mcpServers": {
"prompt-gen": {
"command": "python",
"args": ["/full/path/to/prompt-gen-mcp/src/prompt_gen_mcp/server.py"],
"env": {
"PROMPTGEN_API_KEY": "pg_sk_your_key_here",
"GROQ_API_KEY": "gsk_your_groq_key_here",
"TAVILY_API_KEY": "tvly_your_tavily_key_here"
}
}
}
}
Important: Replace /full/path/to/prompt-gen-mcp/ with the actual full path to this directory.
5. Restart Cursor
Completely restart Cursor (not just reload) for the MCP server to be recognized.
6. Start Using
- Open any project in Cursor
- Press
Cmd+Shift+P(Mac) orCtrl+Shift+P(Windows/Linux) - Type: "MCP: enhance_prompt"
- Ask: "How do I optimize this React component?"
💡 What You Get
🔄 Transformation Example
| Before | After |
|---|---|
"How do I optimize this React component?" | Comprehensive Enhanced Prompt |
Enhanced Output:
# 🚀 Enhanced Prompt for: How do I optimize this React component?
## 🔍 Question Analysis
- **Types**: optimization, implementation
- **Complexity**: medium
- **Domain**: frontend
- **Intent**: optimize performance
## 🎯 Selected Prompt Engineering Techniques
### 1. 📋 Plan and Solve (Score: 0.847)
**Description**: Break down complex problems into structured planning and systematic solving phases
**Application**: Plan: Identify optimization targets. Solve: Apply specific React patterns.
### 2. 📚 Few-Shot Learning (Score: 0.823)
**Description**: Provide examples to guide the response
**Application**: Here are optimization examples: useMemo, React.memo, useCallback...
## 📁 Relevant Code Context
### File 1: `src/components/UserProfile.tsx` (Relevance: 0.892)
```typescript
const UserProfile = ({ userId }) => {
const [user, setUser] = useState(null);
useEffect(() => {
fetchUser(userId).then(setUser);
}, [userId]);
return <div>{user?.name}</div>;
};
✨ Enhanced Analysis Request
[Structured instructions for comprehensive response with context-aware suggestions...]
📊 Feature Comparison
| Feature | Basic Prompt | Enhanced Prompt |
|---|---|---|
| Context Awareness | ❌ None | ✅ Full codebase context |
| Technique Selection | ❌ Manual | ✅ AI-powered optimal selection |
| Privacy | ⚠️ Varies | ✅ Code stays local |
| Structured Output | ❌ Basic | ✅ Comprehensive analysis |
| Code Examples | ❌ Generic | ✅ From your actual project |
| Relevance Scoring | ❌ None | ✅ Semantic similarity matching |
🔒 Architecture & Privacy
- 🏠 Local Processing: All code scanning happens on your machine
- 🌐 API Integration: Only technique selection uses PromptGen API
- 🔢 No Code Shared: Your code never leaves your machine
- 🎯 Smart Selection: AI chooses optimal techniques from hosted database
- 📁 Context Aware: Automatically includes relevant code from your project
⚙️ How It Works
Architecture Overview
flowchart TD
A[User Question] --> B[Local MCP Server]
B --> C[Code Context Scanner]
B --> D[PromptGen API]
C --> E[Local Code Analysis]
D --> F[Technique Selection]
E --> G[Enhanced Prompt]
F --> G
G --> H[User Receives Enhanced Prompt]
style A fill:#e1f5fe
style B fill:#f3e5f5
style C fill:#e8f5e8
style D fill:#fff3e0
style G fill:#fce4ec
style H fill:#e0f2f1
Interaction Flow
sequenceDiagram
participant U as User
participant M as MCP Server
participant C as Code Scanner
participant P as PromptGen API
participant Q as Qdrant DB
U->>M: Ask question
M->>C: Scan local workspace
M->>P: Request techniques for question
P->>Q: Query vectorized techniques
Q-->>P: Return relevant techniques
C-->>M: Local code context
P-->>M: Optimal techniques
M->>M: Combine context + techniques
M->>U: Enhanced prompt with context
Note over C,M: Code never leaves your machine
Note over P,Q: Only question text sent to API
Privacy-First Flow:
- Local MCP scans your code privately on your machine
- PromptGen API provides optimal techniques from hosted Qdrant database
- Local processing combines everything into enhanced prompt
- No code leaves your machine - only question text sent to get techniques
🎯 Use Cases
- Code Optimization: Get structured analysis with relevant code context
- Architecture Decisions: Receive comprehensive comparisons with examples
- Debugging Help: Get systematic debugging approaches with code snippets
- Learning: Understand concepts with examples from your actual codebase
🔧 Troubleshooting
MCP Server Not Working:
# Test the server directly
python src/prompt_gen_mcp/server.py
# Check dependencies
pip install mcp sentence-transformers httpx groq
API Key Issues:
- Ensure
PROMPTGEN_API_KEYstarts withpg_sk_ - Get valid GROQ key from https://console.groq.com/
- Get valid Tavily key from https://tavily.com/
Cursor Not Finding MCP:
- Ensure complete Cursor restart (not just reload)
- Check
~/.cursor/mcp_servers.jsonsyntax - Verify file paths are absolute
- Look for MCP status in Cursor's bottom status bar
No Code Context:
- Ensure you're in a project directory
- Check file permissions
- Verify supported file types (.py, .js, .ts, .tsx, .jsx, .md, .txt)
📊 Features
- ✅ PromptGen API Integration (hosted technique database)
- ✅ Local Code Context Scanning (100% private)
- ✅ Privacy-Preserving Architecture
- ✅ Intelligent Technique Selection
- ✅ LLM-Powered Question Analysis
- ✅ True MCP Architecture (self-contained)
- ✅ Fallback Support (works offline)
🏗️ Architecture Benefits
Proper MCP Design:
- ✅ Single self-contained server process
- ✅ Cursor manages server lifecycle automatically
- ✅ No manual background service management
- ✅ Clean startup/shutdown with Cursor
API Integration:
- ✅ Uses PromptGen API for techniques (no local llms.txt)
- ✅ Hosted Qdrant database with vectorized techniques
- ✅ User authentication via API keys
- ✅ Usage tracking and billing support
🤝 Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
📄 License
MIT License - see LICENSE file for details.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.