Advanced MCP Development: Building Custom Workflow Servers for Claude Code
Welcome to Unit 3! In this unit, we'll build a practical MCP server that enhances Claude Code with custom development workflows while learning all three MCP primitives.
欢迎来到第三单元!本单元我们会构建一个实用的 MCP 服务端,用自定义的开发工作流来增强 Claude Code,同时学习 MCP 的三种原语。
If you'd like to hear from the creators of MCP, here's a video they made:
如果你想听听 MCP 创造者的说法,他们录了这样一段视频:
In this video Theo Chu, David Soria Parra and Alex Albert dive into the Model Context Protocol (MCP), the standard that's changing how AI applications connect with external data and tools.
在这段视频里,Theo Chu、David Soria Parra 和 Alex Albert 深入讲解 Model Context Protocol(MCP)——这一正在改变 AI 应用与外部数据和工具连接方式的标准。
What You'll Build
PR Agent Workflow Server - An MCP server that demonstrates how to make Claude Code team-aware and workflow-intelligent:
PR Agent Workflow Server —— 一个演示如何让 Claude Code 具备团队意识和工作流智能的 MCP 服务端:
- Smart PR Management: Automatic PR template selection based on code changes using MCP Tools
- CI/CD Monitoring: Track GitHub Actions with Cloudflare Tunnel and standardized Prompts
- Team Communication: Slack notifications demonstrating all MCP primitives working together
智能 PR 管理:用 MCP Tools 根据代码改动自动选择 PR 模板;CI/CD 监控:用 Cloudflare Tunnel 与标准化 Prompts 跟踪 GitHub Actions;团队协作:用 Slack 通知演示所有 MCP 原语如何协同工作。
Real-World Case Study
We'll implement a practical scenario every development team faces:
我们将实现一个每个开发团队都会遇到的真实场景:
Before: Developer manually creates PRs, waits for Actions to complete, manually checks results, remembers to notify team members
之前:开发者手动创建 PR、等待 Actions 跑完、手动检查结果、还要记得通知团队成员。
After: Claude Code connected to your workflow server can intelligently:
- Suggest the right PR template based on changed files
- Monitor GitHub Actions runs and provide formatted summaries
- Automatically notify team via Slack when deployments succeed/fail
- Guide developers through team-specific review processes based on Actions results
之后:连接到你的工作流服务端的 Claude Code 可以智能地:根据改动文件推荐合适的 PR 模板;监控 GitHub Actions 运行并给出格式化摘要;在部署成功或失败时通过 Slack 自动通知团队;依据 Actions 结果引导开发者走团队专属的评审流程。
Key Learning Outcomes
- Core MCP Primitives: Master Tools and Prompts through practical examples
- MCP Server Development: Build a functional server with proper structure and error handling
- GitHub Actions Integration: Use Cloudflare Tunnel to receive webhooks and process CI/CD events
- Hugging Face Hub Workflows: Create specialized workflows for LLM development teams
- Multi-System Integration: Connect GitHub, Slack, and Hugging Face Hub through MCP
- Claude Code Enhancement: Make Claude understand your team's specific workflows
1. MCP 核心原语:通过实例掌握 Tools 与 Prompts;2. MCP 服务端开发:构建一个结构规范、含错误处理的可运行服务端;3. GitHub Actions 集成:用 Cloudflare Tunnel 接收 webhook 并处理 CI/CD 事件;4. Hugging Face Hub 工作流:为 LLM 开发团队定制专用流程;5. 多系统集成:通过 MCP 连接 GitHub、Slack 与 Hugging Face Hub;6. 增强 Claude Code:让 Claude 理解你们团队的特定工作流。
MCP Primitives in Action
This unit provides hands-on experience with the core MCP primitives:
本单元提供 MCP 核心原语的动手实践机会:
- Tools (Module 1): Functions Claude can call to analyze files and suggest templates
- Prompts (Module 2): Standardized workflows for consistent team processes
- Integration (Module 3): All primitives working together for complex automation
Tools(模块一):Claude 可调用的函数,用于分析文件并推荐模板;Prompts(模块二):标准化工作流,保证团队流程一致;整合(模块三):让所有原语协同完成复杂的自动化。
Module Structure
- Module 1: Build MCP Server - Create a basic server with Tools for PR template suggestions
- Module 2: GitHub Actions Integration - Monitor CI/CD with Cloudflare Tunnel and Prompts
- Module 3: Slack Notification - Team communication integrating all MCP primitives
1. 模块一:构建 MCP 服务端——做出一个基础服务端,用 Tools 提供 PR 模板建议;2. 模块二:GitHub Actions 集成——用 Cloudflare Tunnel 与 Prompts 监控 CI/CD;3. 模块三:Slack 通知——整合全部 MCP 原语,完成团队协作。
Prerequisites
Before starting this unit, ensure you have:
开始本单元之前,请确认你已具备:
- Completion of Units 1 and 2
- Basic familiarity with GitHub Actions and webhook concepts
- Access to a GitHub repository for testing (can be a personal test repo)
- A Slack workspace where you can create webhook integrations
已完成第一、二单元;对 GitHub Actions 与 webhook 概念有基本了解;有一个可用于测试的 GitHub 仓库(个人测试仓库即可);有一个可以创建 webhook 集成的 Slack 工作区。
Claude Code Installation and Setup
This unit requires Claude Code to test your MCP server integration.
本单元需要 Claude Code 来测试你的 MCP 服务端集成。
TIP
Installation Required: This unit requires Claude Code for testing MCP server integration with AI workflows.
需要安装:本单元需要 Claude Code,用来测试 MCP 服务端与 AI 工作流的集成。
Quick Setup:
快速安装:
Follow the official installation guide to install Claude Code and complete authentication. The key steps are installing via npm, navigating to your project directory, and running claude to authenticate through console.anthropic.com.
按照官方安装指南(https://docs.anthropic.com/en/docs/claude-code/getting-started)安装 Claude Code 并完成鉴权。关键步骤是用 npm 安装、进入你的项目目录,然后运行 claude 通过 console.anthropic.com 完成鉴权。
Once installed, you'll use Claude Code throughout this unit to test your MCP server and interact with the workflow automation you build.
安装完成后,你会在本单元中一直使用 Claude Code 来测试 MCP 服务端,并与你构建的工作流自动化交互。
WARNING
New to Claude Code? If you encounter any setup issues, the troubleshooting guide covers common installation and authentication problems.
刚接触 Claude Code?如果遇到配置问题,故障排查指南里覆盖了常见的安装与认证问题。
By the end of this unit, you'll have built a complete MCP server that demonstrates how to transform Claude Code into a powerful team development assistant, with hands-on experience using all three MCP primitives.
学完本单元,你会构建出一个完整的 MCP 服务端,它展示了如何把 Claude Code 变成强大的团队开发助手,同时你也动手用遍了 MCP 的三种原语。