Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

17 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ MCP Lab Workshop

Learn Model Context Protocol (MCP) with Cloudflare Workers

Deploy to Cloudflare Workers

Cloudflare Workers MCP

๐ŸŽฏ What is This?

An interactive workshop for SE interns to learn about Model Context Protocol (MCP) servers. Deploy a live dashboard app that can be controlled in real-time via MCP tools.

What You'll Build

  1. ๐ŸŽจ Interactive Dashboard - A beautiful dark-themed web app with real-time stats
  2. ๐Ÿ”ง MCP Server - A fully functional MCP server with 8 tools to control the dashboard
  3. ๐Ÿ“ก Real-time Connection - Watch the dashboard update live as you call MCP tools

โœจ Features

Demo App

  • ๐ŸŒ™ Dark-themed beautiful UI with Cloudflare branding
  • ๐Ÿ“Š Live statistics that update in real-time
  • ๐ŸŽ›๏ธ Feature toggles (Analytics, Notifications, Dark Mode, Animations)
  • ๐Ÿ“ก Activity feed showing all MCP actions
  • โšก Server-Sent Events for instant updates

MCP Server

  • ๐Ÿ› ๏ธ 8 MCP Tools for controlling the dashboard
  • ๐Ÿ”“ No authentication required - perfect for learning
  • ๐ŸŒ Edge deployed - runs on Cloudflare's global network
  • ๐Ÿ“ฆ KV storage for state management

๐Ÿš€ Quick Deploy

One-Click Deploy

Click the button above to deploy to your Cloudflare account:

Deploy to Cloudflare Workers

The deploy process will:

  1. โœ… Clone the repo to your GitHub
  2. โœ… Create a KV namespace automatically
  3. โœ… Deploy TWO workers: mcp-demo-app (dashboard) and mcp-server (MCP tools)
  4. โœ… Give you live URLs instantly

Important: The deployment creates two separate workers. Make sure both are deployed successfully!

Manual Deploy

If you prefer to deploy manually:

# Clone the repo
git clone https://github.com/MattDMitch/mcp-lab-workshop.git
cd mcp-lab-workshop

# Install dependencies
npm install

# Login to Cloudflare
npx wrangler login

# Run deploy script (creates KV namespace and deploys both workers)
npm run deploy

This will deploy:

  • โœ… mcp-demo-app - The monitoring dashboard UI
  • โœ… mcp-server - The MCP tools server

๐ŸŽฎ Using the MCP Server

Once deployed, you'll get ONE worker with multiple endpoints:

  • Dashboard: https://YOUR-WORKER-NAME.YOUR-SUBDOMAIN.workers.dev/
  • MCP Server: https://YOUR-WORKER-NAME.YOUR-SUBDOMAIN.workers.dev/mcp

Both the dashboard and MCP server run in the same worker using path-based routing

Connect to MCP Server

Add the MCP server to your OpenCode or MCP client:

{
  "mcpServers": {
    "demo": {
      "url": "https://REPO-NAME-mcp.YOUR-SUBDOMAIN.workers.dev"
    }
  }
}

Available Tools

Tool Description Example
toggle_feature Toggle features on/off Toggle dark mode
update_stats Change dashboard numbers Set visitors to 9999
set_message Update banner message "Hello Interns! ๐Ÿ‘‹"
get_state View current app state Get all settings
reset_demo Reset to defaults Clean slate
simulate_traffic Generate fake activity Simulate high traffic
enable_all_features Turn on all features Enable everything
disable_all_features Turn off all features Disable everything

๐Ÿ’ก Try These Examples

Toggle Dark Mode

curl -X POST https://mcp-server.YOUR-SUBDOMAIN.workers.dev/mcp/tools/call \
  -H "Content-Type: application/json" \
  -d '{
    "tool": "toggle_feature",
    "arguments": {"feature": "darkMode"}
  }'

Set Custom Message

curl -X POST https://mcp-server.YOUR-SUBDOMAIN.workers.dev/mcp/tools/call \
  -H "Content-Type: application/json" \
  -d '{
    "tool": "set_message",
    "arguments": {"message": "Welcome SE Interns! ๐ŸŽ‰"}
  }'

Simulate High Traffic

curl -X POST https://mcp-server.YOUR-SUBDOMAIN.workers.dev/mcp/tools/call \
  -H "Content-Type: application/json" \
  -d '{
    "tool": "simulate_traffic",
    "arguments": {"amount": "high"}
  }'

Update Stats

curl -X POST https://mcp-server.YOUR-SUBDOMAIN.workers.dev/mcp/tools/call \
  -H "Content-Type: application/json" \
  -d '{
    "tool": "update_stats",
    "arguments": {"stat": "visitors", "value": 9999}
  }'

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Demo App Worker                โ”‚
โ”‚  - Dark-themed dashboard        โ”‚
โ”‚  - Server-Sent Events           โ”‚
โ”‚  - Real-time updates            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
             โ”‚
             โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Cloudflare KV Namespace        โ”‚
โ”‚  - App state storage            โ”‚
โ”‚  - Activity logs                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
             โ”‚
             โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  MCP Server Worker              โ”‚
โ”‚  - 8 MCP tools                  โ”‚
โ”‚  - Tool execution               โ”‚
โ”‚  - State management             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“š Workshop Guide

Part 1: Deploy (10 min)

  1. Click "Deploy to Cloudflare"
  2. Authorize GitHub and Cloudflare
  3. Get your live URLs

Part 2: Explore the Dashboard (10 min)

  1. Open the dashboard URL
  2. See the dark-themed interface
  3. Observe the stats and features

Part 3: Connect MCP Client (10 min)

  1. Add MCP server to OpenCode
  2. List available tools
  3. Verify connection

Part 4: Control the Dashboard (15 min)

  1. Toggle dark mode
  2. Update statistics
  3. Change the message
  4. Simulate traffic
  5. Watch real-time updates!

Part 5: Explore the Code (15 min)

  1. Review MCP server implementation
  2. Understand tool schemas
  3. See KV storage in action
  4. Learn about SSE for real-time updates

๐ŸŽ“ Learning Objectives

After this workshop, you'll understand:

  • โœ… What MCP is and why it's useful
  • โœ… How to build an MCP server
  • โœ… Tool schemas and execution
  • โœ… Real-time web applications with SSE
  • โœ… Cloudflare Workers and KV storage
  • โœ… Edge computing concepts

๐Ÿ› ๏ธ Tech Stack


๐Ÿ“‚ Project Structure

mcp-lab-complete/
โ”œโ”€โ”€ README.md              # This file
โ”œโ”€โ”€ wrangler.toml          # Cloudflare config
โ”œโ”€โ”€ package.json           # Project metadata
โ”œโ”€โ”€ demo-app/
โ”‚   โ””โ”€โ”€ index.js          # Dashboard worker
โ””โ”€โ”€ mcp-server/
    โ””โ”€โ”€ index.js          # MCP server worker

๐ŸŽจ Customization Ideas

For Students:

  • Add new MCP tools
  • Create custom themes
  • Add more statistics
  • Build a notification system
  • Add WebSocket support

For Instructors:

  • Create coding challenges
  • Add quiz questions
  • Build team competitions
  • Create extension exercises

๐Ÿ”— Resources


๐Ÿ“„ License

MIT License - Free to use for educational purposes


๐Ÿ™Œ Credits

Built for Cloudflare SE Intern Workshops

Made with โค๏ธ and โ˜•


Ready to learn MCP?

Deploy to Cloudflare Workers

About

MCP Lab Workshop - Learn Model Context Protocol with Cloudflare Workers

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages