|
1 | | -# Coming Soon |
| 1 | +# Remote Servers, Authentication, and Deployment |
2 | 2 |
|
3 | | -This unit will be a collaboration with partners from the AI community. |
| 3 | +Welcome to Unit 4! In this unit, we'll build on our workflow server from Unit 3 and advance your MCP development skills by focusing on practical deployment knowledge: remote servers, authentication systems, and production deployment strategies. |
4 | 4 |
|
5 | | -If you're building tools for MCP, please reach out to us and we'll add you to the unit. Open a [discussion](https://huggingface.co/spaces/mcp-course/README/discussions) on the hub organization. |
| 5 | +## Going Production-Ready |
| 6 | + |
| 7 | +**Unit 3 Recap**: Building custom workflow servers for Claude Code in a local development environment |
| 8 | + |
| 9 | +**Unit 4 Focus**: Taking your MCP applications to production with remote deployment and authentication using Cloudflare Workers |
| 10 | + |
| 11 | +## What You'll Learn |
| 12 | + |
| 13 | +### Cloudflare Workers Remote MCP Deployment |
| 14 | + |
| 15 | +Learn how to deploy MCP workflow servers as remote services using Cloudflare Workers: |
| 16 | + |
| 17 | +- **Remote MCP Architecture**: Understanding Cloudflare's remote Model Context Protocol implementation |
| 18 | +- **Durable Objects**: Using stateful server patterns with persistent storage ([pricing details](https://developers.cloudflare.com/durable-objects/platform/pricing/)) |
| 19 | +- **Server-Sent Events (SSE)**: Implementing real-time communication for MCP servers |
| 20 | +- **Global Distribution**: Deploying MCP servers close to users worldwide |
| 21 | + |
| 22 | +### OAuth 2.1 Authentication Implementation |
| 23 | + |
| 24 | +Implement robust OAuth authentication for remote MCP applications: |
| 25 | + |
| 26 | +- **OAuth 2.1 Provider**: Using Cloudflare's workers-oauth-provider library |
| 27 | +- **Dynamic Client Registration**: Allowing clients to register automatically |
| 28 | +- **Token-Based Security**: Server-issued tokens for enhanced security |
| 29 | +- **Access Control**: Managing permissions and scopes |
| 30 | +- **GitHub and Slack Integration**: OAuth support for GitHub and Slack providers |
| 31 | +- **KV Storage Considerations**: OAuth operations use KV storage ([pricing details](https://developers.cloudflare.com/kv/platform/pricing/)) |
| 32 | + |
| 33 | +### Cloudflare Security Best Practices |
| 34 | + |
| 35 | +Ensure your remote MCP applications are secure in production: |
| 36 | + |
| 37 | +- **Environment Variables**: Managing secrets with Cloudflare Workers |
| 38 | +- **HTTPS by Default**: Automatic encryption for all communications |
| 39 | +- **Built-in Protection**: Using Cloudflare's DDoS protection |
| 40 | +- **Access Logging**: Monitoring and tracking MCP usage |
| 41 | +- **Rate Limiting**: Protecting against abuse and ensuring fair usage |
| 42 | + |
| 43 | +### GitHub Actions CI/CD Integration |
| 44 | + |
| 45 | +Implement continuous deployment for your MCP applications: |
| 46 | + |
| 47 | +- **GitHub Actions Workflow**: Setting up automated builds and deployments |
| 48 | +- **Environment Management**: Configuring different deployment environments |
| 49 | +- **Secrets Handling**: Managing sensitive information in GitHub Actions |
| 50 | +- **Testing Integration**: Running automated tests before deployment |
| 51 | +- **Deployment Automation**: Automated updates to your MCP applications |
| 52 | + |
| 53 | +### mcp-remote Client Adapter |
| 54 | + |
| 55 | +Enable Claude Code to connect to your remote servers: |
| 56 | + |
| 57 | +- **Client Bridge**: Using mcp-remote to connect Claude Code to remote servers |
| 58 | +- **Configuration Management**: Setting up remote server connections |
| 59 | +- **Debugging Tools**: Troubleshooting remote MCP connections |
| 60 | +- **Claude Code Integration**: Connecting your remote MCP server to Claude Code |
| 61 | + |
| 62 | +## Technical Deep Dive |
| 63 | + |
| 64 | +1. **Cloudflare Workers Implementation**: Building stateful MCP servers with minimal code |
| 65 | +2. **OAuth Integration Code**: Step-by-step OAuth 2.1 flow with GitHub and Slack |
| 66 | +3. **Durable Objects Pattern**: Managing persistent connections and state |
| 67 | +4. **Remote Transport Configuration**: Setting up SSE communication |
| 68 | +5. **GitHub Actions Workflows**: Creating CI/CD pipelines for Cloudflare deployment |
| 69 | +6. **Client Adapter Setup**: Bridging Claude Code to remote servers |
| 70 | + |
| 71 | +## Tutorial Structure |
| 72 | + |
| 73 | +1. **Cloudflare Workers Setup**: Prepare your Cloudflare account and development environment |
| 74 | +2. **OAuth Provider Configuration**: Set up OAuth applications with GitHub and Slack |
| 75 | +3. **Remote MCP Server Creation**: Build your first remote MCP server (authless and authenticated) |
| 76 | +4. **Durable Objects Implementation**: Add stateful capabilities to your workflow server |
| 77 | +5. **Authentication Integration**: Implement OAuth 2.1 with GitHub and Slack providers |
| 78 | +6. **GitHub Actions Setup**: Configure CI/CD workflows for automated Cloudflare deployment |
| 79 | +7. **Client Connection Setup**: Configure mcp-remote for Claude Code |
| 80 | +8. **Testing with AI Playground**: Use Cloudflare's Workers AI Playground as a test client |
| 81 | +9. **Production Deployment**: Deploy and monitor your remote MCP server |
| 82 | + |
| 83 | +## Cloudflare Free Tier and Pricing |
| 84 | + |
| 85 | +This unit leverages Cloudflare's free tier, which is generous for development and testing. For production applications, you should review the current pricing and limits: |
| 86 | + |
| 87 | +- **Workers**: [Pricing and Limits](https://developers.cloudflare.com/workers/platform/pricing/) |
| 88 | +- **Durable Objects**: [Pricing and Limits](https://developers.cloudflare.com/durable-objects/platform/pricing/) |
| 89 | +- **Workers KV**: [Pricing and Limits](https://developers.cloudflare.com/kv/platform/pricing/) (used by the OAuth library) |
| 90 | + |
| 91 | +The free tier is ideal for learning, development, and small-scale applications. For production deployments with higher traffic, consider Cloudflare's paid plans. |
| 92 | + |
| 93 | +## Prerequisites |
| 94 | + |
| 95 | +- Completion of Unit 3 (we'll use the same workflow server) |
| 96 | +- Cloudflare account (free tier available - see pricing section above) |
| 97 | +- GitHub account for OAuth integration and Actions |
| 98 | +- Slack workspace for OAuth integration (optional) |
| 99 | +- Basic understanding of web authentication concepts |
| 100 | +- Node.js and npm/yarn/pnpm installed |
| 101 | + |
| 102 | +## Community Contribution |
| 103 | + |
| 104 | +If you've deployed remote MCP applications on Cloudflare Workers or have experience with OAuth 2.1 authentication, we'd love to hear about your experience! Open a [discussion](https://huggingface.co/spaces/mcp-course/README/discussions) on the hub organization. |
| 105 | + |
| 106 | +By the end of this unit, you'll have the knowledge and hands-on experience to deploy secure, scalable remote MCP applications on Cloudflare Workers with OAuth authentication and automated GitHub Actions deployment. While we'll build production-ready architectures, note that Cloudflare's free tier is primarily suitable for development, testing, and small-scale applications. For high-traffic production use, you may need Cloudflare's paid plans. These skills will directly benefit your development work and prepare you for building AI applications with remote MCP capabilities. |
0 commit comments