
Promptheus
io.github.abhichandra21由 GitHub 帳號 abhichandra21 發布v0.3.1更新於 Oct 24, 2026
AI-powered prompt refinement with adaptive questioning and multi-provider support (6+ LLM backends)
概覽
一個本機 MCP 伺服器,透過自適應澄清問題,使用已設定的某個 LLM 供應商來優化與微調 LLM 提示詞。
- 可以做什麼
- 優化提示詞並可附帶澄清問題,回傳優化後的提示詞,或回傳需要回答的問題,再依問題 ID 對應答案重新送出(refine_prompt)。對現有提示詞做針對性修改,例如讓它更精簡(tweak_prompt)。查詢已設定供應商可用的模型(list_models)。檢查哪些供應商已設定以及各自使用的模型(list_providers)。驗證環境設定,並可選擇測試 API 連線(validate_environment)。
- 適用情境
- 適合在正式使用前,把粗略或資訊不足的提示詞改寫成詳細、結構清楚的提示詞,或對既有提示詞做小幅精準修改。也適合需要結構化問答步驟來蒐集受眾、語氣、篇幅等需求的工作流程。
- 執行需求
- 以 Python 套件形式在本機執行(pip install promptheus),透過 stdio 通訊,用 promptheus mcp 或 python -m promptheus.mcp_server 啟動。需安裝 mcp 套件。至少需要一個供應商 API 金鑰,可在 .env 檔案或環境變數中設定:ANTHROPIC_API_KEY、GLM_API_KEY、GOOGLE_API_KEY、GROQ_API_KEY、OPENAI_API_KEY 或 QWEN_API_KEY。可用 PROMPTHEUS_PROVIDER 與 PROMPTHEUS_MODEL 覆寫供應商與模型。存取供應商 API 需要網路。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Promptheus,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Promptheus
Refine and optimize prompts for LLMs
[Python Version] [PyPI Version] [Release Version] [License: MIT] [GitHub Stars]
[Deploy GitHub Pages] [Docker Build & Test] [Publish Python Package]
Quick Start
Python library usage
If you're already in an async application (e.g., FastAPI), call refine_prompt_async instead of the sync helper.
What is Promptheus?
Promptheus analyzes your prompts and refines them with:
- Adaptive questioning: Smart detection of what information you need to provide
- Multi-provider support: Works with Google, OpenAI, Anthropic, Groq, Qwen, and more
- Interactive refinement: Iteratively improve outputs through natural conversation
- Session history: Automatically track and reuse past prompts
- CLI and Web UI: Use from terminal or browser
Supported Providers
OpenRouter integration in Promptheus is optimized around the openrouter/auto routing model:
- Model listing is intentionally minimal: Promptheus does not expose your full OpenRouter account catalog.
- You can still specify a concrete model manually with
OPENROUTER_MODELor--modelif your key has access.
Core Features
🧠 Adaptive Task Detection Automatically detects whether your task needs refinement or direct optimization
⚡ Interactive Refinement Ask targeted questions to elicit requirements and improve outputs
📝 Pipeline Integration Works seamlessly in Unix pipelines and shell scripts
🔄 Session Management Track, load, and reuse past prompts automatically
📊 Telemetry & Analytics Anonymous usage and performance metrics tracking for insights (local storage only, can be disabled)
🌐 Web Interface Beautiful UI for interactive prompt refinement and history management
Configuration
Create a .env file with at least one provider API key:
Or run the interactive setup:
Examples
Content Generation
Code Analysis
Interactive Session
Pipeline Integration
Testing & Examples: See sample_prompts.md for test prompts demonstrating adaptive task detection (analysis vs generation).
Telemetry & Analytics
MCP Server
Promptheus includes a Model Context Protocol (MCP) server that exposes prompt refinement capabilities as standardized tools for integration with MCP-compatible clients.
What the MCP Server Does
The Promptheus MCP server provides:
- Prompt refinement with Q&A: Intelligent prompt optimization through adaptive questioning
- Prompt tweaking: Surgical modifications to existing prompts
- Model/provider inspection: Discovery and validation of available AI providers
- Environment validation: Configuration checking and connectivity testing
Starting the MCP Server
Prerequisites:
- MCP package installed:
pip install mcp(included in requirements.txt) - At least one provider API key configured (see Configuration)
Available MCP Tools
refine_prompt
Intelligent prompt refinement with optional clarification questions.
Inputs:
prompt(required): The initial prompt to refineanswers(optional): Dictionary mapping question IDs to answers{q0: "answer", q1: "answer"}answer_mapping(optional): Maps question IDs to original question textprovider(optional): Override provider (e.g., "google", "openai")model(optional): Override model name
Response Types:
{"type": "refined", "prompt": "...", "next_action": "..."}: Success with refined prompt{"type": "clarification_needed", "questions_for_ask_user_question": [...], "answer_mapping": {...}}: Questions needed{"type": "error", "error_type": "...", "message": "..."}: Error occurred
tweak_prompt
Apply targeted modifications to existing prompts.
Inputs:
prompt(required): Current prompt to modifymodification(required): Description of changes (e.g., "make it shorter")provider,model(optional): Provider/model overrides
Returns:
{"type": "refined", "prompt": "..."}: Modified prompt
list_models
Discover available models from configured providers.
Inputs:
providers(optional): List of provider names to querylimit(optional): Max models per provider (default: 20)include_nontext(optional): Include vision/embedding models
Returns:
{"type": "success", "providers": {"google": {"available": true, "models": [...]}}}
list_providers
Check provider configuration status.
Returns:
{"type": "success", "providers": {"google": {"configured": true, "model": "..."}}}
validate_environment
Test environment configuration and API connectivity.
Inputs:
providers(optional): Specific providers to validatetest_connection(optional): Test actual API connectivity
Returns:
{"type": "success", "validation": {"google": {"configured": true, "connection_test": "passed"}}}
Prompt Refinement Workflow with Q&A
The MCP server supports a structured clarification workflow for optimal prompt refinement:
Step 1: Initial Refinement Request
Step 2: Handle Clarification Response
Step 3: Collect User Answers
Use your MCP client's AskUserQuestion tool with the provided questions, then map answers to question IDs.
Step 4: Final Refinement with Answers
Response:
AskUser Integration Contract
The MCP server operates in two modes:
Interactive Mode (when AskUserQuestion is available):
- Automatically asks clarification questions via injected AskUserQuestion function
- Returns refined prompt immediately after collecting answers
- Seamless user experience within supported clients
Structured Mode (fallback for all clients):
- Returns
clarification_neededresponse with formatted questions - Client responsible for calling AskUserQuestion tool
- Answers mapped back via
answer_mappingdictionary
Question Format:
Each question in questions_for_ask_user_question includes:
question: The question text to displayheader: Short identifier (Q1, Q2, etc.)multiSelect: Boolean for multi-select optionsoptions: Array of{label, description}for radio/checkbox questions
Answer Mapping:
- Question IDs follow pattern:
q0,q1,q2, etc. - Answers dictionary uses these IDs as keys:
{"q0": "answer", "q1": "answer"} answer_mappingpreserves original question text for provider context
Troubleshooting MCP
MCP Package Not Installed
Fix: pip install mcp or install Promptheus with dev dependencies: pip install -e .[dev]
Missing Provider API Keys
Diagnosis: Use list_providers or validate_environment tools to check configuration status
Provider Misconfiguration
Fix: Set missing API keys in .env file or environment variables
Connection Test Failures
Fix: Verify API keys are valid and have necessary permissions
Full Documentation
Quick reference: promptheus --help
Comprehensive guides:
- 📖 Installation & Setup
- 🚀 Usage Guide
- 🔧 Configuration
- ⌨️ CLI Reference
- 🌐 Web UI Guide
- 🔌 Provider Setup
Development
See CLAUDE.md for detailed development guidance.
License
MIT License - see LICENSE for details
Contributing
Contributions welcome! Please see our development guide for contribution guidelines.
Questions? Open an issue | Live demo: promptheus web
來源:README.md,提交 a2fa5dd
工具
0版本歷史
1- v0.3.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分