Prompt Lab MCP Server
Enables prompt optimization loops and regression test suites for Claude Code, with a companion web UI for real-time visualization of scores and prompt revisions.
README
Prompt Lab MCP Server
Prompt optimization loops and regression test suites for Claude Code, with a companion web UI.
The agent runs inside your Claude Code session and owns all LLM work — scoring responses, proposing improved prompts, applying suggestions. The server holds workspace state and keeps the agent and the Prompt Lab UI in sync.
Quick start
Copy mcp-connect.json from this repo into your project as .mcp.json:
{
"mcpServers": {
"prompt-lab": {
"type": "http",
"url": "https://prompt-lab-mcp.up.railway.app/mcp"
}
}
}
Claude Code connects automatically on next start. Verify with /mcp.
Example session
# 1. Open a workspace — agent shares the UI URL
start_web_app()
→ "Open https://prompt-lab-mcp.vercel.app?s=abc123 to follow along."
# 2. Register an API key
register_api_key(workspaceId, "sk-ant-...")
# 3. Set a system prompt and a test case
set_system_prompt(workspaceId, "You are a concise customer support agent...")
add_test_cases(workspaceId, [{
query: "How do I reset my password?",
targetAnswer: "Click 'Forgot password' on the login page and follow the email link."
}])
# 4. Run the optimization loop
loop_optimization(workspaceId, threshold=85)
→ Iteration 1 — score 58: response too long, no mention of email link
→ Iteration 2 — score 74: better, but missing the exact step
→ Iteration 3 — score 91: SUCCESS — prompt updated to require step-by-step answers
The UI shows each iteration's score, the agent's reasoning, and the revised system prompt in real time.
How it works
Prompt Lab UI (Vercel)
↕ HTTP
Prompt Lab MCP Server (Railway)
↕ MCP
Claude Code (your machine)
MCP tools
Setup
| Tool | Description |
|---|---|
start_web_app(workspaceId?) |
Creates a workspace and returns the Prompt Lab UI URL. |
register_api_key(workspaceId, apiKey, provider?) |
Registers an API key for test runs. Provider is auto-detected from the key prefix. |
list_models(workspaceId) |
Lists available models based on registered keys. |
set_test_model(workspaceId, model) |
Sets the model for test runs. Syncs to the UI model selector. |
delete_session(workspaceId) |
Deletes a workspace and all its state. Irreversible. |
Templates
Templates are global and appear in the UI dropdowns as soon as they are pushed.
| Tool | Description |
|---|---|
save_template(name, testCases) |
Saves a test suite template. Appears in the UI "Load test suite…" dropdown. |
save_system_prompt_template(name, content) |
Saves a system prompt template. Appears in the UI "Load template…" dropdown. |
Workspace state
| Tool | Description |
|---|---|
get_workspace_state(workspaceId) |
Reads the full workspace: system prompt, test cases, results, suggestions, model. |
set_system_prompt(workspaceId, systemPrompt) |
Sets the system prompt without incrementing the iteration counter. |
add_test_cases(workspaceId, testCases, replace?) |
Adds test cases. replace=true overwrites all existing ones. |
post_test_result(workspaceId, testCaseId, response, score, reasoning, model) |
Stores one scored test result. |
post_prompt_suggestion(workspaceId, prompt, reasoning, expectedGain?) |
Queues a revised prompt for review in the UI. |
apply_suggestion(workspaceId, suggestionId) |
Applies a pending suggestion and increments the iteration counter. |
get_regression_status(workspaceId, threshold?) |
Pass/fail summary across all test cases for the current system prompt. |
Optimization
Requires a workspace with at least one test case.
| Tool | Description |
|---|---|
start_optimization_session(workspaceId, threshold?, maxIterations?) |
Single pass — scores test cases, posts one suggestion, then waits for user review in the UI. |
loop_optimization(workspaceId, threshold?, maxIterations?) |
Automated loop — iterates until all scores meet the threshold or max iterations is reached. |
Regression
| Tool | Description |
|---|---|
run_regression_testsuite(workspaceId, threshold?) |
Single pass — scores all test cases, no prompt changes. |
loop_regression(workspaceId, threshold?) |
Automated loop — repeats until every individual score meets the threshold. A high average that masks one failing case is not a pass. |
Archive
| Tool | Description |
|---|---|
pull_ui_history(workspaceId) |
Fetches all session summaries and regression runs pushed by the UI. |
Self-hosting
Deploy to Railway and set these environment variables:
| Variable | Description |
|---|---|
UPSTASH_REDIS_REST_URL |
Upstash Redis URL for persistence |
UPSTASH_REDIS_REST_TOKEN |
Upstash Redis token |
OVERHANG_PROMPT_LAB_URL |
URL of your Prompt Lab UI deployment |
npm install
npm run dev # starts on :3000
MCP endpoint: http://localhost:3000/mcp
License
MIT — see LICENSE.
© 2026 Jurek Föllmer
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。