代码提示优化工具

该工具使用Claude 3 Sonnet智能重写代码提示,优化AI IDE(如Cursor AI)的使用效果,适用于开发者在编写代码时获得更清晰、结构化的提示。

  • by hireshBrem
  • JavaScript
  • 本地部署
  • 13 星标
  • 更新于
在 GitHub 查看 hireshBrem/prompt-engineer-mcp-server

使用说明

MCP服务器编码提示工程师

此模型上下文协议(MCP)服务器提供了一种工具,可以使用Anthropic的Claude使用Cursor AI和其他AI IDE重写编码提示以获得最佳结果。

安装

npm install

通过Smithery安装

您可以通过访问Smithery直接安装此MCP服务器: https://smithery.ai/server/@hireshBrem/prompt工程师mcp服务器

用法

设置环境变量

服务器需要Anthropic API密钥才能使用Claude进行格式化。将其设置为环境变量:

export ANTHROPIC_API_KEY=your_anthropic_api_key

如果没有提供API密钥,服务器将抛出一个错误,指示缺少API密钥。

运行服务器

npm start

或与MCP检查员联系:

npx @modelcontextprotocol/inspector npm start

工具:rewrite_coding_prompt

该工具采用原始提示,并使用Cursor AI和其他AI IDE对其进行重写以获得最佳结果。

参数

  • prompt (必填):需要重写的原始用户提示
  • language (必填):代码的编程语言

示例用法

{
  "name": "rewrite_coding_prompt",
  "arguments": {
    "prompt": "Create a function to convert temperature between Celsius and Fahrenheit",
    "language": "typescript"
  }
}

运作原理

服务器使用Anthropic的Claude 3 Sonnet智能重写您的提示,以获得更好的结果。它通过以下方式增强您的提示:

  1. 添加清晰的结构和上下文
  2. 明确要求和期望
  3. 包括特定语言的考虑因素
  4. 优化AI IDE理解

特性

  • 智能提示工程:使用Claude 3 Sonnet重写提示以获得最佳结果
  • 语言意识:根据目标编程语言自定义提示
  • 易于集成:与Cursor和其他AI IDE无缝协作
  • 低温设置:使用0.2温度实现一致、结构化的输出

配置

使用Claude Desktop

将此添加到您的 claude_desktop_config.json:

NPX

{
  "mcpServers": {
    "cursor-prompt-engineer": {
      "command": "npx",
      "args": [
        "-y",
        "cursor-prompt-engineer"
      ]
    }
  }
}

本地安装

# Clone the repository
git clone https://github.com/yourusername/cursor-prompt-engineer.git
cd cursor-prompt-engineer

# Install dependencies
npm install

# Run the server
node index.js

示例

输入:

Create a function that sorts an array of objects by a specific property

有论点:

{
  "prompt": "Create a function that sorts an array of objects by a specific property",
  "language": "typescript"
}

该工具将重写提示,使其更加结构化和详细,以便使用您的AI IDE获得最佳结果。

许可证

此MCP服务器根据MIT许可证获得许可。这意味着您可以根据MIT许可证的条款和条件自由使用、修改和分发软件。有关更多详细信息,请参阅项目存储库中的LICENSE文件。