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

@becrafter/prompt-mcp

v0.1.11

Published

MCP Server for managing and executing prompts

Readme

MCP Prompt Server

npm version License: MIT Node.js Version

基于 Model Context Protocol (MCP) 的 Prompt 管理服务器,将 AI 提示词封装为可复用的 MCP 工具。

核心特性

  • 🛠️ 四个核心工具:列表、获取、搜索、重载
  • 🔑 8位唯一ID:基于文件路径哈希,避免冲突
  • 📁 递归扫描:自动发现子目录中的 prompt
  • 🌐 远程支持:从远程服务器加载 prompts
  • 🔄 热重载:运行时重新加载

快速开始

1. 安装

npm install @becrafter/prompt-mcp

2. 配置 MCP 客户端

编辑配置文件(macOS: ~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "prompt-mcp": {
      "command": "npx",
      "args": ["-y", "@becrafter/prompt-mcp"]
    }
  }
}

自定义 prompts 目录

{
  "mcpServers": {
    "prompt-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@becrafter/prompt-mcp",
        "--prompts-dir",
        "/path/to/your/prompts"
      ]
    }
  }
}

⚠️ 重要:不要使用 npm start,会导致 JSON 解析错误。使用 npxnode 命令。

3. 创建 Prompt

# prompts/code-review.yaml
name: "代码审查助手"
description: "帮助进行代码审查"
messages:
  - role: "user"
    content:
      text: "请审查以下{{language}}代码:\n```\n{{code}}\n```"
arguments:
  - name: "language"
    description: "编程语言"
    required: true
  - name: "code"
    description: "代码内容"
    required: true

4. 使用工具

在 Claude Desktop 中直接调用:

  • get_prompt_list - 查看所有可用 prompts
  • get_prompt - 获取特定 prompt(使用 8 位 ID)
  • search_prompts - 搜索 prompts
  • reload_prompts - 重新加载

MCP 工具

get_prompt_list

获取所有可用的 prompt 列表。

返回示例

{
  "success": true,
  "count": 3,
  "prompts": [
    {
      "id": "a1b2c3d4",
      "name": "code-review",
      "description": "代码审查助手",
      "hasArguments": true
    }
  ]
}

get_prompt

根据 ID 获取特定 prompt 的完整内容。

参数

  • prompt_id (string, 必需): 8位唯一ID

search_prompts

搜索 prompts,支持模糊匹配。

参数

  • title (string, 必需): 搜索关键词

特性

  • namedescription 字段中搜索
  • 按相关性排序
  • 支持完全匹配、包含匹配、部分词匹配

reload_prompts

重新加载所有 prompts。

配置

命令行参数

# 指定 prompts 目录
npx @becrafter/prompt-mcp --prompts-dir /path/to/prompts

# 使用远程服务器
npx @becrafter/prompt-mcp --remote-url https://api.example.com/prompts

# 设置请求头
npx @becrafter/prompt-mcp -r https://api.example.com -H '{"Authorization":"Bearer token"}'

环境变量

PROMPTS_DIR=/path/to/prompts          # prompts 目录
REMOTE_URL=https://api.example.com    # 远程服务器
LOG_LEVEL=info                        # 日志级别 (error/warn/info/debug)
RECURSIVE_SCAN=true                   # 递归扫描子目录

完整配置参考 env.example

远程服务

配置

export REMOTE_URL="https://your-server.com"
export REMOTE_HEADERS='{"Authorization":"Bearer token"}'

API 接口

获取列表GET {REMOTE_URL}

[
  {
    "name": "prompt-name",
    "description": "描述",
    "messages": [...],
    "arguments": [...],
    "uniqueId": "a1b2c3d4"
  }
]

详细规范:REMOTE_SERVICE_API.md

Prompt 文件格式

name: "prompt名称"              # 必需
description: "prompt描述"       # 可选
messages:                      # 可选
  - role: "user"
    content:
      text: "内容,支持{{参数}}占位符"
arguments:                     # 可选
  - name: "参数名"
    description: "参数描述"
    type: "string"             # string, number, boolean
    required: true             # true, false

故障排除

常见问题

找不到 prompt?

  • 使用 get_prompt_list 查看所有可用 ID
  • 确保使用 8 位 ID,不是 name

服务器无法启动?

  • 检查 Node.js 版本 (>= 18.0.0)
  • 检查 prompts 目录是否存在

需要调试?

LOG_LEVEL=debug npx @becrafter/prompt-mcp

文档

许可证

MIT License