AI Skills AI技能 2h ago Updated 52m ago 更新于 52分钟前 44

MCP Prompts in Claude Code: A Simple Guide for Developers Claude Code 中的 MCP 提示词:开发者简易指南

MCP (Model Context Protocol) prompts are reusable workflow templates exposed by MCP servers that become automatically discoverable as slash commands in Claude Code MCP prompts differ fundamentally from MCP tools: prompts provide predefined instructions/workflows, while tools provide executable actions against external systems MCP prompts support arguments, enabling dynamic, parameterized workflows like `/mcp__devops__incident_response INC-4521` Claude Code discovers MCP prompts dynamically via ` MCP(Model Context Protocol)使Claude Code能够连接GitHub、Jira、数据库、CI/CD等外部系统,大幅简化集成流程 MCP prompts是可复用的工作流程模板,通过`/mcp__servername__promptname`命名模式在Claude Code中自动发现并作为命令使用 MCP Tool负责执行动作(如获取状态、拉取日志),MCP Prompt提供预定义工作流程指导,两者配合实现完整任务 MCP prompts支持参数传递(如`/mcp__github__pr_review 456`),适用于企业级动态工作流场景 CLAUDE.md用于持久

62
Hot 热度
68
Quality 质量
60
Impact 影响力

Analysis 深度分析

TL;DR

  • MCP (Model Context Protocol) prompts are reusable workflow templates exposed by MCP servers that become automatically discoverable as slash commands in Claude Code
  • MCP prompts differ fundamentally from MCP tools: prompts provide predefined instructions/workflows, while tools provide executable actions against external systems
  • MCP prompts support arguments, enabling dynamic, parameterized workflows like /mcp__devops__incident_response INC-4521
  • Claude Code discovers MCP prompts dynamically via prompts/list and prompts/get protocol methods, making them available as /mcp__servername__promptname commands
  • MCP prompts complement CLAUDE.md (persistent project instructions) and Claude Code Skills (local reusable workflows) by bringing server-provided enterprise workflows into the development environment

Why It Matters

MCP prompts represent a significant step toward standardizing AI-assisted development workflows across engineering teams, allowing organizations to encode institutional knowledge (incident response procedures, deployment checklists, release reviews) into reusable, shareable templates. For AI practitioners, understanding the prompt-vs-tool distinction is critical for designing effective MCP server integrations that maximize Claude Code's utility in real-world DevOps and development pipelines.

Technical Details

  • Discovery Mechanism: MCP prompts are dynamically discovered from connected servers using the prompts/list and prompts/get protocol methods. Once discovered, they appear as slash commands following the naming pattern /mcp__servername__promptname (e.g., /mcp__devops__incident_response)
  • Prompt vs Tool Architecture: MCP Tools are model-invoked actions that interact with external systems (e.g., get_deployment_status(), fetch_logs()), while MCP Prompts are user-invoked, predefined workflows that guide Claude on how to approach a task using available tools
  • Argument Support: MCP prompts can define parameters in their metadata, allowing developers to pass arguments at invocation time (e.g., /mcp__github__pr_review 456 or /mcp__devops__incident_response INC-4521), making them suitable for dynamic enterprise workflows
  • Integration with CLAUDE.md and Skills: CLAUDE.md provides persistent project-level instructions, Claude Code Skills handle local reusable workflows, and MCP Prompts deliver server-provided workflows — each serving a distinct layer in the prompt hierarchy
  • Practical Workflow Example: A DevOps MCP server exposing prompts (deploy_checklist, incident_response, release_review) and tools (deploy_application, check_pipeline, get_deployment_status, fetch_logs) enables Claude to follow standardized processes while accessing real system data through tools

Industry Insight

  • Organizations should prioritize encoding repeatable DevOps and engineering workflows into MCP prompts rather than relying on ad-hoc AI interactions, ensuring consistency across incident response, deployments, and release reviews
  • The clear separation between prompts (workflow/instructions) and tools (actions/capabilities) in MCP provides a clean architectural pattern that can be generalized beyond Claude Code to other AI agent frameworks
  • As MCP adoption grows, expect a rising ecosystem of shared prompt libraries and server registries where teams can publish and discover standardized workflows, similar to how npm packages or GitHub Actions are currently shared

TL;DR

  • MCP(Model Context Protocol)使Claude Code能够连接GitHub、Jira、数据库、CI/CD等外部系统,大幅简化集成流程
  • MCP prompts是可复用的工作流程模板,通过/mcp__servername__promptname命名模式在Claude Code中自动发现并作为命令使用
  • MCP Tool负责执行动作(如获取状态、拉取日志),MCP Prompt提供预定义工作流程指导,两者配合实现完整任务
  • MCP prompts支持参数传递(如/mcp__github__pr_review 456),适用于企业级动态工作流场景
  • CLAUDE.md用于持久化项目指令,与MCP prompts形成互补:前者定义规则,后者提供可复用流程

为什么值得看

本文清晰阐述了MCP prompts在Claude Code中的工作机制,帮助开发者理解如何将企业级DevOps工作流标准化并嵌入AI辅助开发环境。对于正在探索AI编程助手与企业工具链集成的团队,提供了可直接落地的实践指导。

技术解析

  • 协议层机制:MCP客户端通过prompts/list发现可用prompts,通过prompts/get获取指定prompt内容,结果消息被添加到对话中,使prompt更像可复用工作流而非普通API调用。
  • 命名与发现规则:MCP prompts暴露后自动成为Claude Code中的命令,命名模式为/mcp__servername__promptname,例如/mcp__devops__incident_response,无需手动创建本地命令。
  • 参数传递支持:MCP prompts可在元数据中定义参数,调用时通过空格传递,如/mcp__devops__incident_response INC-4521,prompt可利用该参数生成定制化指令。
  • 组件职责划分:MCP Prompt提供指令/工作流,MCP Resource提供信息/上下文,MCP Tool执行动作/能力,三者协同构成完整解决方案。
  • 与CLAUDE.md的关系:CLAUDE.md存储持久化项目规则(如编码规范、测试要求),MCP prompts提供可复用工作流程,两者功能互补而非重叠。

行业启示

  • 企业可将DevOps专家知识封装为标准化的MCP prompts(如部署检查清单、事件响应流程、发布审查),通过MCP服务器统一暴露,确保团队成员使用一致的工作流程。
  • Prompt与Tool的分离设计体现了"指导"与"执行"的解耦思想,这一模式可推广至其他AI辅助开发场景,提升工作流的灵活性和可维护性。
  • MCP协议的普及将加速AI编程助手与企业现有工具链的深度融合,建议技术团队提前规划MCP服务器建设,将核心业务流程沉淀为可复用的prompts和tools。

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

Claude Claude LLM 大模型 Programming 编程 Code Generation 代码生成 Agent Agent