npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@asenli/mcp-prompt-manager

v1.0.3

Published

MCP server for local prompt and template management (stdio)

Readme

@asenli/mcp-prompt-manager

用途

本仓库是一个基于 Model Context Protocol(stdio) 的 MCP 服务,在本地管理提示词与模板:增删改查、标签与关键词筛选、{{variable}} 形式的模板渲染,以及简单统计。数据可落在本机目录(JSON 文件)或仅存在进程内存中,由环境变量控制。

适用场景:在 CursorClaude Desktop 等支持 MCP 的客户端里,让模型通过工具读写你的个人提示词库,而不把内容交给远端服务存储。

前置条件

  • 本机安装 Node.js 20 及以上

接入方式

在客户端的 MCP 配置里增加一个 server(以下为 JSON 片段,需合并进你现有的 mcpServers 对象中)。

方式一:从 npm 运行(推荐)

无需克隆仓库。将 PROMPTS_DIR 改为你本机用于存放数据的绝对路径(会写入 prompts.json)。

{
  "mcpServers": {
    "prompt-manager": {
      "command": "npx",
      "args": ["-y", "@asenli/mcp-prompt-manager"],
      "env": {
        "STORAGE_TYPE": "file",
        "PROMPTS_DIR": "/你的/绝对路径/例如/prompt-data"
      }
    }
  }
}

方式二:克隆仓库后本地运行

先在仓库根目录执行 npm installnpm run build,把下面路径中的 /ABSOLUTE/PATH/TO/mcp-prompt-manager 换成你本机仓库的绝对路径。

{
  "mcpServers": {
    "prompt-manager": {
      "command": "node",
      "args": ["/ABSOLUTE/PATH/TO/mcp-prompt-manager/dist/index.js"],
      "env": {
        "STORAGE_TYPE": "file",
        "PROMPTS_DIR": "/ABSOLUTE/PATH/TO/mcp-prompt-manager/data"
      }
    }
  }
}

配置保存后,在客户端中重启 MCP 或重载窗口,确认该 server 已连接且无报错。

环境变量说明

| 变量 | 说明 | 默认 | |------|------|------| | STORAGE_TYPE | file:使用 PROMPTS_DIR 下的 prompts.jsonmemory:仅当前进程内,不落盘 | file | | PROMPTS_DIR | STORAGE_TYPE=file 时的数据目录 | ~/.mcp-prompt-manager/data | | LOG_LEVEL | infodebugdebug 时会在 stderr 打印配置摘要) | info |

如何使用

连接成功后,你主要在对话里用自然语言描述需求即可;模型会按需调用下方工具。若你在 MCP Inspector 或其它客户端里手动测工具,可直接使用「工具名 + JSON 参数」形式。

工具一览

| 工具名 | 作用 | |--------|------| | add_prompt | 新建一条提示词或模板 | | get_prompt | 按 id 读取一条 | | list_prompts | 列表,支持标签、关键词子串、分类过滤 | | update_prompt | 按 id 部分更新;categorynull 可清空分类 | | delete_prompt | 按 id 删除 | | apply_template | 将模板中的 {{变量名}} 替换为传入的值 | | get_stats | 总数、模板数、标签与分类计数 |

成功时返回体一般为 { "ok": true, "data": ... };失败为 ok: falseerror 说明。

用自然语言可以怎么说(示例)

下面这些话在 Cursor / Claude 里都可以直接说,由模型去选工具与填参数:

  • 「帮我加一条提示词,名字叫代码评审清单,内容是……,标签打上 reviewwork。」
  • 「建一个邮件回复模板,正文里用 {{客户名}}{{订单号}} 占位,并标记为模板。」
  • 「列出我库里所有带 review 标签的条目。」
  • 「搜一下内容里包含 SQL 的提示词。」
  • 「把 id 为 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 的那条改名为周报模板。」
  • 「删掉 id 为 的那条。」
  • 「用我那条邮件回复模板渲染一版:客户名 填 ACME,订单号 填 10086。」
  • 「看一下当前库里的统计:一共多少条、多少模板、常用标签有哪些。」

说明:id 是 UUID,通常来自你新建后模型返回的 data.id,或来自 list_prompts / get_prompt 的结果;记不清时可以让模型先 list_prompts 再操作。

参数与返回示例(便于对照)

1. 新建普通提示词 add_prompt

{
  "name": "周报要点",
  "content": "本周完成:\n1. …\n下周计划:\n1. …",
  "tags": ["work", "weekly"],
  "category": "文档"
}

2. 新建带占位的模板 add_prompt

正文里出现 {{客户名}} 即占位;建议 isTemplate: true,并可写变量说明(可选):

{
  "name": "客户跟进邮件",
  "content": "尊敬的 {{客户名}}:\n关于订单 {{订单号}},我们已安排发货。",
  "isTemplate": true,
  "tags": ["email", "sales"],
  "variables": [
    { "name": "客户名", "type": "string", "required": true, "description": "客户称呼" },
    { "name": "订单号", "type": "string", "required": true }
  ]
}

返回里的 data.id 请保存好,后续 get_promptapply_templateupdate_promptdelete_prompt 都要用它。

3. 列表与搜索 list_prompts

同时包含全部标签(默认 tagsMatchall):

{
  "tags": ["work", "review"],
  "tagsMatch": "all"
}

包含任一标签:

{
  "tags": ["email", "sales"],
  "tagsMatch": "any"
}

按名称或正文子串(不区分大小写):

{
  "search": "SQL"
}

按分类精确匹配:

{
  "category": "文档"
}

4. 读取单条 get_prompt

{
  "id": "550e8400-e29b-41d4-a716-446655440000"
}

5. 更新 update_prompt

只传需要改的字段,例如只改名称与标签:

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "周报要点(修订)",
  "tags": ["work", "weekly", "v2"]
}

清空分类:

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "category": null
}

6. 渲染模板 apply_template

variables 的键名必须与正文里的 {{键名}} 一致(不含花括号):

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "variables": {
    "客户名": "ACME 公司",
    "订单号": "10086"
  }
}

返回中的 data.rendered 为替换后的完整文本。若必填占位未给值,会返回错误说明。

7. 统计 get_stats

无参数,传空对象即可:

{}

8. 删除 delete_prompt

{
  "id": "550e8400-e29b-41d4-a716-446655440000"
}

数据与存储

  • STORAGE_TYPE=file 时,数据在 PROMPTS_DIR 下的 prompts.json;请定期备份该目录。
  • STORAGE_TYPE=memory 时数据仅在当前 MCP 进程内,重启客户端或 server 即清空,适合临时试验。

许可

MIT