Token导航 LogoToken导航TokenDH.com
Prompt Saver MCP logo
搜索检索stdio官方级别未说明来源级核验

Prompt Saver MCP

MCP Server

一个将成功对话线程转换为可重用提示词模板的服务,支持语义搜索、分类管理和AI优化功能,适用于代码生成、文本生成等多种场景。

工具数

6

提示词数

0

GitHub Stars

0

资源数

0
代码生成PythonCursor搜索Cursor

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

subhromondb

提供方

subhromondb

最后核验

2026/5/17 20:19

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install -e .

详细介绍

提示保护程序MCP服务器

MCP服务器,将成功的对话线程转换为可重用的提示,可用于未来的任务。基于这样一个原则,即LLM交互中最重要的工件是你为产生结果所做的工作,而不是结果本身。

特性

  • 将对话另存为提示:将对话线程转换为可重用的markdown格式的提示模板
  • 语义搜索:使用Voyage AI嵌入的矢量搜索查找相关提示
  • 及时管理:根据反馈更新、检索和改进提示
  • 用例分类:自动对提示进行分类(代码生成、文本生成、数据分析、创意、通用)
  • 人工智能驱动的改进:使用GPT-4o-mini根据用户反馈自动改进提示

工具

save_prompt

对对话历史进行总结、分类,并将其转换为markdown格式的提示模板。

参数:

  • conversation_messages (string,必填):包含对话历史的JSON字符串
  • task_description (字符串,可选):正在执行的任务的描述
  • context_info (字符串,可选):关于对话的其他上下文

search_prompts

使用语义搜索从数据库中检索提示。

参数:

  • query (字符串,必填):搜索查询以查找相关提示
  • limit (整数,可选):最大结果数(默认值:5)

search_prompts_by_use_case

检索按用例类别筛选的提示。

参数:

  • use_case (字符串,必填):用例类别(代码生成、文本生成、数据分析、创意、通用)
  • limit (整数,可选):最大结果数(默认值:10)

update_prompt

用新信息更新现有提示。

参数:

  • prompt_id (string,必填):要更新的提示的ID
  • change_description (string,必填):更改内容的描述
  • prompt_template (字符串,可选):新建提示模板
  • summary (字符串,可选):新摘要(触发嵌入再生)
  • use_case (字符串,可选):新用例类别
  • history (字符串,可选):更新历史记录

get_prompt_details

检索特定提示的完整详细信息。

参数:

  • prompt_id (string,必填):要检索的提示的ID

improve_prompt_from_feedback

使用AI根据用户反馈自动改进提示。

参数:

  • prompt_id (string,必填):要改进的提示ID
  • feedback (string,必填):用户对提示的反馈
  • conversation_context (string,可选):关于如何使用提示的上下文

文档

团队快速入门:

  1. 从GitHub安装: pip install git+https://github.com/YOUR-ORG/prompt-saver-mcp.git
  2. 复制 mcp.json.template~/.cursor/mcp.json 填写你的价值观
  3. 跟随 团队_设置\_ ECKLIST.md

安装

  1. 克隆存储库:
   git clone 
   cd prompt-saver-mcp
  1. 安装依赖项:
   pip install -e .
   # or with uv:
   uv sync
  1. 设置MongoDB Atlas:

- 创建MongoDB Atlas集群(免费层可用) - 创建一个名为的数据库 prompt_saver - 在上创建矢量搜索索引 embedding 字段: - 索引名称: vector_index - 尺寸: 2048 - 相似性: dotProduct - 路径: embedding

  1. 配置环境变量:
   cp .env.example .env
   # Edit .env with your API keys and MongoDB Atlas URI

配置

环境变量

变量描述默认值必填
MONGODB_URIMongoDB Atlas连接字符串-
MONGODB_DATABASE数据库名称prompt_saver没有
MONGODB_COLLECTION收藏名称prompts没有
VOYAGE_AI_API_KEYVoyage AI API密钥-
VOYAGE_AI_EMBEDDING_MODEL嵌入模型voyage-3-large没有
OPENAI_API_KEYOpenAI API密钥-
OPENAI_MODEL分析模型gpt-4o-mini没有

在游标中使用

此包旨在通过导入模块直接在Cursor中使用。无需设置MCP客户端!

快速开始

import asyncio
from prompt_saver_mcp.tools.search_prompts import handle_search_prompts
from prompt_saver_mcp.tools.save_prompt import handle_save_prompt

# Search for prompts
result = await handle_search_prompts("Python API client", limit=5)
print(result[0].text)

