building-mcp-server-on-cloudflare

Build and deploy remote MCP servers on Cloudflare Workers with OAuth 2.1.

Updated Apr 14, 2026
One-click install
npx skills add https://github.com/dallay/opencode-docker --skill building-mcp-server-on-cloudflare-dallay
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: building-mcp-server-on-cloudflare
Source: https://github.com/dallay/opencode-docker/tree/main/config/skills/building-mcp-server-on-cloudflare
Command: npx skills add https://github.com/dallay/opencode-docker --skill building-mcp-server-on-cloudflare-dallay

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Deploying and operating remote MCP (Model Context Protocol) servers is complex because it requires correct tool registration, secure OAuth flows, environment bindings, and platform-specific deployment steps for Cloudflare Workers. This Skill consolidates best practices, templates, and troubleshooting to reduce deployment errors and hard-to-diagnose authentication issues.

Core Features & Use Cases

  • Guided Server Bootstrapping: Step-by-step templates and project creation patterns for both authless and OAuth-protected MCP Workers.
  • Authentication & Security: Detailed OAuth 2.1 setup, CSRF/state handling, cookie security, and CSP recommendations for proxying and consent flows.
  • Deployment & Troubleshooting: Wrangler configuration examples, bindings/migrations guidance, common runtime errors, and local testing with the MCP inspector.
  • Use Case: Build a Cloudflare Worker that exposes validated tools via the /mcp SSE endpoint, protect it with GitHub or Google OAuth, and connect it to desktop clients like Claude Desktop.

Quick Start

Create a new Cloudflare MCP project from the appropriate demo template, configure OAuth secrets and Wrangler bindings, and deploy the Worker so the /mcp endpoint is reachable by your clients.

Frequently Asked Questions about building-mcp-server-on-cloudflare

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I deploy a remote MCP server on Cloudflare Workers?

To deploy a remote MCP server on Cloudflare Workers, use the guided templates to bootstrap the project, configure Wrangler bindings, and deploy the Worker so the /mcp SSE endpoint is reachable by your clients.

How do I add OAuth 2.1 authentication to an MCP server?

Add OAuth 2.1 authentication to an MCP server by configuring GitHub or Google OAuth secrets, handling CSRF and state parameters, and applying cookie security settings for consent flows and proxying.

Can I test MCP server connectivity locally before deploying to Cloudflare?

Yes, you can test MCP server connectivity locally using the MCP inspector to validate tool interfaces and troubleshoot runtime errors before deploying to Cloudflare Workers.

What is the best way to configure Wrangler for an MCP Worker deployment?

The best way to configure Wrangler for an MCP Worker deployment is using the provided configuration examples to manage environment bindings, migrations, and the /mcp SSE endpoint conventions.

Does the MCP server template support both authless and OAuth-protected deployments?

Yes, the MCP server templates support both authless and OAuth-protected deployments, allowing you to build validated tool interfaces and host authenticated MCP endpoints based on your requirements.

Why are my MCP tools not registering correctly on Cloudflare Workers?

MCP tools may not register correctly due to improper Wrangler configuration, missing environment bindings, or incorrect SSE endpoint conventions, which the troubleshooting guidance helps diagnose and resolve.