MCP Prompt Server

MCP Prompt Server

A server based on Model Context Protocol that provides predefined prompt templates for tasks like code review and API documentation generation, enabling more efficient workflows in Cursor/Windsurf editors.

gdli6177

Developer Tools
Visit Server

README

MCP Prompt Server

English Version

这是一个基于Model Context Protocol (MCP)的服务器,用于根据用户任务需求提供预设的prompt模板,帮助Cline/Cursor/Windsurf...更高效地执行各种任务。服务器将预设的prompt作为工具(tools)返回,以便在Cursor和Windsurf等编辑器中更好地使用。

功能特点

  • 提供预设的prompt模板,可用于代码审查、API文档生成、代码重构等任务
  • 将所有prompt模板作为MCP工具(tools)提供,而非MCP prompts格式
  • 支持动态参数替换,使prompt模板更加灵活
  • 允许开发者自由添加和修改prompt模板
  • 提供工具API,可重新加载prompt和查询可用prompt
  • 专为Cursor和Windsurf等编辑器优化,提供更好的集成体验

目录结构

prompt-server/
├── package.json         # 项目依赖和脚本
├── src/                 # 源代码目录
│   ├── index.js         # 服务器入口文件
│   └── prompts/         # 预设prompt模板目录
│       ├── code_review.yaml
│       ├── api_documentation.yaml
│       ├── code_refactoring.yaml
│       ├── test_case_generator.yaml
│       └── project_architecture.yaml
└── README.md            # 项目说明文档

安装和使用

  1. 安装依赖:
cd prompt-server
npm install
  1. 启动服务器:
npm start

服务器将在标准输入/输出上运行,可以被Cursor、Windsurf或其他MCP客户端连接。

添加新的Prompt模板

您可以通过在src/prompts目录中添加新的YAML或JSON文件来创建新的prompt模板。每个模板文件应包含以下内容:

name: prompt_name                # 唯一标识符,用于调用此prompt
description: prompt description  # 对prompt功能的描述
arguments:                       # 参数列表(可选)
  - name: arg_name               # 参数名称
    description: arg description # 参数描述
    required: true/false         # 是否必需
messages:                        # prompt消息列表
  - role: user/assistant         # 消息角色
    content:
      type: text                 # 内容类型
      text: |                    # 文本内容,可包含参数占位符 {{arg_name}}
        Your prompt text here...

添加新文件后,服务器会在下次启动时自动加载,或者您可以使用reload_prompts工具重新加载所有prompt。

使用示例

在Cursor或Windsurf中调用代码审查工具

{
  "name": "code_review",
  "arguments": {
    "language": "javascript",
    "code": "function add(a, b) { return a + b; }"
  }
}

在Cursor或Windsurf中调用API文档生成工具

{
  "name": "api_documentation",
  "arguments": {
    "language": "python",
    "code": "def process_data(data, options=None):\n    # 处理数据\n    return result",
    "format": "markdown"
  }
}

工具API

服务器提供以下管理工具:

  • reload_prompts: 重新加载所有预设的prompts
  • get_prompt_names: 获取所有可用的prompt名称

此外,所有在src/prompts目录中定义的prompt模板都会作为工具提供给客户端。

与编辑器集成

Cursor

在Cursor中,您需要编辑MCP配置文件:

  1. 找到或创建Cursor的MCP配置文件(通常位于~/.cursor/目录)
  2. 添加以下内容:
{
  "servers": [
    {
      "name": "Prompt Server",
      "command": ["node", "/path/to/prompt-server/src/index.js"],
      "transport": "stdio",
      "initialization_options": {}
    }
  ]
}

请确保将/path/to/prompt-server替换为您实际的项目路径。

  1. 保存配置并重启编辑器
  2. 现在您应该能够在工具面板中看到所有可用的prompt工具

Windsurf

在Windsurf中,通过以下方式访问MCP配置:

  1. 导航至 Windsurf - 设置 > 高级设置,或
  2. 使用命令面板 > 打开Windsurf设置页面
  3. 滚动到Cascade部分,您会看到添加新服务器的选项
  4. 点击"添加服务器"按钮,然后选择"添加自定义服务器+"
  5. 或者,您可以直接编辑~/.codeium/windsurf/mcp_config.json文件,添加以下内容:
{
  "mcpServers": {
    "prompt-server": {
      "command": "node",
      "args": [
        "/path/to/prompt-server/src/index.js"
      ],
      "transport": "stdio"
    }
  }
}

请确保将/path/to/prompt-server替换为您实际的项目路径。

  1. 添加服务器后,点击刷新按钮
  2. 现在您应该能够在工具面板中看到所有可用的prompt工具

扩展建议

  1. 添加更多专业领域的prompt模板
  2. 实现prompt版本控制
  3. 添加prompt分类和标签
  4. 实现prompt使用统计和分析
  5. 添加用户反馈机制

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

Linear MCP Server

A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Featured
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python