You signed in with another tab or window. Reload
to refresh your session. You signed out in another tab or window. Reload
to refresh your session. You switched accounts on another tab or window. Reload
to refresh your session. Dismiss alert
gdli6177 / mcp-prompt-server Public
这是一个基于Model Context Protocol (MCP)的服务器,用于根据用户任务需求提供预设的prompt模板,帮助Cline/Cursor/Windsurf...更高效地执行各种任务。服务器将预设的prompt作为工具(tools)返回,以便在Cursor和Windsurf等编辑器中更好地使用。
2 stars
0 forks
Branches
Tags
Activity
Notifications
You must be signed in to change notification settings
main
Go to file
Code
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- |
| Latest commit
-------------
gdli6177
Update README_EN.md
Mar 27, 2025
32055e4
· Mar 27, 2025
History
-------
8 Commits
| | |
| src | | src | | |
| .gitignore | | .gitignore | | |
| README.md | | README.md | | |
| README_EN.md | | README_EN.md | | |
| mcp_config_example.json | | mcp_config_example.json | | |
| package-lock.json | | package-lock.json | | |
| package.json | | package.json | | |
| pnpm-lock.yaml | | pnpm-lock.yaml | | |
| View all files | | |
这是一个基于Model Context Protocol (MCP)的服务器,用于根据用户任务需求提供预设的prompt模板,帮助Cline/Cursor/Windsurf...更高效地执行各种任务。服务器将预设的prompt作为工具(tools)返回,以便在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 # 项目说明文档
cd prompt-server
npm install
npm start
服务器将在标准输入/输出上运行,可以被Cursor、Windsurf或其他MCP客户端连接。
您可以通过在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。
{
"name": "code_review",
"arguments": {
"language": "javascript",
"code": "function add(a, b) { return a + b; }"
}
}
{
"name": "api_documentation",
"arguments": {
"language": "python",
"code": "def process_data(data, options=None):\n # 处理数据\n return result",
"format": "markdown"
}
}
服务器提供以下管理工具:
reload_prompts
: 重新加载所有预设的promptsget_prompt_names
: 获取所有可用的prompt名称此外,所有在src/prompts
目录中定义的prompt模板都会作为工具提供给客户端。
在Cursor中,您需要编辑MCP配置文件:
~/.cursor/
目录){
"servers": [\
{\
"name": "Prompt Server",\
"command": ["node", "/path/to/prompt-server/src/index.js"],\
"transport": "stdio",\
"initialization_options": {}\
}\
]
}
请确保将/path/to/prompt-server
替换为您实际的项目路径。
在Windsurf中,通过以下方式访问MCP配置:
~/.codeium/windsurf/mcp_config.json
文件,添加以下内容:{
"mcpServers": {
"prompt-server": {
"command": "node",
"args": [\
"/path/to/prompt-server/src/index.js"\
],
"transport": "stdio"
}
}
}
请确保将/path/to/prompt-server
替换为您实际的项目路径。
这是一个基于Model Context Protocol (MCP)的服务器,用于根据用户任务需求提供预设的prompt模板,帮助Cline/Cursor/Windsurf...更高效地执行各种任务。服务器将预设的prompt作为工具(tools)返回,以便在Cursor和Windsurf等编辑器中更好地使用。
No releases published
No packages published
You can’t perform that action at this time.