一个智能提示词MCP服务器
Project description
Smart Prompt MCP
一个基于MCP协议的智能提示词模板管理工具。
功能特点
- 支持提示词模板的添加、更新、删除和查询
- 支持使用双中括号语法引用模板,如
[[模板名]] - 配置文件自动保存和加载
- 支持自定义配置文件路径
- 提供调试模式
快速开始
方式一:直接运行(无需安装)
# 克隆仓库
git clone https://github.com/jiayimu/smart_prompt_mcp.git
cd smart_prompt_mcp
# 安装依赖
pip3 install -r requirements.txt
# 直接运行
python3 smart_prompt_mcp/__main__.py [--config CONFIG_FILE] [--debug]
方式二:安装后运行
- 安装步骤:
# 克隆仓库
git clone https://github.com/jiayimu/smart_prompt_mcp.git
cd smart_prompt_mcp
# 安装依赖并安装包
pip3 install -r requirements.txt
pip3 install .
方式三:直接使用pip安装
# 安装包
pip3 install smart-prompt-mcp
# 运行
python3 -m smart_prompt_mcp [--config CONFIG_FILE] [--debug]
卸载说明
如果遇到以下情况:
Found existing installation: smart_prompt_mcp 0.1.4
Can't uninstall 'smart_prompt_mcp'. No files were found to uninstall.
这表示包的记录存在但文件已丢失,解决方法:
# 1. 使用 pip 强制重新安装
pip3 install --force-reinstall smart_prompt_mcp
# 2. 然后再次卸载
pip3 uninstall smart_prompt_mcp -y
# 或者直接清除 pip 的包记录(如果上述方法不起作用)
pip3 install pip-autoremove
pip-autoremove smart_prompt_mcp -y
使用方法
1. 启动服务器
python3 -m smart_prompt_mcp [--config CONFIG_FILE] [--debug]
参数说明:
--config: 指定配置文件路径(可选,默认为 ~/prompt_templates.json)--debug: 启用调试日志(可选)
2. 可用工具
-
smart_template: 替换输入中的关键词- 输入: 包含
[[关键字]]的文本 - 输出: 替换后的文本
- 输入: 包含
-
add_template: 添加新的关键词和提示词- 参数:
- keyword: 关键字
- prompt: 提示词内容
- 参数:
-
reset_template: 更新已存在的关键词对应的提示词- 参数:
- keyword: 关键字
- prompt: 新的提示词内容
- 参数:
-
show_template: 显示特定关键词的提示词- 参数:
- keyword: 关键字
- 参数:
-
show_all_templates: 显示所有存储的关键词和提示词 -
delete_template: 删除特定的关键词和提示词- 参数:
- keyword: 要删除的关键字
- 参数:
3. 使用示例
# 添加模板
add_template("接口分析", "分析该接口的入参、出参、业务逻辑和注意事项")
add_template("代码优化", "分析代码的性能瓶颈,提供优化建议")
# 使用模板
smart_template("请帮我[[接口分析]]")
smart_template("这段代码需要[[代码优化]],请帮我看看")
# 更新模板
reset_template("接口分析", "详细分析该接口的:\n1. 请求参数\n2. 响应结构\n3. 业务流程\n4. 异常处理\n5. 性能考虑")
# 查看特定模板
show_template("接口分析")
# 查看所有模板
show_all_templates()
# 删除模板
delete_template("代码优化")
# 复杂示例:组合多个模板
smart_template("这个接口需要[[接口分析]],同时也需要[[性能优化]]和[[安全检查]]")
配置文件格式
配置文件为JSON格式,结构如下:
{
"关键字1": "提示词内容1",
"关键字2": "提示词内容2"
}
依赖
- Python >= 3.10
- fastmcp >= 0.1.0
建议使用Python 3.10或更高版本以获得最佳性能和兼容性。
许可证
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smart_prompt_mcp-0.1.5.tar.gz.
File metadata
- Download URL: smart_prompt_mcp-0.1.5.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08275f88c0c7b777d88ac602030a84eebdff15999c4e33502f5be04a850e0696
|
|
| MD5 |
bdb90fa28a431ea4ff6420f99e2142cf
|
|
| BLAKE2b-256 |
3ec1141ecaa3f3fe8cc0f158164162287d33ee1a3e3f6e14175b56ee2f634630
|
File details
Details for the file smart_prompt_mcp-0.1.5-py3-none-any.whl.
File metadata
- Download URL: smart_prompt_mcp-0.1.5-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e433f1dd49f4aaf7c86975f52d3196329272c53369a8c027e80ecd5e21dedf88
|
|
| MD5 |
60ea06ea395b54a5771b00f782fa3f21
|
|
| BLAKE2b-256 |
fe492d5fc465f018ff304578adbd24bde2901196d07716ac1848f9445b0e4ef0
|