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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8"/>
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
| 6 |
+
<title>MCP Jeopardy</title>
|
| 7 |
+
<style>
|
| 8 |
+
:root{
|
| 9 |
+
--blue:#0a49a6;
|
| 10 |
+
--blue-dark:#073a84;
|
| 11 |
+
--gold:#ffd24a;
|
| 12 |
+
--board-gap:10px;
|
| 13 |
+
--card-depth:28px;
|
| 14 |
+
}
|
| 15 |
+
*{box-sizing:border-box}
|
| 16 |
+
body{
|
| 17 |
+
font-family: system-ui, Arial, sans-serif;
|
| 18 |
+
display:flex;flex-direction:column;align-items:center;
|
| 19 |
+
background: radial-gradient(1200px 700px at 50% -200px, #f2f6ff 0%, #e9efff 30%, #cfdafc 100%) fixed;
|
| 20 |
+
margin:0; min-height:100vh;
|
| 21 |
+
}
|
| 22 |
+
h1{ color:#173e8c; margin:22px 0 6px; text-shadow:0 2px 0 #fff;}
|
| 23 |
+
a.source{ font-size:14px; color:#334; margin-bottom:8px; text-decoration:none}
|
| 24 |
+
a.source:hover{ text-decoration:underline }
|
| 25 |
+
/* 3D Stage */
|
| 26 |
+
.stage{
|
| 27 |
+
perspective: 1200px;
|
| 28 |
+
width:min(1100px, 95vw);
|
| 29 |
+
}
|
| 30 |
+
#game-board{
|
| 31 |
+
display:grid;
|
| 32 |
+
grid-template-columns: repeat(5, 1fr);
|
| 33 |
+
grid-auto-rows: 120px;
|
| 34 |
+
gap: var(--board-gap);
|
| 35 |
+
padding: var(--board-gap);
|
| 36 |
+
border-radius:18px;
|
| 37 |
+
background: linear-gradient(180deg, #0e1a3a, #01060f);
|
| 38 |
+
box-shadow:
|
| 39 |
+
0 20px 45px rgba(0,0,0,.35),
|
| 40 |
+
inset 0 0 0 4px #000;
|
| 41 |
+
transform: rotateX(8deg);
|
| 42 |
+
transform-origin: top center;
|
| 43 |
+
}
|
| 44 |
+
.category, .card{
|
| 45 |
+
position:relative;
|
| 46 |
+
border-radius:14px;
|
| 47 |
+
user-select:none;
|
| 48 |
+
transform-style: preserve-3d;
|
| 49 |
+
transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
|
| 50 |
+
box-shadow:
|
| 51 |
+
0 var(--card-depth) calc(var(--card-depth) + 12px) rgba(0,0,0,.35),
|
| 52 |
+
inset 0 0 0 1px rgba(255,255,255,.15);
|
| 53 |
+
}
|
| 54 |
+
.category{
|
| 55 |
+
background: linear-gradient(180deg, #004fbf 0%, #003d93 60%, #003684 100%);
|
| 56 |
+
color:#fff; font-weight:800; text-transform:uppercase; letter-spacing:.3px;
|
| 57 |
+
display:flex; justify-content:center; align-items:center; text-align:center;
|
| 58 |
+
border:1px solid #00122c;
|
| 59 |
+
text-shadow:0 2px 0 rgba(0,0,0,.35);
|
| 60 |
+
}
|
| 61 |
+
.card{
|
| 62 |
+
cursor:pointer; font-weight:900; color: var(--gold);
|
| 63 |
+
background:
|
| 64 |
+
radial-gradient(80% 80% at 50% 25%, rgba(255,255,255,.18), rgba(255,255,255,0) 60%),
|
| 65 |
+
linear-gradient(180deg, var(--blue) 0%, var(--blue-dark) 100%);
|
| 66 |
+
border:1px solid #031b3f;
|
| 67 |
+
display:flex; justify-content:center; align-items:center; text-align:center;
|
| 68 |
+
font-size: clamp(16px, 2.4vw, 26px);
|
| 69 |
+
text-shadow: 0 2px 0 #000, 0 0 10px rgba(255,210,74,.35);
|
| 70 |
+
}
|
| 71 |
+
/* 3D hover tilt + press */
|
| 72 |
+
.card.tilt:hover{
|
| 73 |
+
transform: translateZ(10px) rotateX(var(--rx,0deg)) rotateY(var(--ry,0deg));
|
| 74 |
+
box-shadow:
|
| 75 |
+
0 24px 48px rgba(0,0,0,.4),
|
| 76 |
+
0 0 24px rgba(255,210,74,.15),
|
| 77 |
+
inset 0 0 0 1px rgba(255,255,255,.18);
|
| 78 |
+
filter: saturate(1.1);
|
| 79 |
+
}
|
| 80 |
+
.card:active{
|
| 81 |
+
transform: translateZ(0) scale(.985);
|
| 82 |
+
box-shadow: 0 12px 18px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.12);
|
| 83 |
+
}
|
| 84 |
+
.card.disabled{
|
| 85 |
+
cursor:default; color:#bfc7da;
|
| 86 |
+
background: linear-gradient(180deg,#6b7aa6,#4e5b85);
|
| 87 |
+
text-shadow:none; filter:grayscale(.2) brightness(.92);
|
| 88 |
+
}
|
| 89 |
+
#question-display{ width:min(1000px, 92vw); text-align:center; margin:16px 0 6px; }
|
| 90 |
+
#question-display h2{ margin:8px 0 6px; color:#0d2b6f }
|
| 91 |
+
#question-display p{ margin:8px 0 }
|
| 92 |
+
#score{ font-size:24px; font-weight:800; color:#0d2b6f; margin-bottom:24px }
|
| 93 |
+
.answer-container{ display:flex; justify-content:center; flex-wrap:wrap; gap:10px; margin-top:14px }
|
| 94 |
+
.answer-btn{
|
| 95 |
+
margin:0; padding:10px 16px; font-size:18px; cursor:pointer;
|
| 96 |
+
border:2px solid #0d3a85; border-radius:10px; font-weight:800; color:#fff;
|
| 97 |
+
background: linear-gradient(180deg,#1362ff,#0d3a85);
|
| 98 |
+
box-shadow: 0 8px 18px rgba(0,0,0,.25);
|
| 99 |
+
transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
|
| 100 |
+
}
|
| 101 |
+
.answer-btn:hover{ transform: translateY(-2px); box-shadow:0 12px 26px rgba(0,0,0,.28) }
|
| 102 |
+
.answer-btn:active{ transform: translateY(0); box-shadow:0 8px 18px rgba(0,0,0,.25) }
|
| 103 |
+
.answer-btn.disabled{ background:#aab4cc; color:#445; cursor:not-allowed; border-color:#889 }
|
| 104 |
+
.feedback{ margin-top:10px; font-size:18px; font-weight:800 }
|
| 105 |
+
/* DAILY DOUBLE overlay + flashing */
|
| 106 |
+
.dd-overlay{
|
| 107 |
+
position: fixed; inset:0; display:none; align-items:center; justify-content:center;
|
| 108 |
+
z-index: 9999; pointer-events:none;
|
| 109 |
+
background: radial-gradient(60% 60% at 50% 50%, rgba(255,255,255,.08), rgba(0,0,0,.7));
|
| 110 |
+
animation: dd-bg 1.2s ease-in-out 2;
|
| 111 |
+
}
|
| 112 |
+
.dd-text{
|
| 113 |
+
font-size: clamp(40px, 7vw, 120px);
|
| 114 |
+
font-weight: 900; color:#ffe17a; letter-spacing:2px;
|
| 115 |
+
text-shadow:
|
| 116 |
+
0 0 12px rgba(255,225,122,.9),
|
| 117 |
+
0 0 40px rgba(255,225,122,.6),
|
| 118 |
+
0 6px 0 #000;
|
| 119 |
+
animation: flash 1.2s steps(2, jump-none) 2, wobble .9s ease-in-out 2;
|
| 120 |
+
}
|
| 121 |
+
@keyframes flash{
|
| 122 |
+
0%, 49% { opacity:1; filter:drop-shadow(0 0 24px rgba(255,225,122,.85)); }
|
| 123 |
+
50%, 100% { opacity:0; filter:none; }
|
| 124 |
+
}
|
| 125 |
+
@keyframes wobble{
|
| 126 |
+
0%{ transform: scale(1) rotate(0deg) }
|
| 127 |
+
50%{ transform: scale(1.06) rotate(-2deg) }
|
| 128 |
+
100%{ transform: scale(1) rotate(0deg) }
|
| 129 |
+
}
|
| 130 |
+
@keyframes dd-bg{
|
| 131 |
+
0%{ background: radial-gradient(40% 40% at 50% 50%, rgba(255,255,255,.12), rgba(0,0,0,.9)); }
|
| 132 |
+
100%{ background: radial-gradient(60% 60% at 50% 50%, rgba(255,255,255,.08), rgba(0,0,0,.7)); }
|
| 133 |
+
}
|
| 134 |
+
/* Card flash ring */
|
| 135 |
+
.flash-ring{
|
| 136 |
+
position:absolute; inset:-3px; border-radius:14px; pointer-events:none;
|
| 137 |
+
box-shadow:0 0 0 3px rgba(255,225,122,.95), 0 0 30px 6px rgba(255,225,122,.6);
|
| 138 |
+
animation: ring 1.2s ease-in-out 2;
|
| 139 |
+
}
|
| 140 |
+
@keyframes ring{
|
| 141 |
+
0%{ opacity:1; transform: scale(1) }
|
| 142 |
+
50%{ opacity:.1; transform: scale(0.96) }
|
| 143 |
+
100%{ opacity:1; transform: scale(1) }
|
| 144 |
+
}
|
| 145 |
+
.daily-double-banner{ color:#b30000; font-weight:900; font-size:22px; margin:8px 0 }
|
| 146 |
+
</style>
|
| 147 |
+
</head>
|
| 148 |
+
<body>
|
| 149 |
+
<h1>MCP Jeopardy</h1>
|
| 150 |
+
<a class="source" href="https://www.linkedin.com/pulse/understanding-model-context-protocol-mcp-server-its-role-lively-cjzaf/" target="_blank">
|
| 151 |
+
Source: Understanding the Model Context Protocol (MCP) Server & Its Role
|
| 152 |
+
</a>
|
| 153 |
+
|
| 154 |
+
<div class="stage">
|
| 155 |
+
<div id="game-board">
|
| 156 |
+
<div class="category">MCP Basics</div>
|
| 157 |
+
<div class="category">Dynamic Tool Discovery</div>
|
| 158 |
+
<div class="category">MCP Server & Client</div>
|
| 159 |
+
<div class="category">Azure AI Integration</div>
|
| 160 |
+
<div class="category">Use Cases & Benefits</div>
|
| 161 |
+
<!-- cards will be injected -->
|
| 162 |
+
</div>
|
| 163 |
+
</div>
|
| 164 |
+
|
| 165 |
+
<div id="question-display"></div>
|
| 166 |
+
<div id="score">Score: 0</div>
|
| 167 |
+
|
| 168 |
+
<!-- Daily Double audio: place daily-double.mp3 next to this file or swap the src -->
|
| 169 |
+
<audio id="dd-audio" preload="auto">
|
| 170 |
+
<source src="daily-double.mp3" type="audio/mpeg">
|
| 171 |
+
</audio>
|
| 172 |
+
|
| 173 |
+
<!-- Flashing overlay -->
|
| 174 |
+
<div id="dd-overlay" class="dd-overlay"><div class="dd-text">DAILY DOUBLE!</div></div>
|
| 175 |
+
|
| 176 |
+
<script>
|
| 177 |
+
const categories = ["MCP Basics", "Dynamic Tool Discovery", "MCP Server & Client", "Azure AI Integration", "Use Cases & Benefits"];
|
| 178 |
+
|
| 179 |
+
// 15 questions total; correct indices are evenly distributed: five 0s, five 1s, five 2s
|
| 180 |
+
const questions = [
|
| 181 |
+
// MCP Basics (correct indices: 0,1,2)
|
| 182 |
+
[
|
| 183 |
+
{ q: "An MCP server primarily acts as a:", a: ["Centralized tool registry", "Model-training service", "CI/CD runner"], correct: 0 },
|
| 184 |
+
{ q: "The MCP client is best described as a:", a: ["Tool compiler", "Bridge between agent and server", "Vector database"], correct: 1 },
|
| 185 |
+
{ q: "Which decorator exposes functions as tools for discovery?", a: ["@http.route", "@fastapi.tool", "@mcp.tool"], correct: 2 }
|
| 186 |
+
],
|
| 187 |
+
// Dynamic Tool Discovery (correct indices: 0,1,2)
|
| 188 |
+
[
|
| 189 |
+
{ q: "Dynamic tool discovery lets agents:", a: ["Find and use tools at runtime", "Require redeploys for new tools", "Disable external tools"], correct: 0 },
|
| 190 |
+
{ q: "A key benefit of dynamic discovery is:", a: ["Manual configuration", "Maintainability via central updates", "Vendor lock-in"], correct: 1 },
|
| 191 |
+
{ q: "Dynamic discovery reduces the need to:", a: ["Secure APIs", "Write unit tests", "Hardcode every tool in the agent"], correct: 2 }
|
| 192 |
+
],
|
| 193 |
+
// MCP Server & Client (correct indices: 0,1,2)
|
| 194 |
+
[
|
| 195 |
+
{ q: "Which method lists tools exposed by the MCP server?", a: ["session.list_tools()", "client.describe()", "mcp.fetch_all()"], correct: 0 },
|
| 196 |
+
{ q: "What does the MCP client register with the agent?", a: ["Bash scripts", "Function wrappers for tools", "YAML manifests"], correct: 1 },
|
| 197 |
+
{ q: "To invoke a tool directly through the client, you use:", a: ["agent.use_tool()", "client.invoke()", "session.call_tool(name, args)"], correct: 2 }
|
| 198 |
+
],
|
| 199 |
+
// Azure AI Integration (correct indices: 0,1,2)
|
| 200 |
+
[
|
| 201 |
+
{ q: "Which object connects an Azure AI agent to remote MCP servers?", a: ["McpTool", "AzureConnector", "ServerProxy"], correct: 0 },
|
| 202 |
+
{ q: "Which approval mode requires manual review of each tool call?", a: ["never", "always", "auto"], correct: 1 },
|
| 203 |
+
{ q: "Custom headers for MCP tools typically carry:", a: ["CSS styles", "Image sprites", "Authentication tokens"], correct: 2 }
|
| 204 |
+
],
|
| 205 |
+
// Use Cases & Benefits (correct indices: 0,1,2)
|
| 206 |
+
[
|
| 207 |
+
{ q: "In the retailer example, which task is out of scope for the agent?", a: ["Compiling source code", "Checking stock levels", "Recommending restocks"], correct: 0 },
|
| 208 |
+
{ q: "Centralized management in MCP means:", a: ["Tools are static forever", "Tool updates happen on the server", "Agents ignore servers"], correct: 1 },
|
| 209 |
+
{ q: "A top payoff of MCP integration is:", a: ["Code obfuscation", "Harder maintenance", "Future-proofing and flexibility"], correct: 2 }
|
| 210 |
+
]
|
| 211 |
+
];
|
| 212 |
+
|
| 213 |
+
let score = 0, answered = 0, total = 15;
|
| 214 |
+
const board = document.getElementById("game-board"),
|
| 215 |
+
qdisp = document.getElementById("question-display"),
|
| 216 |
+
sdisp = document.getElementById("score");
|
| 217 |
+
const ddOverlay = document.getElementById("dd-overlay");
|
| 218 |
+
const ddAudio = document.getElementById("dd-audio");
|
| 219 |
+
|
| 220 |
+
// Random Daily Double location
|
| 221 |
+
const dailyDouble = { col: Math.floor(Math.random() * 5), row: Math.floor(Math.random() * 3) };
|
| 222 |
+
|
| 223 |
+
function createBoard() {
|
| 224 |
+
// inject 3 rows x 5 cols of cards after the 5 category headers
|
| 225 |
+
for (let row = 0; row < 3; row++) {
|
| 226 |
+
for (let col = 0; col < 5; col++) {
|
| 227 |
+
const card = document.createElement("div");
|
| 228 |
+
card.className = "card tilt";
|
| 229 |
+
card.textContent = `$${(row + 1) * 100}`;
|
| 230 |
+
// store coordinates on the node
|
| 231 |
+
card.dataset.col = col;
|
| 232 |
+
card.dataset.row = row;
|
| 233 |
+
// 3D hover tilt via mouse position
|
| 234 |
+
card.addEventListener("mousemove", (e) => {
|
| 235 |
+
const r = card.getBoundingClientRect();
|
| 236 |
+
const x = (e.clientX - r.left) / r.width; // 0..1
|
| 237 |
+
const y = (e.clientY - r.top) / r.height; // 0..1
|
| 238 |
+
const ry = (x - 0.5) * 10; // deg
|
| 239 |
+
const rx = (0.5 - y) * 10; // deg
|
| 240 |
+
card.style.setProperty("--ry", `${ry}deg`);
|
| 241 |
+
card.style.setProperty("--rx", `${rx}deg`);
|
| 242 |
+
});
|
| 243 |
+
card.addEventListener("mouseleave", () => {
|
| 244 |
+
card.style.removeProperty("--ry");
|
| 245 |
+
card.style.removeProperty("--rx");
|
| 246 |
+
});
|
| 247 |
+
card.onclick = () => handleCardClick(card);
|
| 248 |
+
board.appendChild(card);
|
| 249 |
+
}
|
| 250 |
+
}
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
function handleCardClick(card){
|
| 254 |
+
if (card.classList.contains("disabled")) return;
|
| 255 |
+
const col = +card.dataset.col;
|
| 256 |
+
const row = +card.dataset.row;
|
| 257 |
+
const isDD = (col === dailyDouble.col && row === dailyDouble.row);
|
| 258 |
+
if (isDD){
|
| 259 |
+
triggerDailyDouble(card, () => showQuestion(col, row, card, true));
|
| 260 |
+
} else {
|
| 261 |
+
showQuestion(col, row, card, false);
|
| 262 |
+
}
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
function triggerDailyDouble(card, onDone){
|
| 266 |
+
const ring = document.createElement("div");
|
| 267 |
+
ring.className = "flash-ring";
|
| 268 |
+
card.appendChild(ring);
|
| 269 |
+
ddAudio.currentTime = 0;
|
| 270 |
+
ddAudio.play().catch(()=>{});
|
| 271 |
+
ddOverlay.style.display = "flex";
|
| 272 |
+
setTimeout(() => {
|
| 273 |
+
ddOverlay.style.display = "none";
|
| 274 |
+
ring.remove();
|
| 275 |
+
onDone();
|
| 276 |
+
}, 2400);
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
function showQuestion(categoryIndex, difficulty, card, isDailyDouble){
|
| 280 |
+
const q = questions[categoryIndex][difficulty];
|
| 281 |
+
// shuffle answers
|
| 282 |
+
let answerOptions = q.a.map((ans, idx) => ({ text: ans, isCorrect: idx === q.correct }));
|
| 283 |
+
for (let i = answerOptions.length - 1; i > 0; i--) {
|
| 284 |
+
const j = Math.floor(Math.random() * (i + 1));
|
| 285 |
+
[answerOptions[i], answerOptions[j]] = [answerOptions[j], answerOptions[i]];
|
| 286 |
+
}
|
| 287 |
+
const dailyDoubleBanner = isDailyDouble ? `<div class="daily-double-banner">π DAILY DOUBLE! π</div>` : "";
|
| 288 |
+
qdisp.innerHTML = `
|
| 289 |
+
${dailyDoubleBanner}
|
| 290 |
+
<h2>${categories[categoryIndex]} for $${(difficulty + 1) * 100}${isDailyDouble ? " (x2)" : ""}</h2>
|
| 291 |
+
<p>${q.q}</p>
|
| 292 |
+
<div class="answer-container">
|
| 293 |
+
${answerOptions.map(opt =>
|
| 294 |
+
`<button class="answer-btn" onclick="checkAnswer(${categoryIndex},${difficulty},${opt.isCorrect}, ${isDailyDouble})">${opt.text}</button>`
|
| 295 |
+
).join("")}
|
| 296 |
+
</div>
|
| 297 |
+
`;
|
| 298 |
+
card.classList.add("disabled");
|
| 299 |
+
answered++;
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
window.checkAnswer = (cat, diff, isCorrect, isDouble) => {
|
| 303 |
+
const q = questions[cat][diff];
|
| 304 |
+
let val = (diff + 1) * 100;
|
| 305 |
+
if (isDouble) val *= 2;
|
| 306 |
+
const correctText = q.a[q.correct];
|
| 307 |
+
document.querySelectorAll(".answer-btn").forEach(b => {
|
| 308 |
+
b.disabled = true; b.classList.add("disabled");
|
| 309 |
+
});
|
| 310 |
+
if (isCorrect) {
|
| 311 |
+
score += val;
|
| 312 |
+
qdisp.innerHTML += `<p class="feedback" style="color:green;">β
Correct! +$${val}</p>`;
|
| 313 |
+
} else {
|
| 314 |
+
score -= val;
|
| 315 |
+
qdisp.innerHTML += `<p class="feedback" style="color:#b00020;">β Wrong! β$${val}. Correct: ${correctText}</p>`;
|
| 316 |
+
}
|
| 317 |
+
sdisp.textContent = `Score: ${score}`;
|
| 318 |
+
if (answered === 15) {
|
| 319 |
+
qdisp.innerHTML += `<h2 style="margin-top:12px">Game Over!</h2><p>Your final score: $${score}</p>`;
|
| 320 |
+
}
|
| 321 |
+
};
|
| 322 |
+
|
| 323 |
+
createBoard();
|
| 324 |
+
</script>
|
| 325 |
+
</body>
|
| 326 |
</html>
|