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-server

v0.0.7

Published

Remote MCP Server for managing prompts

Readme

MCP Prompt Server

npm version License: MIT Node.js Version

一个基于 模型上下文协议(MCP) 的 Prompt 管理服务器 。可以将分散的、静态的提示词模板,转变为一个可通过 API 调用的、可动态配置的、可复用的服务,从而更高效地管理和使用 AI 提示词。

核心特性

  • 🛠️ 完整接口:提供提示词列表、处理、帮助和版本信息等接口
  • 📁 递归扫描:自动发现子目录中的 prompt 文件
  • ⚙️ 灵活配置:支持命令行参数和环境变量配置

快速开始

1. 安装

# 全局安装
npm install -g @becrafter/prompt-server

# 或作为项目依赖安装
npm install @becrafter/prompt-server 

2. 启动服务器

# 使用默认配置启动
prompt-server

# 指定提示词目录
prompt-server --prompts-dir ./my-prompts

# 指定端口
prompt-server --port 8080

配置选项

命令行参数

| 参数 | 简写 | 描述 | |------|------|------| | --prompts-dir <目录> | -p | 指定 prompts 文件所在目录 | | --port <端口> | -P | 指定服务器端口 (默认: 3000) | | --help | -h | 显示帮助信息 | | --version | -v | 显示版本信息 |

环境变量

| 环境变量 | 描述 | 默认值 | |----------|------|--------| | MCP_SERVER_NAME | 服务器名称 | prompt-server | | SERVER_PORT | 服务器端口 | 3000 | | PROMPTS_DIR | Prompts目录路径 | 当前工作目录下的 prompts 目录 | | MCP_SERVER_VERSION | 服务器版本 | 0.0.7 | | LOG_LEVEL | 日志级别 (error, warn, info, debug) | info | | MAX_PROMPTS | 最大prompt数量限制 | 100 | | RECURSIVE_SCAN | 是否启用递归扫描子目录 | true |

API 接口

获取服务器信息

GET /

返回服务器基本信息和可用接口列表。

获取提示词列表

GET /prompts

返回所有可用的提示词列表。

获取单个提示词详情

GET /prompts/:name

返回指定名称的提示词详细信息。

创建新提示词

POST /prompts

创建新的提示词文件。

请求体示例:

{
  "name": "my-prompt",
  "description": "我的自定义提示词",
  "messages": [
    {
      "role": "user",
      "content": {
        "text": "这是一个{{参数}}示例"
      }
    }
  ],
  "arguments": [
    {
      "name": "参数",
      "description": "示例参数",
      "type": "string",
      "required": true
    }
  ]
}

更新提示词

PUT /prompts/:name

更新现有的提示词文件。修改前会自动创建备份。

请求体格式与创建相同。

删除提示词

DELETE /prompts/:name

删除指定的提示词文件。删除前会自动创建备份。

验证YAML格式

POST /prompts/validate

验证提示词YAML格式是否正确。

请求体示例:

yaml: |
  name: test-prompt
  description: 测试提示词
  messages:
    - role: user
      content:
        text: 测试内容

获取备份列表

GET /backups

获取所有提示词备份文件列表。

处理提示词

POST /process

处理指定的提示词,支持参数替换。

请求体示例:

{
  "promptName": "code-review",
  "arguments": {
    "language": "JavaScript",
    "code": "function hello() { console.log('Hello'); }"
  }
}

获取帮助信息

GET /help

返回服务器使用帮助信息。

获取版本信息

GET /version

返回服务器版本信息。

提示词格式

提示词文件使用 YAML 格式,需要包含以下基本结构:

name: prompt-name
description: 提示词描述
messages:
  - role: user
    content:
      text: 提示词内容,支持 {{参数名}} 格式的参数替换

开发

项目结构

prompt-server/
├── bin/                # 可执行文件
├── prompts/            # 示例提示词
│   ├── developer/      # 开发相关提示词
│   ├── generator/      # 生成器提示词
│   └── operation/      # 运维相关提示词
├── src/
│   ├── config.js       # 配置管理
│   ├── logger.js       # 日志工具
│   └── server.js       # 服务器主程序
└── package.json

本地开发

# 克隆仓库
git clone https://github.com/BeCrafter/prompt-server.git
cd prompt-server

# 安装依赖
npm install

# 启动开发服务器
npm run dev

许可证

MIT License