KitchenAI Prompts Manager 使用说明
项目简介
KitchenAI Prompts Manager 是一个 Prompt 管理系统,旨在帮助用户轻松地对 Prompt 进行版本控制、查看、管理、评估,并将其集成到代码中。它包含一个用 Go 编写的 Web 应用程序,用于管理 Prompt 仓库,以及一个 Python MCP 服务器,用于本地集成和与 LLM 客户端通信。
主要功能点:
- Prompt 管理: 存储、版本控制和检索 Prompt。
- 版本控制: 跟踪 Prompt 的更改历史。
- 评论: 对 Prompt 添加注释和反馈。
- 评估: 对 Prompt 的性能进行评分和提供反馈。
- 集成: 轻松将 Prompt 集成到代码中。
- MCP 服务器: 本地服务器,通过 API 与中央 Prompt 仓库通信,并提供 MCP 协议支持。
安装步骤
-
克隆仓库:
git clone https://github.com/epuerta9/prompts.kitchenai.git cd prompts.kitchenai -
安装 Go (Backend) 依赖: 确保已安装 Go 1.16 或更高版本。
go mod tidy -
构建前端 (Frontend): 确保已安装 Node.js 14 或更高版本。
cd frontend npm install npm run build cd .. -
设置环境变量 (Backend):
export DATABASE_URL=file:./prompts.db?_foreign_keys=on # 本地开发使用 SQLite -
运行 Backend 服务器 (可选): 如果你需要使用 Web 界面管理 Prompt,请运行 Go backend 服务器。
go run cmd/server/main.go访问 http://localhost:8080 使用 Web 界面。
-
安装 Python MCP 服务器 (MCP Server): 确保已安装 Python 3.7 或更高版本。
cd python_mcp pip install -e . -
运行 Python MCP 服务器 (MCP Server):
kitchenai-mcp或者直接运行:
python python_mcp/mcp_server.pyMCP 服务器默认监听端口为 '8081'。
服务器配置 (MCP Server)
以下 JSON 配置信息可用于 MCP 客户端连接 Python MCP 服务器。你需要根据实际情况调整 'command' 和 'args' 字段,确保 MCP 客户端能够正确启动和连接到 MCP 服务器。
{ "serverName": "KitchenAI MCP Server", "command": "kitchenai-mcp", "args": [], "transport": "stdio", "protocol": "json-rpc" }
配置信息说明:
- 'serverName': MCP 服务器的名称,可以自定义。
- 'command': 启动 MCP 服务器的命令。这里使用 'kitchenai-mcp',前提是你已经通过 'pip install -e .' 安装了 Python MCP 包。如果直接运行 'python python_mcp/mcp_server.py',则 'command' 应该设置为 Python 解释器路径,'args' 设置为 '["python_mcp/mcp_server.py"]'。
- 'args': 启动命令的参数,本例中无需额外参数。
- 'transport': MCP 客户端与服务器通信的传输协议,这里使用 'stdio' (标准输入输出)。
- 'protocol': MCP 客户端与服务器通信的协议,这里使用 'json-rpc'。
基本使用方法 (MCP Server)
-
启动 MCP 服务器: 按照上述安装步骤启动 Python MCP 服务器。
-
配置 MCP 客户端: 在你的 LLM 客户端 (例如,某个 IDE 插件或应用程序) 中,配置 MCP 服务器连接信息,使用上面提供的 JSON 配置。
-
Prompt 集成到代码: 在你的代码文件中,使用特殊注释标记 Prompt 位置:
// PROMPT:your-prompt-id // Your current prompt will be replaced here // PROMPT:END -
使用 MCP 客户端集成 Prompt: 在 MCP 客户端中,指定 Prompt ID ('your-prompt-id') 和代码文件路径,客户端会连接到 MCP 服务器,获取 Prompt 内容,并自动替换代码中标记的区域。
-
通过 Web 界面管理 Prompt (可选): 访问 http://localhost:8080 使用 Web 界面创建、编辑、查看和管理 Prompt。Python MCP 服务器会与该 Web 界面管理的 Prompt 仓库同步。
注意:
- Python MCP 服务器依赖于 Go backend 服务器提供的 API。确保 Go backend 服务器 (如果使用 Web 界面) 或 Python MCP 服务器配置的 'api_url' 指向正确的 Go backend API 地址 (默认为 'http://localhost:8080')。
- 你可以使用 Web 界面或者直接调用 Python MCP 服务器提供的 API 来管理和集成 Prompt。
信息
分类
开发者工具