promptrix-mcp
v0.1.1
Published
MCP Server for Promptrix - AI prompt enhancement and optimization for Claude Code
Maintainers
Readme
Promptrix MCP Server
A Model Context Protocol (MCP) server that provides AI prompt enhancement and optimization capabilities to Claude Code and other MCP-compatible clients.
Features
- enhance_prompt: Enhance individual prompts using advanced prompt engineering techniques
- auto_analyze_prompt: Analyze prompt quality and suggest improvements
- Configurable enhancement parameters (style, format, language, complexity level)
- Integration with the Promptrix API using API key authentication
- Full TypeScript support with comprehensive error handling
Quick Start
Installation
No installation required! Use npx to run directly:
{
"mcpServers": {
"promptrix": {
"type": "stdio",
"command": "npx",
"args": ["-y", "promptrix-mcp"],
"env": {
"PROMPTRIX_API": "https://api.promptrix.co",
"PROMPTRIX_API_KEY": "${PROMPTRIX_API_KEY}"
}
}
}
}Get Your API Key
Sign up at promptrix.co to get your API key, or run the Promptrix API locally:
# For local development
export PROMPTRIX_API_KEY="prx_live_your_api_key_here"Configure Claude Code
Add the MCP server to your Claude Code configuration file (.mcp.json or claude_desktop_config.json):
{
"mcpServers": {
"promptrix": {
"type": "stdio",
"command": "npx",
"args": ["-y", "promptrix-mcp"],
"env": {
"PROMPTRIX_API": "https://api.promptrix.co",
"PROMPTRIX_API_KEY": "${PROMPTRIX_API_KEY}"
}
}
}
}For local development:
{
"mcpServers": {
"promptrix": {
"type": "stdio",
"command": "npx",
"args": ["-y", "promptrix-mcp"],
"env": {
"PROMPTRIX_API": "http://localhost:8787",
"PROMPTRIX_API_KEY": "${PROMPTRIX_API_KEY}"
}
}
}
}Usage in Claude Code
Once configured, you can use the prompt enhancement tools directly in Claude Code:
Can you enhance this prompt: "how to add 2 numbers in node"Or analyze prompt quality:
Can you analyze the quality of this prompt: "make a function"Available Tools
enhance_prompt
Enhances a single prompt with optional parameters:
- prompt (required): The original prompt to enhance
- style (optional): Style preference - detailed, concise, creative, technical, professional, casual
- format (optional): Output format - markdown, json, structured, list, paragraph
- language (optional): Target language (e.g., en, es, fr, de)
- level (optional): Complexity level - beginner, intermediate, advanced, expert
- constraints (optional): Specific constraints or requirements
auto_analyze_prompt
Analyzes prompt quality and suggests improvements:
- prompt (required): The prompt to analyze for quality issues
- threshold (optional): Quality threshold (0-100). Prompts below this score will trigger enhancement suggestions. Default: 70
Configuration
Environment Variables
- PROMPTRIX_API: URL of the Promptrix API server (default: http://localhost:8787)
- PROMPTRIX_API_KEY: Your Promptrix API key (required for authentication)
- PROMPTRIX_AUTO_THRESHOLD: Quality threshold for auto-analysis (default: 70)
API Requirements
The MCP server requires the Promptrix API to be running with API key authentication enabled. The API should expose a /api/optimize endpoint that accepts POST requests with Bearer token authentication:
{
"prompt": "string",
"style": "string (optional)",
"format": "string (optional)",
"language": "string (optional)",
"level": "string (optional)",
"constraints": "string (optional)"
}Development
# Development mode with hot reload
npm run dev
# Type checking
npm run typecheck
# Linting
npm run lint
# Format code
npm run formatIntegration Examples
Basic Enhancement
enhance_prompt({
"prompt": "how to use React hooks",
"style": "detailed",
"format": "structured"
})Quality Analysis
auto_analyze_prompt({
"prompt": "make a function",
"threshold": 70
})Error Handling
The server provides comprehensive error handling for:
- Invalid parameters
- API connectivity issues
- Malformed responses
- Network timeouts
- Authentication failures
All errors are returned as structured MCP error responses with appropriate error codes and descriptive messages.
License
MIT
