MCP ExplorerExplorer

Reprompter Mcp

@Mnehmoson a year ago
29 ISC
FreeCommunity
AI Systems
An MCP server for prompt analysis and refactoring using AI.

Overview

What is Reprompter Mcp

Reprompter-mcp is an MCP (Model Context Protocol) server designed to analyze prompts, compare them with relevant data, and utilize OpenRouter (Claude 3.7 Sonnet) to refactor them for improved effectiveness.

Use cases

Use cases for reprompter-mcp include enhancing chatbot interactions, improving AI-generated content quality, optimizing user prompts in applications, and refining communication strategies in automated systems.

How to use

To use reprompter-mcp, clone the repository, install dependencies using ‘npm install’, create a .env file with your OpenRouter API key, and start the server with ‘npm start’. Configure the MCP settings by copying the template configuration file and updating it with your specific paths.

Key features

Key features of reprompter-mcp include prompt analysis to identify strengths and weaknesses, prompt refactoring using AI for effectiveness, context integration for better analysis, and application of specific prompt engineering techniques.

Where to use

Reprompter-mcp can be used in various fields that require prompt optimization, including AI development, customer support automation, content generation, and any application that relies on effective prompt usage.

Content

Reprompter MPC Server

An MCP (Model Context Protocol) server that analyzes prompts, compares them with relevant data, and uses OpenRouter (Claude 3.7 Sonnet) to refactor them.

Features

  • Prompt Analysis: Analyze prompts to identify strengths, weaknesses, and suggested improvements
  • Prompt Refactoring: Refactor prompts using AI to improve their effectiveness
  • Context Integration: Incorporate relevant context and chat history into the analysis and refactoring process
  • Technique Application: Apply specific prompt engineering techniques to improve prompts

Installation

  1. Clone the repository
  2. Install dependencies:
    npm install
    
  3. Create a .env file with your OpenRouter API key:
    OpenRouter_API_KEY=your-api-key
    
  4. Build the project:
    npm run build
    

Security

API Key Management

To securely manage your OpenRouter API key:

  1. Never hard-code API keys in files that might be committed to version control
  2. Use environment variables to store sensitive credentials
  3. Add .env to your .gitignore file to prevent accidentally committing it
  4. Consider using a secrets manager for production deployments

Environment Variable Setup

# On Windows
setx OPENROUTER_API_KEY "your-api-key"

# On macOS/Linux
export OPENROUTER_API_KEY="your-api-key"

Usage

Starting the Server

npm start

Configuring in MCP Settings

A template configuration file is provided in reprompter-mpc-config.template.json. Copy this file to reprompter-mpc-config.json and update it with your specific paths:

{
  "mcpServers": {
    "reprompter": {
      "command": "node",
      "args": [
        "build/index.js"
      ],
      "cwd": "PATH_TO_YOUR_REPROMPTER_MPC_DIRECTORY",
      "env": {
        "OpenRouter_API_KEY": "${OPENROUTER_API_KEY}"
      },
      "alwaysAllow": [
        "analyze_prompt",
        "refactor_prompt"
      ]
    }
  }
}

Important:

  1. Replace PATH_TO_YOUR_REPROMPTER_MPC_DIRECTORY with the absolute path to your reprompter-mpc directory
  2. Set up your OpenRouter API key using environment variables as described in the security section below
  3. Add this configuration to your MCP settings file

Available Tools

analyze_prompt

Analyzes a prompt and provides structured feedback on its strengths, weaknesses, and suggested improvements.

Input Schema:

{
  "prompt": "The prompt to analyze",
  "context": "Optional context relevant to the prompt",
  "chatHistory": [
    {
      "role": "user|assistant|system",
      "content": "Content of the message",
      "timestamp": "Optional timestamp"
    }
  ]
}

Output:

refactor_prompt

Refactors a prompt using AI to improve its effectiveness based on analysis and suggested techniques.

Input Schema:

Output:
The refactored prompt text.

Example Usage

// Example of using the analyze_prompt tool
const analysis = await use_mcp_tool({
  server_name: "reprompter",
  tool_name: "analyze_prompt",
  arguments: {
    prompt: "Tell me about the history of artificial intelligence.",
    context: "The user is a beginner in AI concepts."
  }
});

// Example of using the refactor_prompt tool
const refactoredPrompt = await use_mcp_tool({
  server_name: "reprompter",
  tool_name: "refactor_prompt",
  arguments: {
    prompt: "Tell me about the history of artificial intelligence.",
    analysis: analysis, // Result from analyze_prompt
    techniques: ["Chain-of-Thought", "Few-Shot Examples"],
    context: "The user is a beginner in AI concepts."
  }
});

Contributing

Contributions are welcome! Here’s how you can contribute to this project:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature/your-feature-name)
  3. Make your changes
  4. Commit your changes (git commit -m 'Add some feature')
  5. Push to the branch (git push origin feature/your-feature-name)
  6. Open a Pull Request

Please make sure your code follows the existing style and includes appropriate tests.

GitHub Features

Issues

If you encounter any bugs or have feature requests, please open an issue on GitHub. When creating an issue, please provide:

  • A clear and descriptive title
  • A detailed description of the issue or feature request
  • Steps to reproduce the issue (if applicable)
  • Any relevant logs or error messages
  • Your environment (OS, Node.js version, etc.)

Pull Requests

Pull requests are welcome! Please see the Contributing section for guidelines.

License

ISC - See LICENSE file for details.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers