Claude提示MCP服务器
Claude Prompts MCP Server Logo
](https://www.npmjs.com/package/claude-prompts-server)   ](https://nodejs.org)
一种用于高级提示管理的通用模型上下文协议服务器
生产就绪的MCP服务器,具有智能提示编排、热重载功能和框架驱动的AI工作流程。与Claude Desktop、Cursor Windsurf和任何MCP客户端兼容。
______________________________________________________________________
核心功能
三层执行架构
- 迅速执行:闪电般快速的单提示符执行,带变量替换
- 模板处理:使用Nunjucks模板引擎的框架增强模板
- 链工作流:具有状态管理的多步骤LLM驱动工作流
智能系统组件
- 结构分析:基于文件结构的自动执行类型检测
- 热再加载系统:无需重新启动服务器即可立即更新提示
- 质量门:使用条件逻辑进行框架感知验证
- 性能监控:全面的启动协调和健康监控
通用MCP兼容性
- 运输支持:STDIO用于桌面客户端,SSE用于web应用程序
- 客户端集成:原生支持Claude Desktop、Cursor Windsurf和自定义MCP客户端
- 协议遵从:通过工具注册实现完整的模型上下文协议
交互式提示管理
通过三个整合的MCP工具直接在对话中管理AI功能:
# Universal prompt execution with intelligent type detection
prompt_engine >>code_formatter language="Python" style="PEP8"
# Create and manage prompts with intelligent analysis
prompt_manager create name="code_reviewer" type="template" \
content="Analyze {{code}} for security, performance, and maintainability"
# Analyze existing prompts for execution optimization
prompt_manager analyze_type prompt_id="my_prompt"
# System control and framework management
system_control switch_framework framework="ReACT" reason="Problem-solving focus"
# Execute complex multi-step LLM-driven chains
prompt_engine >>code_review_optimization_chain target_code="..." language_framework="TypeScript"主要优势:
- 结构智能:基于文件结构分析的自动执行路由
- 动态能力建设:通过对话式管理扩展AI助手功能
- 最小配置:执行类型检测不需要手动设置
- 系统工作流程:集成创建、路由和框架应用程序
- 智能命令路由:具有多策略解析的内置命令检测
- 方法论集成:有条件应用的四种思维框架(CAGEERF、ReACT、5W1H、SCAMPER)
框架体系
服务器实现了一个复杂的方法体系,该体系将结构化思维框架应用于人工智能交互:
可用方法
- 卡吉尔夫:综合结构化方法(背景、分析、目标、执行、评估、细化、框架)
- 反应:系统解决问题的推理和行为模式
- 5W1H:谁、什么、何时、何地、为什么、如何进行系统分析
- 奔驰法:创造性解决问题(替代、组合、适应、修改、用于其他用途、消除、反转)
框架功能
- 手动选择:根据具体需求选择最佳方法
- 运行时切换:通过绩效监测改变主动框架
- 有条件申请:有益时应用框架增强
- 性能监控:跟踪框架切换机制和使用情况
# Switch methodology for different approaches
system_control switch_framework framework="ReACT" reason="Problem-solving focus"
# Monitor framework performance and usage
system_control analytics show_details=true
# Get current framework status
system_control status结果:通过经过验证的思维方法进行结构化、系统化的人工智能对话。
分析系统能力
核心分析功能:
- 结构分析:通过检查模板变量来检测执行类型(
{{variable}})、链式步骤和文件结构 - 框架应用:根据执行层应用选定的框架方法
- 路由逻辑:基于结构特征的适当执行层(提示/模板/链)的路由
可选语义增强:
- LLM集成:启用后,提供对提示内容的语义理解
- 高级分析:方法建议和复杂性评估
- 默认模式:仅进行结构分析(不依赖LLM)
框架控制:
# Manual framework selection
system_control switch_framework framework="ReACT" reason="Problem-solving focus"架构与可靠性
开发者体验
- 一个命令安装:在60秒内完成设置
- 热再加载系统:无需重新启动即可更新提示、配置和模板
- 丰富模板引擎:带有条件句、循环和数据注入的Nunjucks
- 通用MCP集成:适用于Claude Desktop、Cursor Windsurf和任何MCP客户端
- 多运输支持:STDIO用于桌面+SSE/REST用于web
- 动态管理:动态更新、删除和重新加载提示
企业架构
- 精心策划的启动:使用依赖关系管理进行分阶段初始化
- 错误处理:通过全面的伐木实现了优雅的退化
- 健康监测:实时模块状态、性能指标、诊断
- 环境检测:开发和生产的自动适应
- 模块化设计:自定义工作流的可扩展架构
- 安全:输入验证、净化和错误边界
整合MCP工具(3个工具)
- prompt_engine:具有智能分析和链协调的通用执行
- 提示管理器:通过智能过滤和门管理实现完整的生命周期管理
- 系统控制:框架管理、分析和系统管理
智能功能
- 结构类型检测:提示/模板/链执行之间的自动路由
- 框架集成:四种手动选择和有条件注入的方法
- LLM驱动链:与状态管理逐步协调工作流程
- 性能分析:具有框架切换跟踪的三层执行监控
- 智能参数解析:JSON对象、单个参数或会话上下文
快速开始
让服务器在一分钟内运行:
# Clone, install, build, and start
git clone https://github.com/minipuft/claude-prompts-mcp.git
cd claude-prompts-mcp/server && npm install && npm run build && npm startMCP客户端集成
克劳德桌面版
把这个放到你的 claude_desktop_config.json:
{
"mcpServers": {
"claude-prompts-mcp": {
"command": "node",
"args": ["E:\\path\\to\\claude-prompts-mcp\\server\\dist\\index.js"],
"env": {
"MCP_PROMPTS_CONFIG_PATH": "E:\\path\\to\\claude-prompts-mcp\\server\\prompts\\promptsConfig.json"
}
}
}
}Cursor Windsurf和其他MCP客户端
配置您的MCP客户端以通过STDIO传输进行连接:
- 命令:
node - 参数:
["path/to/claude-prompts-mcp/server/dist/index.js"] - 环境 (可选):
MCP_PROMPTS_CONFIG_PATH=path/to/prompts/promptsConfig.json
Claude代码CLI安装
对于Claude Code CLI用户:
claude mcp add-json claude-prompts-mcp '{"type":"stdio","command":"node","args":["path/to/claude-prompts-mcp/server/dist/index.js"],"env":{}}'使用示例
立即开始使用服务器:
# Discover prompts with intelligent filtering
prompt_manager list filter="category:analysis"
# Execute prompts with automatic type detection
prompt_engine >>friendly_greeting name="Developer"
# Analyze content with framework enhancement
prompt_engine >>content_analysis input="research data"
# Run multi-step LLM-driven chains
prompt_engine >>code_review_optimization_chain target_code="..." language_framework="TypeScript"
# Monitor system performance
system_control analytics include_history=true
# Create new prompts conversationally
"Create a prompt called 'bug_analyzer' that finds and explains code issues"
# Refine existing prompts
"Make the bug_analyzer prompt also suggest performance improvements"
# Reference existing chain prompts
# Example chains available: code_review_optimization_chain, create_docs_chain, video_notes_enhanced
# Manual control when needed
prompt_engine >>content_analysis input="sensitive data" step_confirmation=true gate_validation=true该系统通过系统的方法论应用提供了一种结构化的方法来促进管理。
主要特点
闪电般快速热再加载
编排引擎监控文件并无缝地重新加载所有内容:
# Edit any prompt file → Server detects → Reloads automatically → Zero downtime- 即时更新:实时更改模板、参数、描述
- 无需重新启动:先进的热重新加载系统使一切正常运行
- 智能依赖跟踪:仅重新加载实际更改的内容
- 优雅的错误恢复:无效更改不会使服务器崩溃
高级模板引擎
Nunjucks提供了具有完整模板功能的动态提示:
Analyze {{content}} for {% if focus_area %}{{focus_area}}{% else %}general{% endif %} insights.
{% for requirement in requirements %}
- Consider: {{requirement}}
{% endfor %}
{% if previous_context %}
Build upon: {{previous_context}}
{% endif %}- 条件逻辑:根据输入进行调整的智能提示
- 循环和迭代:处理数组和复杂的数据结构
- 模板继承:重用和扩展提示模式
- 实时处理:使用实时数据注入渲染模板
性能正向编排
具有全面健康监测的多阶段启动:
Phase 1: Foundation → Config, logging, core services
Phase 2: Data Loading → Prompts, categories, validation
Phase 3: Module Init → Tools, executors, managers
Phase 4: Server Launch → Transport, API, diagnostics- 依赖管理:模块以正确的顺序启动并验证
- 健康监测:所有组件的实时状态
- 性能指标:内存使用情况、正常运行时间、连接跟踪
- 诊断工具:内置故障排除和调试
智能提示链
作为嵌入在markdown模板中的LLM驱动指令序列实现的多步工作流:
LLM驱动链格式(主要方法)
链是在markdown文件中使用步骤头直接定义的,这些步骤头引导Claude完成一个系统化的过程:
# Comprehensive Code Review
## User Message Template
**Target Code**: {{target_code}}
**Language/Framework**: {{language_framework}}
This chain performs a systematic 6-step code review:
## Step 1: Structure & Organization Analysis
Analyze code architecture, organization, patterns, naming conventions...
**Output Required**: Structural assessment with identified patterns.
---
## Step 2: Functionality & Logic Review
Examine business logic correctness, edge cases, error handling...
**Output Required**: Logic validation with edge case analysis.
---
## Step 3: Security & Best Practices Audit
Review for security vulnerabilities: input validation, authentication...
**Output Required**: Security assessment with vulnerability identification.主要特点:
- LLM驱动执行:Claude遵循模板中嵌入的分步说明
- 上下文保护:每一步都自然地建立在以前的产出之上
- 柔性结构:步骤可以包括条件逻辑和分支
- 框架集成:通过主动方法(CAGEERF/ReACT)自动增强
模块化链格式(备选)
对于编排多个可重用提示的链,请使用markdown嵌入式格式:
## Chain Steps
1. promptId: extract_key_points
stepName: Extract Key Points
inputMapping:
content: original_content
outputMapping:
key_points: extracted_points
2. promptId: sentiment_analysis
stepName: Analyze Sentiment
inputMapping:
text: extracted_points
outputMapping:
sentiment: analysis_result能力:
- 快速重复使用:将现有提示链接在一起
- 数据流映射:显式输入/输出变量映射
- 闸门集成:在每一步都应用质量门
- 错误恢复:巧妙地处理失败的步骤
真实案例:参见工作链实施:
server/prompts/development/code_review_optimization_chain.md-6步代码审查工作流程server/prompts/documentation/create_docs_chain.md-文档生成链server/prompts/content_processing/video_notes_enhanced.md-视频分析工作流程
系统架构
graph TB
A[Claude Desktop] -->|MCP Protocol| B[Transport Layer]
B --> C[🧠 Orchestration Engine]
C --> D[📝 Prompt Manager]
C --> E[🛠️ MCP Tools Manager]
C --> F[⚙️ Config Manager]
D --> G[🎨 Template Engine]
E --> H[🔧 Management Tools]
F --> I[🔥 Hot Reload System]
style C fill:#ff6b35
style D fill:#00ff88
style E fill:#0066ccMCP客户端兼容性
此服务器实现了模型上下文协议(MCP)标准,并与任何兼容的客户端一起工作:
经过测试和验证的客户
- 克劳德桌面版:全面集成支持
- 光标风帆:本地MCP兼容性
- 克劳德代码:完全原生支持
运输支持
- 工作室:桌面客户端的主要传输方式
- 服务器发送事件(SSE):基于Web的客户端和集成
- HTTP端点:健康检查和数据查询的基本端点
集成功能
- 自动发现:客户端自动检测工具
- 工具注册:动态能力公告
- 热重新加载:更改会立即出现在客户端中
- 错误处理:客户之间的降级很好
备注:随着MCP采用率的增长,该服务器将无需修改即可与任何新的MCP兼容的AI助手或开发环境一起工作。
配置
服务器配置(config.json)
微调服务器的行为:
{
"server": {
"name": "Claude Custom Prompts MCP Server",
"version": "1.0.0",
"port": 9090
},
"prompts": {
"file": "promptsConfig.json",
"registrationMode": "name"
},
"transports": {
"default": "stdio",
"sse": { "enabled": false },
"stdio": { "enabled": true }
}
}快速组织(promptsConfig.json)
构建您的AI命令库:
{
"categories": [
{
"id": "development",
"name": "🔧 Development",
"description": "Code review, debugging, and development workflows"
},
{
"id": "analysis",
"name": "📊 Analysis",
"description": "Content analysis and research prompts"
},
{
"id": "creative",
"name": "🎨 Creative",
"description": "Content creation and creative writing"
}
],
"imports": [
"prompts/development/prompts.json",
"prompts/analysis/prompts.json",
"prompts/creative/prompts.json"
]
}高级功能
多步提示链
使用两种互补的方法构建复杂的人工智能工作流程:
LLM驱动链(推荐)
主要方法使用直接嵌入在markdown模板中的分步说明。Claude在保持上下文的同时系统地执行每一步:
# Research Analysis Chain
## User Message Template
Research {{topic}} and provide {{analysis_type}} analysis.
## Step 1: Initial Research
Gather comprehensive information about {{topic}} from available sources.
Focus on {{analysis_type}} perspectives.
**Output Required**: Research summary with key findings.
---
## Step 2: Extract Key Insights
From the research findings, identify the most relevant insights.
Organize by importance and relevance to {{analysis_type}} analysis.
**Output Required**: Prioritized list of insights with supporting evidence.
---
## Step 3: Analyze Patterns
Examine the extracted insights for patterns, trends, and relationships.
Consider multiple analytical frameworks.
**Output Required**: Pattern analysis with framework comparisons.
---
## Step 4: Synthesize Report
Create comprehensive report combining all findings.
**Output Required**: Structured report with executive summary.优点:
- 自然流量:Claude跨步骤自动维护上下文
- 灵活逻辑:步骤可以包括条件分支和决策点
- 框架增强:自动增强主动方法(CAGEERF/ReACT)
- 清除输出:每个步骤都指定了所需的可交付成果
模块化提示链(替代)
对于使用显式数据流编排多个可重用的提示:
## Chain Steps
1. promptId: research_topic
stepName: Initial Research
inputMapping:
query: topic
outputMapping:
findings: research_data
2. promptId: extract_insights
stepName: Extract Key Insights
inputMapping:
content: research_data
outputMapping:
insights: key_findings
3. promptId: analyze_patterns
stepName: Analyze Patterns
inputMapping:
data: key_findings
outputMapping:
analysis: pattern_results
4. promptId: generate_report
stepName: Synthesize Report
inputMapping:
insights: key_findings
patterns: pattern_results
outputMapping:
report: final_output能力:
- 快速重复使用:利用现有提示作为链构建块
- 显式数据流:步骤之间清晰的输入/输出映射
- 错误恢复:使用重试逻辑优雅地处理失败的步骤
- 闸门验证:在每一步应用质量门进行验证
真实案例:查看生产链实施情况:
server/prompts/content_processing/noteIntegration.md-采用模块化步骤进行纸币处理- 查看
## Chain Steps任何链提示中的部分,以获取完整的语法
高级模板功能
利用Nunjucks模板的全部功能:
# {{ title | title }} Analysis
## Context
{% if previous_analysis %}
Building upon previous analysis: {{ previous_analysis | summary }}
{% endif %}
## Requirements
{% for req in requirements %}
{{loop.index}}. **{{req.priority | upper}}**: {{req.description}}
{% if req.examples %}
Examples: {% for ex in req.examples %}{{ex}}{% if not loop.last %}, {% endif %}{% endfor %}
{% endif %}
{% endfor %}
## Focus Areas
{% set focus_areas = focus.split(',') %}
{% for area in focus_areas %}
- {{ area | trim | title }}
{% endfor %}模板功能:
- 过滤器和功能:动态转换数据
- 条件逻辑:基于输入的智能分支
- 循环和迭代:处理复杂的数据结构
- 模板继承:构建可重用的提示组件
实时管理工具
在服务器运行时动态管理提示:
# Update prompts with intelligent re-analysis
prompt_manager update id="analysis_prompt" content="new template"
# Modify specific sections with validation
prompt_manager modify id="research" section="examples" content="new examples"
# Hot-reload with comprehensive validation
system_control reload reason="updated templates"管理能力:
- 实时更新:在不重新启动服务器的情况下更改提示
- 章节编辑:修改提示的特定部分
- 批量操作:一次更新多个提示
- 回滚支持:出错时撤消更改
生产监控
企业级可观察性:
用于生产环境的内置监控和诊断:
// Health Check Response
{
healthy: true,
modules: {
foundation: true,
dataLoaded: true,
modulesInitialized: true,
serverRunning: true
},
performance: {
uptime: 86400,
memoryUsage: { rss: 45.2, heapUsed: 23.1 },
promptsLoaded: 127,
categoriesLoaded: 8
}
}监控功能:
- 实时健康检查:持续监控所有模块
- 性能指标:内存、正常运行时间、连接跟踪
- 诊断工具:全面的故障排除信息
- 错误跟踪:优雅的错误处理和详细的日志记录
文档
| 指南 | 说明 |
|---|---|
| 安装指南 | 完成安装演练并排除故障 |
| 故障排除指南 | 常见问题、诊断工具和解决方案 |
| 架构概述 | 深入了解编排引擎、模块和数据流 |
| 提示格式指南 | 掌握包括链工作流在内的提示创建 |
| 及时管理 | 动态管理和热重载功能 |
| MCP工具参考 | 完整的MCP工具文档 |
| 路线图和TODO | 计划功能和开发路线图 |
| 贡献 | 加入我们的开发社区 |
贡献
加入我们的开发社区:
许可证
根据 MIT许可证 -有关详细信息,请参阅文件。
______________________________________________________________________
如果此仓库正在改善您的AI工作流程,请将其标记为星号
_专为AI开发社区打造_
