JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q51864F
  • License MIT

MCP server that converts user requests to AI-enhanced prompts using world-class prompt engineering techniques

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (betterprompt-mcp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    BetterPrompt MCP Server

    CI/CD Pipeline npm version MCP Compatible Node.js Version TypeScript License: MIT


    Table of Contents


    Overview

    BetterPrompt MCP is a Model Context Protocol (MCP) server that automatically enhances user prompts using advanced prompt engineering techniques. It exposes a suite of tools for prompt transformation, code generation, analysis, and best practices, making it easy to get optimal results from AI models.

    Instead of manually crafting detailed prompts, BetterPrompt MCP converts simple requests into structured, context-rich instructions tailored for your task and audience.

    Before & After Example

    Without BetterPrompt:

    "Write a function to calculate fibonacci numbers"

    With BetterPrompt Enhancement:

    "Create a JavaScript function that calculates Fibonacci numbers using an efficient algorithm. Include error handling for invalid inputs, support for both iterative and recursive approaches, and clear documentation with time complexity analysis. Format the response with clear code examples and explanations."


    Why BetterPrompt?

    AI models respond much better to well-structured prompts with clear context and instructions. BetterPrompt applies proven prompt engineering techniques to transform your requests into optimal formats that:

    • Increase accuracy - More precise responses with fewer hallucinations
    • Improve structure - Organized, actionable output formats
    • Add context - Relevant background information for better understanding
    • Define constraints - Clear boundaries and requirements
    • Specify success criteria - Know what constitutes a good response

    BetterPrompt works with any MCP-compatible client, including VS Code, Cursor, Claude Desktop, LM Studio, and many others.


    Quickstart

    Install and run via npx:

    npx -y betterprompt-mcp

    Or add to your MCP client configuration:

    {
      "mcpServers": {
        "betterprompt": {
          "command": "npx",
          "args": ["-y", "betterprompt-mcp"]
        }
      }
    }

    Once installed, you can:

    1. Call enhancement tools explicitly – Use the tools below for specific prompt, code, or analysis enhancement
    2. Enable auto-prelude – Configure your client to automatically enhance every prompt (see Auto-Apply Enhancement)

    Install in your coding agent

    Most MCP clients work with this standard config:

    {
      "mcpServers": {
        "betterprompt": {
          "command": "npx",
          "args": ["-y", "betterprompt-mcp"]
        }
      }
    }

    Pick your client below. Where available, click the install button; otherwise follow the manual steps.

    VS Code

    Click a button to install:

    Install in VS Code Install in VS Code Insiders

    Fallback (CLI):

    code --add-mcp '{"name":"betterprompt","command":"npx","args":["-y","betterprompt-mcp"]}'

    Docs: Add an MCP server

    Cursor

    Click to install:

    Install in Cursor

    Or add manually: Settings → MCP → Add new MCP Server → Type: command, Command: npx -y betterprompt-mcp.

    LM Studio

    Click to install:

    Add MCP Server betterprompt to LM Studio

    Or manually: Program → Install → Edit mcp.json, add the standard config above.

    Continue

    Install button: TODO – no public deeplink available yet.

    Manual setup:

    1. Open Continue Settings → open JSON configuration
    2. Add mcpServers entry:
    {
      "mcpServers": {
        "betterprompt": {
          "command": "npx",
          "args": ["-y", "betterprompt-mcp"]
        }
      }
    }

    Restart Continue if needed.

    Goose

    Click to install:

    Install in Goose

    Or manually: Advanced settings → Extensions → Add custom extension → Type: STDIO → Command: npx -y betterprompt-mcp.

    Claude Code (CLI)

    Install via CLI:

    claude mcp add betterprompt npx -y betterprompt-mcp
    Claude Desktop

    Add to claude_desktop_config.json using the standard config above, then restart Claude Desktop. See the MCP quickstart:

    Model Context Protocol – Quickstart

    Windsurf

    Follow the Windsurf MCP documentation and use the standard config above.

    Docs: Windsurf MCP

    Gemini CLI

    Follow the Gemini CLI MCP server guide; use the standard config above.

    Docs: Configure MCP server in Gemini CLI

    Qodo Gen

    Open Qodo Gen chat panel → Connect more tools → + Add new MCP → Paste the standard config above → Save.

    Qodo Gen documentation

    opencode

    Create or edit ~/.config/opencode/opencode.json:

    {
      "$schema": "https://opencode.ai/config.json",
      "mcp": {
        "betterprompt": {
          "type": "local",
          "command": ["npx", "-y", "betterprompt-mcp"],
          "enabled": true
        }
      }
    }

    opencode MCP documentation


    Tools

    enhance-prompt

    General prompt enhancement using advanced prompt engineering techniques.

    Input:

    • prompt (string, required): The user request to enhance
    • category (string, optional): One of general, code, analysis, creative, research

    Output: AI-enhanced prompt with structure, context, and clear instructions.

    Example Usage:

    {
      "name": "enhance-prompt",
      "arguments": {
        "prompt": "Write a function to calculate fibonacci numbers",
        "category": "code"
      }
    }

    enhance-code-prompt

    Specialized enhancement for code generation prompts.

    Input:

    • prompt (string, required): The code-related request to enhance
    • language (string, optional): Programming language or technology stack
    • complexity (string, optional): beginner, intermediate, or advanced

    Output: AI-enhanced code prompt with detailed requirements and context.

    Example Usage:

    {
      "name": "enhance-code-prompt",
      "arguments": {
        "prompt": "Write a Python function to sort a list of numbers",
        "language": "Python",
        "complexity": "advanced"
      }
    }

    enhance-analysis-prompt

    Specialized enhancement for analysis prompts.

    Input:

    • prompt (string, required): The analysis request to enhance
    • domain (string, optional): Specific domain or field of analysis
    • depth (string, optional): overview, detailed, or comprehensive

    Output: AI-enhanced analysis prompt with structured guidance.

    Example Usage:

    {
      "name": "enhance-analysis-prompt",
      "arguments": {
        "prompt": "Analyze the impact of climate change on polar bears",
        "domain": "environment",
        "depth": "comprehensive"
      }
    }

    get-template

    Retrieve prompt engineering templates for various tasks.

    Input:

    • category (string, required): One of code-generation, technical-analysis, creative-writing, research-synthesis

    Output: Prompt engineering template for the specified category.

    Example Usage:

    {
      "name": "get-template",
      "arguments": {
        "category": "code-generation"
      }
    }

    get-best-practices

    Get comprehensive best practices guide for prompt engineering.

    Output: Detailed guide on best practices for writing effective prompts.

    Example Usage:

    {
      "name": "get-best-practices",
      "arguments": {}
    }

    server-stats

    View server performance statistics.

    Output: Current server statistics including uptime, memory usage, and cache status.

    Example Usage:

    {
      "name": "server-stats",
      "arguments": {}
    }

    clear-cache

    Clear enhancement cache.

    Output: Confirmation of cache clearance.

    Example Usage:

    {
      "name": "clear-cache",
      "arguments": {}
    }

    Usage Examples

    Basic Prompt Enhancement

    Request:

    {
      "name": "enhance-prompt",
      "arguments": {
        "prompt": "Explain quantum computing",
        "category": "analysis"
      }
    }

    Enhanced Result:

    "Provide a comprehensive explanation of quantum computing for a technical audience. Cover fundamental concepts including qubits, superposition, entanglement, and quantum gates. Compare classical vs. quantum computing approaches. Include real-world applications and current limitations. Structure the response with clear headings and examples."

    Code Generation Enhancement

    Request:

    {
      "name": "enhance-code-prompt",
      "arguments": {
        "prompt": "Create a React component for a todo list",
        "language": "TypeScript",
        "complexity": "advanced"
      }
    }

    Enhanced Result:

    "Build a React component for a todo list application with the following features: add new todos, mark as complete, delete items, and filter by status (all/active/completed). Use modern React hooks (useState, useEffect) and ensure accessible HTML. Include proper TypeScript typing, CSS styling, and error handling. Provide a clean, user-friendly interface with responsive design."

    Analysis Enhancement

    Request:

    {
      "name": "enhance-analysis-prompt",
      "arguments": {
        "prompt": "Analyze the sales data for 2023",
        "domain": "business",
        "depth": "comprehensive"
      }
    }

    Enhanced Result:

    "Perform a detailed analysis of the sales data for 2023. Identify key trends, seasonal patterns, and anomalies. Provide predictions for the next quarter based on historical data. Use visualizations like charts and graphs to illustrate findings. Ensure the analysis is actionable with clear recommendations."


    Auto-Apply Enhancement

    BetterPrompt offers a unique feature that automatically enhances every prompt without requiring manual tool calls.

    How it works

    When you enable the betterprompt-default-prelude in your MCP client:

    1. Every user request is internally enhanced using world-class prompt engineering techniques
    2. The assistant applies the enhanced version to plan its reasoning
    3. The assistant produces a superior result without mentioning the enhancement process
    4. Your workflow remains simple - no need to call tools explicitly

    Enabling Auto-Enhancement

    Many MCP clients allow selecting a prompt template to include at the start of a chat or session. BetterPrompt publishes:

    • betterprompt-default-prelude

    Enable this prompt in your client's "Prompts" or "Prelude/System" section to automatically apply BetterPrompt techniques to each user message.

    Notes:

    • The exact UI for enabling a default prompt varies by MCP client
    • Look for a way to select or add a "prompt"/"system"/"prelude" entry for a server
    • This approach works across MCP clients because it relies on standard prompts/list and get_prompt support

    Best Practices

    Writing Prompts for BetterPrompt

    To get the most out of BetterPrompt, consider these tips when crafting your initial prompts:

    1. Be specific about the task: Instead of "explain databases", try "explain database normalization for a beginner"
    2. Mention the audience: Include who the content is for (developers, managers, students, etc.)
    3. Specify the format: Request specific output formats when helpful (bullet points, code, tables, etc.)
    4. Include constraints: Mention any limitations like word count, technical level, or specific requirements
    5. State the purpose: Explain what you'll use the information for

    When to Use Manual vs. Auto Enhancement

    Use Manual Enhancement (enhance-prompt tool) when:

    • You want to see the enhanced prompt before using it
    • You're working on critical tasks where you want to review the enhancement
    • You only need to enhance specific prompts occasionally

    Use Auto Enhancement (prelude) when:

    • You want all prompts enhanced without extra steps
    • You're doing exploratory work or brainstorming
    • You prefer a seamless experience without manual tool calls

    Troubleshooting

    Common Issues

    Server not starting

    • Ensure you have Node.js >= 18 installed
    • Run npx -y betterprompt-mcp directly in your terminal to check for errors
    • Confirm your MCP client supports stdio transport

    Tool not appearing in client

    • Verify the server is running and responding
    • Check your MCP client configuration
    • Restart your MCP client after adding the server

    Auto-prelude not working

    • Confirm your client supports the prompts/list and prompts/get MCP methods
    • Ensure you've enabled the betterprompt-default-prelude prompt
    • Some clients may require a restart after enabling prompts

    Debugging

    BetterPrompt logs enhancement activities and errors to stderr. If you encounter issues:

    1. Check your MCP client's logs for error messages
    2. Run the server directly to see console output:
    npx -y betterprompt-mcp
    1. Look for [INFO], [WARN], [ERROR], and [SUCCESS] log messages for diagnostics

    Development

    Project Structure

    betterprompt-mcp/
    ├── src/
    │   └── index.ts          # Main server implementation
    ├── tests/                # Test files and verification scripts
    ├── dist/                 # Compiled output (generated)
    ├── package.json          # Dependencies and scripts
    ├── tsconfig.json         # TypeScript configuration
    └── README.md             # Documentation

    Build & Development

    Build:

    npm run build

    Watch (dev):

    npm run watch

    Format:

    npm run format
    npm run format:check

    Test:

    npm run test:comprehensive

    License

    MIT License


    Support

    For questions or issues, open an issue on GitHub or contact the author via GitHub profile.


    Author

    Aung Myo Kyaw (GitHub)