Back to MCP directory
publicPublicdnsLocal runtime

claude-prompts-mcp

一个基于Node.js的Claude AI模型自定义提示词服务器,支持模块化分类管理和链式提示执行。

article

README

🚀 自定义 Claude 提示词

Claude 提示词插件允许用户自定义其行为和交互方式,通过配置文件和模板文件,用户可以灵活定制提示词,还能使用插件提供的附加功能来增强体验。

🚀 快速开始

Claude 的提示词插件功能允许用户通过 config/extension-claude.yaml 文件自定义其行为和交互方式。下面将详细介绍配置文件结构、自定义提示词模板、附加功能以及各种使用示例。

✨ 主要特性

Claude 插件具备以下特性,以提升用户使用体验:

  • 上下文感知:根据对话历史调整响应。
  • 模板编译:支持将提示词模板预先编译为更高效的格式。
  • 日志记录:记录所有 Claude 插件相关的操作和错误信息。

📦 安装指南

文档未提及安装步骤,故跳过此章节。

💻 使用示例

基础用法

自定义提示词模板示例

用户可以在 templates 目录下创建自己的提示词模板文件,文件扩展名为 .tmpl.txt。以下是一个自定义提示词模板的示例:

greet {{name}} with a friendly message.

arguments:
  - name: name
    description: The name of the person to greet.
    required: true

使用自定义提示词

# 假设有一个名为 'custom_greeting.tmpl' 的提示词模板文件
curl -X POST http://localhost:9090/api/v1/tools/process_slash_command \
  -H "Content-Type: application/json" \
  -d '{
    "command": "/greet John Doe"
  }'

高级用法

创建新类别

curl -X POST http://localhost:9090/api/v1/tools/create_category \
  -H "Content-Type: application/json" \
  -d '{
    "id": "birthday_greetings",
    "name": "生日祝福",
    "description": "用于生成生日祝福语的提示词模板"
  }'

更新提示词

curl -X POST http://localhost:9090/api/v1/tools/update_prompt \
  -H "Content-Type: application/json" \
  -d '{
    "id": "birthday_message",
    "name": "生日信息",
    "category": "生日祝福",
    "description": "生成详细的生日信息卡片",
    "userMessageTemplate": "今天是 {{name}} 的生日!让我们一起庆祝这个特别的日子。",
    "arguments": [
      {
        "name": "name",
        "description": "被庆祝的人的名字",
        "required": true
      },
      {
        "name": "date",
        "description": "生日日期",
        "required": false
      }
    ]
  }'

删除提示词

curl -X POST http://localhost:9090/api/v1/tools/delete_prompt \
  -H "Content-Type: application/json" \
  -d '{
    "id": "birthday_message"
  }'

修改提示词部分内容

curl -X POST http://localhost:9090/api/v1/tools/modify_prompt_section \
  -H "Content-Type: application/json" \
  -d '{
    "id": "greeting_template",
    "section_name": "用户消息模板",
    "new_content": "欢迎回来,{{name}}!"
  }'

刷新提示词

curl -X POST http://localhost:9090/api/v1/tools/reload_prompts \
  -H "Content-Type: application/json" \
  -d '{
    "restart": true,
    "reason": "配置更新"
  }'

列出所有可用命令

curl -X POST http://localhost:9090/api/v1/tools/list_prompts

执行提示词

curl -X POST http://localhost:9090/api/v1/tools/execute_prompt \
  -H "Content-Type: application/json" \
  -d '{
    "id": "greeting_template",
    "arguments": {
      "name": "Alice"
    }
  }'

使用 JSON 格式执行提示词

curl -X POST http://localhost:9090/api/v1/tools/execute_prompt \
  -H "Content-Type: application/json" \
  -d '{
    "id": "birthday_message",
    "arguments": {
      "name": "Bob",
      "date": "2023-12-25"
    }
  }'

使用 YAML 格式执行提示词

curl -X POST http://localhost:9090/api/v1/tools/execute_prompt \
  -H "Content-Type: application/json" \
  -d '{
    "id": "greeting_template",
    "arguments": {
      "name": "Charlie"
    }
  }'

使用自定义变量

curl -X POST http://localhost:9090/api/v1/tools/execute_prompt \
  -H "Content-Type: application/json"

📚 详细文档

配置文件结构

Claude 的提示词插件通过 config/extension-claude.yaml 文件进行配置,以下是该配置文件的详细结构说明:

claudius:
  # 是否启用 Claude 插件
  enabled: true

  # 配置 Claude 提示词插件的相关设置
  prompt_extension:
    # 提示词模板目录路径
    templates_path: "path/to/templates"

    # 默认的提示词模板文件名
    default_template_name: "default_prompt.tmpl"

    # 是否启用自动加载新的提示词模板
    auto_reload: true

    # 提示词模板的后缀名
    suffixes:
      - ".tmpl"
      - ".txt"

🔧 技术细节

文档未提供具体的技术实现细节,故跳过此章节。

📄 许可证

文档未提及许可证信息,故跳过此章节。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client