Prompt Lab MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Prompt Lab MCP ServerStart a new prompt optimization workspace and show me the UI."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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.
Related MCP server: Petamind 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 answersThe UI shows each iteration's score, the agent's reasoning, and the revised system prompt in real time.
How it works
Prompt Lab UI (github.com/jurek-f/prompt-lab)
↕ HTTP
Prompt Lab MCP Server (Railway)
↕ MCP
Claude Code (your machine)API keys
API keys are never stored in the MCP server config. Instead, pass them to Claude Code as environment variables — the agent reads them and registers them with the server at the start of each session using register_api_key.
Set the key(s) for the provider(s) you want to use. The agent auto-detects the provider from the key prefix when calling register_api_key.
If they're already in your system environment, Claude Code inherits them automatically — nothing else to do. Otherwise add them to ~/.claude/env or your shell profile:
ANTHROPIC_API_KEY=sk-ant-...
GEMINI_API_KEY=AIza...
OPENAI_API_KEY=sk-...MCP tools
Setup
Tool | Description |
| Creates a workspace and returns the Prompt Lab UI URL. |
| Registers an API key for test runs. Provider is auto-detected from the key prefix. |
| Lists available models based on registered keys. |
| Sets the model for test runs. Syncs to the UI model selector. |
| 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 |
| Saves a test suite template. Appears in the UI "Load test suite…" dropdown. |
| Saves a system prompt template. Appears in the UI "Load template…" dropdown. |
Workspace state
Tool | Description |
| Reads the full workspace: system prompt, test cases, results, suggestions, model. |
| Sets the system prompt without incrementing the iteration counter. |
| Adds test cases. |
| Stores one scored test result. |
| Queues a revised prompt for review in the UI. |
| Applies a pending suggestion and increments the iteration counter. |
| Pass/fail summary across all test cases for the current system prompt. |
Optimization
Requires a workspace with at least one test case.
Tool | Description |
| Single pass — scores test cases, posts one suggestion, then waits for user review in the UI. |
| Automated loop — iterates until all scores meet the threshold or max iterations is reached. |
Regression
Tool | Description |
| Single pass — scores all test cases, no prompt changes. |
| 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 |
| 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 URL for persistence |
| Upstash Redis token |
| URL of your Prompt Lab UI deployment |
npm install
npm run dev # starts on :3000MCP endpoint: http://localhost:3000/mcp
License
MIT — see LICENSE.
© 2026 Jurek Föllmer
Maintenance
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/jurek-f/prompt-lab-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server