# Save a conversation
conversation_json = json.dumps([
    {"role": "user", "content": "Help me create..."},
    {"role": "assistant", "content": "Here's how..."}
])
result = await handle_save_prompt(conversation_json, "Creating API client")

助手脚本

我们在 scripts/ 目录以便于使用:

  • prompt_helper.py -具有搜索、保存和其他功能的主要助手
  • save_branch_prompt.py -保存GitHub分支中的提示

CURSOR_USAGE.md 查看详细的示例和工作流程。

用法示例

保存提示

在Cursor中完成复杂任务后,将对话另存为可重用的提示:

import asyncio
import json
from prompt_saver_mcp.tools.save_prompt import handle_save_prompt

# Example conversation messages (JSON format)
conversation = [
    {"role": "user", "content": "Help me create a Python function to parse CSV files"},
    {"role": "assistant", "content": "I'll help you create a robust CSV parser..."},
    # ... more conversation
]

# Save the prompt
async def save():
    result = await handle_save_prompt(
        conversation_messages=json.dumps(conversation),
        task_description="Creating a CSV parser function",
        context_info="Successfully created a parser with error handling"
    )
    print(result[0].text)

asyncio.run(save())

搜索提示

启动新任务时搜索相关提示:

import asyncio
from prompt_saver_mcp.tools.search_prompts import handle_search_prompts

async def search():
    result = await handle_search_prompts("I need help with data processing in Python", limit=5)
    print(result[0].text)

asyncio.run(search())

获取提示详细信息

检索特定提示的完整详细信息:

import asyncio
from prompt_saver_mcp.tools.get_prompt_details import handle_get_prompt_details

async def get_details():
    result = await handle_get_prompt_details("prompt_id_here")
    print(result[0].text)

asyncio.run(get_details())

更新提示

使用提示后,根据您的经验进行更新:

import asyncio
from prompt_saver_mcp.tools.update_prompt import handle_update_prompt

async def update():
    result = await handle_update_prompt(
        prompt_id="prompt_id_here",
        change_description="Added error handling examples",
        prompt_template="Updated template with better error handling..."
    )
    print(result[0].text)

asyncio.run(update())

通过反馈改进提示

使用AI自动改进提示:

import asyncio
from prompt_saver_mcp.tools.improve_prompt_from_feedback import handle_improve_prompt_from_feedback

async def improve():
    result = await handle_improve_prompt_from_feedback(
        prompt_id="prompt_id_here",
        feedback="The prompt worked well but could use more specific examples for edge cases",
        conversation_context="Used for debugging a complex API integration issue"
    )
    print(result[0].text)

asyncio.run(improve())

使用辅助脚本

为了便于使用,请使用辅助脚本:

# Search prompts
python scripts/prompt_helper.py search "Python API client"

# Save a prompt (will prompt for conversation JSON)
python scripts/prompt_helper.py save

数据库模式

每个提示都以以下结构存储:

{
    "_id": ObjectId,
    "use_case": "code-gen" | "text-gen" | "data-analysis" | "creative" | "general",
    "summary": "Summary of the prompt and its use case",
    "prompt_template": "Universal problem-solving prompt template (markdown)",
    "history": "Summary of steps taken and end result",
    "embedding": [0.1, 0.2, ...],  // 2048 dimensions
    "last_updated": ISODate,
    "num_updates": 0,
    "changelog": ["Change 1", "Change 2", ...],
    "created_by": "user123"  // Optional, for team sharing
}

MongoDB Atlas矢量搜索设置

  1. 转到您的MongoDB Atlas集群
  2. 导航到“搜索”选项卡
  3. 点击“创建搜索索引”
  4. 选择“JSON编辑器”
  5. 使用以下配置:
{
  "fields": [
    {
      "type": "vector",
      "path": "embedding",
      "numDimensions": 2048,
      "similarity": "dotProduct"
    }
  ]
}
  1. 命名索引 vector_index
  2. 选择 prompts 收集

发展

运行测试

pytest

代码格式化

black prompt_saver_mcp/
ruff check prompt_saver_mcp/

许可证

MIT许可证-有关详细信息,请参阅许可证文件。

备注

  • 使用 gpt-4o-mini 成本效益模型(比gpt-4o便宜得多,但仍然有能力)
  • MongoDB Atlas免费版包括512MB存储空间和共享集群,足以供个人使用
  • Voyage AI提供每月有限请求的免费套餐
  • 矢量搜索索引需要在MongoDB Atlas UI中手动创建(一次性设置)

目录标签

目录标签

代码生成PythonCursor搜索提示词管理本地部署语义搜索AI优化文本生成

支持客户端

Cursor

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

6

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP