-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_deck.py
More file actions
549 lines (467 loc) · 25.8 KB
/
build_deck.py
File metadata and controls
549 lines (467 loc) · 25.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
"""Generate a Keynote-compatible .pptx deck for MCP Python SDK."""
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN
from pptx.enum.shapes import MSO_SHAPE
# ── Theme ──────────────────────────────────────────────────────
BG = RGBColor(0x0F, 0x17, 0x2A)
ACCENT = RGBColor(0x00, 0xBF, 0xA5)
CORAL = RGBColor(0xFF, 0x6B, 0x6B)
YELLOW = RGBColor(0xFF, 0xD9, 0x3D)
WHITE = RGBColor(0xFF, 0xFF, 0xFF)
LIGHT = RGBColor(0xB0, 0xC4, 0xDE)
DARK_BG2 = RGBColor(0x16, 0x21, 0x3E)
CODE_BG = RGBColor(0x1A, 0x1A, 0x2E)
CODE_FG = RGBColor(0x98, 0xC3, 0x79)
prs = Presentation()
prs.slide_width = Inches(13.333)
prs.slide_height = Inches(7.5)
W = prs.slide_width
H = prs.slide_height
def add_bg(slide, color=BG):
fill = slide.background.fill
fill.solid()
fill.fore_color.rgb = color
def tb(slide, left, top, width, height, text,
sz=18, color=WHITE, bold=False, align=PP_ALIGN.LEFT, font="Helvetica Neue"):
box = slide.shapes.add_textbox(left, top, width, height)
tf = box.text_frame
tf.word_wrap = True
p = tf.paragraphs[0]
p.text = text
p.font.size = Pt(sz)
p.font.color.rgb = color
p.font.bold = bold
p.font.name = font
p.alignment = align
return box
def box(slide, left, top, width, height, fill=DARK_BG2, border=ACCENT):
s = slide.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, left, top, width, height)
s.fill.solid()
s.fill.fore_color.rgb = fill
s.line.color.rgb = border
s.line.width = Pt(1.5)
s.shadow.inherit = False
return s
def arrow(slide, left, top, w=Inches(0.6), h=Inches(0.3)):
a = slide.shapes.add_shape(MSO_SHAPE.RIGHT_ARROW, left, top, w, h)
a.fill.solid()
a.fill.fore_color.rgb = ACCENT
a.line.fill.background()
return a
def bullets(slide, items, top=Inches(2.2), left=Inches(1.2)):
for i, item in enumerate(items):
tb(slide, left, top + Inches(i * 0.55), Inches(11), Inches(0.5),
f" {item}", sz=20, color=LIGHT)
# ════════════════════════════════════════════════════════════════
# Slide 1: Title
# ════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(prs.slide_layouts[6])
add_bg(s)
tb(s, Inches(1), Inches(1.2), Inches(11), Inches(1.2),
"Model Context Protocol", sz=48, bold=True, align=PP_ALIGN.CENTER)
tb(s, Inches(1), Inches(2.8), Inches(11), Inches(0.8),
"Building MCP Servers & Clients with the Python SDK", sz=28, color=ACCENT, align=PP_ALIGN.CENTER)
tb(s, Inches(1), Inches(4.5), Inches(11), Inches(0.6),
"Tools \u2022 Resources \u2022 Prompts \u2022 Transports \u2022 Structured Output",
sz=20, color=LIGHT, align=PP_ALIGN.CENTER)
tb(s, Inches(1), Inches(5.8), Inches(11), Inches(0.5),
"Based on github.com/modelcontextprotocol/python-sdk",
sz=16, color=LIGHT, align=PP_ALIGN.CENTER)
# ════════════════════════════════════════════════════════════════
# Slide 2: What is MCP?
# ════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(prs.slide_layouts[6])
add_bg(s)
tb(s, Inches(1), Inches(0.6), Inches(11), Inches(0.8),
"What is MCP?", sz=40, bold=True)
bullets(s, [
"\u2022 Open standard for connecting AI apps to external systems",
"\u2022 Think of it as USB-C for AI \u2014 one protocol, many integrations",
"\u2022 JSON-RPC 2.0 over stdio or HTTP transports",
"\u2022 Three primitives: Tools, Resources, Prompts",
"\u2022 Built-in capability negotiation and lifecycle management",
])
# ════════════════════════════════════════════════════════════════
# Slide 3: Architecture
# ════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(prs.slide_layouts[6])
add_bg(s)
tb(s, Inches(1), Inches(0.6), Inches(11), Inches(0.8),
"Architecture", sz=40, bold=True)
tb(s, Inches(1), Inches(1.6), Inches(11), Inches(0.5),
"Host \u2192 Client \u2192 Server (one client per server connection)",
sz=20, color=LIGHT)
# Three boxes
labels = [
("MCP Host", "Claude Desktop\nClaude Code\nVS Code", CORAL),
("MCP Client", "Manages 1:1\nserver connection", ACCENT),
("MCP Server", "Exposes tools\nresources, prompts", ACCENT),
]
bw, bh = Inches(3.2), Inches(2.0)
y = Inches(3.0)
for i, (title, desc, clr) in enumerate(labels):
x = Inches(0.8) + i * (bw + Inches(0.6))
box(s, x, y, bw, bh, border=clr)
tb(s, x + Inches(0.2), y + Inches(0.25), bw - Inches(0.4), Inches(0.5),
title, sz=22, color=clr, bold=True, align=PP_ALIGN.CENTER)
tb(s, x + Inches(0.2), y + Inches(0.9), bw - Inches(0.4), Inches(0.9),
desc, sz=16, color=LIGHT, align=PP_ALIGN.CENTER)
if i < 2:
arrow(s, x + bw + Inches(0.05), y + Inches(0.85))
# Transport labels
tb(s, Inches(1), Inches(5.5), Inches(11), Inches(0.5),
"Transports: stdio (local) | Streamable HTTP (remote) | SSE (legacy)",
sz=18, color=LIGHT, align=PP_ALIGN.CENTER)
# ════════════════════════════════════════════════════════════════
# Slide 4: Three Primitives
# ════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(prs.slide_layouts[6])
add_bg(s)
tb(s, Inches(1), Inches(0.6), Inches(11), Inches(0.8),
"Three Core Primitives", sz=40, bold=True)
primitives = [
("Tools", "Model-controlled", "Functions the LLM\ncan call", "Like POST endpoints", ACCENT),
("Resources", "App-controlled", "Read-only data the\napp can fetch", "Like GET endpoints", YELLOW),
("Prompts", "User-controlled", "Reusable templates\nfor interactions", "Like saved queries", CORAL),
]
bw, bh = Inches(3.5), Inches(2.8)
y = Inches(2.2)
for i, (name, ctrl, desc, analogy, clr) in enumerate(primitives):
x = Inches(0.8) + i * (bw + Inches(0.4))
box(s, x, y, bw, bh, border=clr)
tb(s, x + Inches(0.2), y + Inches(0.2), bw - Inches(0.4), Inches(0.5),
name, sz=26, color=clr, bold=True, align=PP_ALIGN.CENTER)
tb(s, x + Inches(0.2), y + Inches(0.8), bw - Inches(0.4), Inches(0.4),
ctrl, sz=16, color=LIGHT, align=PP_ALIGN.CENTER)
tb(s, x + Inches(0.2), y + Inches(1.3), bw - Inches(0.4), Inches(0.8),
desc, sz=18, color=WHITE, align=PP_ALIGN.CENTER)
tb(s, x + Inches(0.2), y + Inches(2.2), bw - Inches(0.4), Inches(0.4),
analogy, sz=14, color=LIGHT, align=PP_ALIGN.CENTER)
# ════════════════════════════════════════════════════════════════
# Slide 5: Tools — @mcp.tool()
# ════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(prs.slide_layouts[6])
add_bg(s)
tb(s, Inches(1), Inches(0.6), Inches(11), Inches(0.8),
"Tools \u2014 @mcp.tool()", sz=40, bold=True)
tb(s, Inches(1), Inches(1.5), Inches(11), Inches(0.5),
"Type hints \u2192 JSON Schema. Docstrings \u2192 descriptions. Sync or async.",
sz=20, color=LIGHT)
code = '''from mcp.server.fastmcp import FastMCP
mcp = FastMCP("Demo")
@mcp.tool()
def add(a: int, b: int) -> int:
"""Add two numbers together."""
return a + b
@mcp.tool()
async def fetch_data(url: str, ctx: Context) -> str:
"""Fetch data with progress reporting."""
await ctx.report_progress(progress=0, total=100)
await ctx.info(f"Fetching {url}")
# ... fetch logic ...
return result'''
box(s, Inches(1), Inches(2.3), Inches(11.3), Inches(4.2), fill=CODE_BG, border=ACCENT)
tb(s, Inches(1.3), Inches(2.5), Inches(10.7), Inches(4.0), code, sz=17, color=CODE_FG, font="Menlo")
tb(s, Inches(1), Inches(6.8), Inches(5), Inches(0.4),
"See: examples/01_basic_server.py, 02_tools_with_context.py", sz=15, color=ACCENT)
# ════════════════════════════════════════════════════════════════
# Slide 6: Resources — @mcp.resource()
# ════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(prs.slide_layouts[6])
add_bg(s)
tb(s, Inches(1), Inches(0.6), Inches(11), Inches(0.8),
"Resources \u2014 @mcp.resource()", sz=40, bold=True)
tb(s, Inches(1), Inches(1.5), Inches(11), Inches(0.5),
"URI-based read-only data. Fixed URIs or templates with {parameters}.",
sz=20, color=LIGHT)
code = '''# Static resource — fixed URI
@mcp.resource("config://app")
def app_config() -> str:
return json.dumps({"version": "1.0"})
# Template resource — dynamic URI
@mcp.resource("user://{user_id}/profile")
def user_profile(user_id: str) -> str:
return json.dumps(USERS[user_id])'''
box(s, Inches(1), Inches(2.3), Inches(11.3), Inches(3.0), fill=CODE_BG, border=YELLOW)
tb(s, Inches(1.3), Inches(2.5), Inches(10.7), Inches(2.7), code, sz=18, color=CODE_FG, font="Menlo")
bullets(s, [
"\u2022 Host application decides when to fetch (not the model)",
"\u2022 Ideal for config, user profiles, documentation, file contents",
"\u2022 Support subscriptions for change notifications",
], top=Inches(5.7))
tb(s, Inches(1), Inches(6.8), Inches(5), Inches(0.4),
"See: examples/03_resources_and_templates.py", sz=15, color=ACCENT)
# ════════════════════════════════════════════════════════════════
# Slide 7: Prompts — @mcp.prompt()
# ════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(prs.slide_layouts[6])
add_bg(s)
tb(s, Inches(1), Inches(0.6), Inches(11), Inches(0.8),
"Prompts \u2014 @mcp.prompt()", sz=40, bold=True)
tb(s, Inches(1), Inches(1.5), Inches(11), Inches(0.5),
"User-invoked templates for common interactions. Support parameters + defaults.",
sz=20, color=LIGHT)
code = '''@mcp.prompt()
def code_review(code: str, focus: str = "general") -> str:
"""Comprehensive code review prompt."""
focus_map = {
"general": "Review for correctness and style",
"security": "Focus on OWASP Top 10 risks",
"performance": "Focus on complexity and bottlenecks",
}
return f"{focus_map[focus]}:\\n\\n```\\n{code}\\n```"'''
box(s, Inches(1), Inches(2.3), Inches(11.3), Inches(3.2), fill=CODE_BG, border=CORAL)
tb(s, Inches(1.3), Inches(2.5), Inches(10.7), Inches(3.0), code, sz=18, color=CODE_FG, font="Menlo")
bullets(s, [
"\u2022 Explicitly selected by the user, not the model",
"\u2022 Great for: code review, debugging, architecture decisions",
"\u2022 Support parameter completion for discoverable arguments",
], top=Inches(5.8))
tb(s, Inches(1), Inches(6.8), Inches(5), Inches(0.4),
"See: examples/05_prompts.py", sz=15, color=ACCENT)
# ════════════════════════════════════════════════════════════════
# Slide 8: Context — Logging & Progress
# ════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(prs.slide_layouts[6])
add_bg(s)
tb(s, Inches(1), Inches(0.6), Inches(11), Inches(0.8),
"Context \u2014 Logging & Progress", sz=40, bold=True)
tb(s, Inches(1), Inches(1.5), Inches(11), Inches(0.5),
"Inject ctx: Context into any tool for runtime capabilities",
sz=20, color=LIGHT)
code = '''@mcp.tool()
async def process(items: list[str], ctx: Context) -> str:
for i, item in enumerate(items):
await ctx.report_progress(progress=i, total=len(items))
await ctx.info(f"Processing {item}")
# ... work ...
return "Done"'''
box(s, Inches(1), Inches(2.3), Inches(11.3), Inches(2.5), fill=CODE_BG, border=ACCENT)
tb(s, Inches(1.3), Inches(2.5), Inches(10.7), Inches(2.3), code, sz=18, color=CODE_FG, font="Menlo")
# Context methods table
methods = [
("ctx.info(msg)", "Log informational message"),
("ctx.debug(msg)", "Log debug-level detail"),
("ctx.warning(msg)", "Log a warning"),
("ctx.error(msg)", "Log an error"),
("ctx.report_progress(p, total)", "Update progress bar"),
("ctx.request_context.lifespan_context", "Access shared state (DB, cache)"),
]
y0 = Inches(5.2)
for i, (method, desc) in enumerate(methods):
tb(s, Inches(1.2), y0 + Inches(i * 0.35), Inches(4.5), Inches(0.3),
method, sz=15, color=ACCENT, font="Menlo")
tb(s, Inches(6), y0 + Inches(i * 0.35), Inches(6), Inches(0.3),
desc, sz=15, color=LIGHT)
# ════════════════════════════════════════════════════════════════
# Slide 9: Structured Output
# ════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(prs.slide_layouts[6])
add_bg(s)
tb(s, Inches(1), Inches(0.6), Inches(11), Inches(0.8),
"Structured Output", sz=40, bold=True)
tb(s, Inches(1), Inches(1.5), Inches(11), Inches(0.5),
"Return typed data from tools \u2014 validated JSON alongside text",
sz=20, color=LIGHT)
types = [
("Pydantic BaseModel", "class Weather(BaseModel):\n city: str\n temp: float"),
("TypedDict", "class Metrics(TypedDict):\n cpu: float\n memory: int"),
("Dataclass", "@dataclass\nclass Result:\n status: str\n count: int"),
("Primitives", "def count(text: str) -> int:\n return len(text.split())"),
]
bw, bh = Inches(2.8), Inches(2.5)
y = Inches(2.5)
for i, (label, code_text) in enumerate(types):
x = Inches(0.6) + i * (bw + Inches(0.3))
box(s, x, y, bw, bh, fill=CODE_BG, border=ACCENT)
tb(s, x + Inches(0.15), y + Inches(0.15), bw - Inches(0.3), Inches(0.4),
label, sz=16, color=ACCENT, bold=True, align=PP_ALIGN.CENTER)
tb(s, x + Inches(0.15), y + Inches(0.7), bw - Inches(0.3), Inches(1.5),
code_text, sz=14, color=CODE_FG, font="Menlo")
tb(s, Inches(1), Inches(5.5), Inches(11), Inches(0.5),
"Structured content is sent alongside text so both model and app can consume it",
sz=18, color=LIGHT)
tb(s, Inches(1), Inches(6.3), Inches(5), Inches(0.4),
"See: examples/04_structured_output.py", sz=15, color=ACCENT)
# ════════════════════════════════════════════════════════════════
# Slide 10: Transports
# ════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(prs.slide_layouts[6])
add_bg(s)
tb(s, Inches(1), Inches(0.6), Inches(11), Inches(0.8),
"Transports", sz=40, bold=True)
transports = [
("stdio", "Local process\ncommunication", "Claude Desktop\nClaude Code\nLocal dev", "mcp.run(transport='stdio')"),
("Streamable HTTP", "HTTP POST +\noptional SSE", "Remote servers\nWeb apps\nMulti-client", "mcp.run(transport=\n 'streamable-http')"),
("SSE (legacy)", "Server-Sent\nEvents streaming", "Backward\ncompatibility", "Deprecated in\nfavour of HTTP"),
]
bw, bh = Inches(3.5), Inches(3.5)
y = Inches(2.0)
for i, (name, desc, use_case, code_text) in enumerate(transports):
x = Inches(0.8) + i * (bw + Inches(0.4))
clr = ACCENT if i < 2 else LIGHT
box(s, x, y, bw, bh, border=clr)
tb(s, x + Inches(0.2), y + Inches(0.2), bw - Inches(0.4), Inches(0.4),
name, sz=22, color=clr, bold=True, align=PP_ALIGN.CENTER)
tb(s, x + Inches(0.2), y + Inches(0.75), bw - Inches(0.4), Inches(0.8),
desc, sz=16, color=LIGHT, align=PP_ALIGN.CENTER)
tb(s, x + Inches(0.2), y + Inches(1.7), bw - Inches(0.4), Inches(0.8),
use_case, sz=15, color=WHITE, align=PP_ALIGN.CENTER)
tb(s, x + Inches(0.2), y + Inches(2.7), bw - Inches(0.4), Inches(0.6),
code_text, sz=13, color=CODE_FG, font="Menlo", align=PP_ALIGN.CENTER)
tb(s, Inches(1), Inches(6.0), Inches(5), Inches(0.4),
"See: examples/08_streamable_http.py", sz=15, color=ACCENT)
# ════════════════════════════════════════════════════════════════
# Slide 11: Client Side
# ════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(prs.slide_layouts[6])
add_bg(s)
tb(s, Inches(1), Inches(0.6), Inches(11), Inches(0.8),
"Client \u2014 Connecting to Servers", sz=40, bold=True)
code = '''from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
params = StdioServerParameters(command="python", args=["server.py"])
async with stdio_client(params) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
# Discover
tools = await session.list_tools()
resources = await session.list_resources()
# Call a tool
result = await session.call_tool("add", {"a": 1, "b": 2})
# Read a resource
data = await session.read_resource("config://app")'''
box(s, Inches(1), Inches(1.8), Inches(11.3), Inches(4.8), fill=CODE_BG, border=ACCENT)
tb(s, Inches(1.3), Inches(2.0), Inches(10.7), Inches(4.5), code, sz=17, color=CODE_FG, font="Menlo")
tb(s, Inches(1), Inches(6.8), Inches(5), Inches(0.4),
"See: examples/07_stdio_client.py", sz=15, color=ACCENT)
# ════════════════════════════════════════════════════════════════
# Slide 12: Lifespan & Images
# ════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(prs.slide_layouts[6])
add_bg(s)
tb(s, Inches(1), Inches(0.6), Inches(11), Inches(0.8),
"Advanced Patterns", sz=40, bold=True)
# Two columns
# Left: Lifespan
box(s, Inches(0.8), Inches(1.8), Inches(5.5), Inches(4.5), border=ACCENT)
tb(s, Inches(1.0), Inches(1.95), Inches(5.1), Inches(0.5),
"Lifespan (startup/shutdown)", sz=20, color=ACCENT, bold=True)
lifespan_code = '''@asynccontextmanager
async def lifespan(server):
db = await Database.connect()
try:
yield AppContext(db=db)
finally:
await db.disconnect()
mcp = FastMCP("App", lifespan=lifespan)
@mcp.tool()
async def query(ctx: Context) -> str:
db = ctx.request_context
.lifespan_context.db
return await db.query(...)'''
tb(s, Inches(1.0), Inches(2.6), Inches(5.1), Inches(3.5),
lifespan_code, sz=14, color=CODE_FG, font="Menlo")
# Right: Images + Complex Inputs
box(s, Inches(6.8), Inches(1.8), Inches(5.5), Inches(2.0), border=CORAL)
tb(s, Inches(7.0), Inches(1.95), Inches(5.1), Inches(0.4),
"Image Returns", sz=20, color=CORAL, bold=True)
img_code = '''from mcp.server.fastmcp.utilities.types import Image
@mcp.tool()
def swatch(hex: str) -> Image:
img = PILImage.new("RGB", (200,200), hex)
buf = io.BytesIO()
img.save(buf, format="PNG")
return Image(data=buf.getvalue(), format="png")'''
tb(s, Inches(7.0), Inches(2.5), Inches(5.1), Inches(1.2),
img_code, sz=13, color=CODE_FG, font="Menlo")
box(s, Inches(6.8), Inches(4.1), Inches(5.5), Inches(2.2), border=YELLOW)
tb(s, Inches(7.0), Inches(4.25), Inches(5.1), Inches(0.4),
"Complex Pydantic Inputs", sz=20, color=YELLOW, bold=True)
pydantic_code = '''class Address(BaseModel):
street: str = Field(max_length=200)
zip_code: str = Field(pattern=r"^\\d{5}$")
class Employee(BaseModel):
name: str
contact: ContactInfo # nested
skills: list[str]'''
tb(s, Inches(7.0), Inches(4.8), Inches(5.1), Inches(1.4),
pydantic_code, sz=13, color=CODE_FG, font="Menlo")
tb(s, Inches(1), Inches(6.6), Inches(11), Inches(0.4),
"See: examples/06_lifespan.py, 09_images.py, 10_complex_inputs.py",
sz=15, color=ACCENT)
# ════════════════════════════════════════════════════════════════
# Slide 13: Example Map
# ════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(prs.slide_layouts[6])
add_bg(s)
tb(s, Inches(1), Inches(0.6), Inches(11), Inches(0.8),
"Example Scripts", sz=40, bold=True)
rows = [
("01", "Basic Server", "Tools, resources, prompts in one server"),
("02", "Tools + Context", "Logging, progress reporting, async"),
("03", "Resources", "Static and template URI resources"),
("04", "Structured Output", "Pydantic, TypedDict, dataclass returns"),
("05", "Prompts", "Code review, debug, architecture templates"),
("06", "Lifespan", "Startup/shutdown with shared DB & cache"),
("07", "Stdio Client", "Discovery, tool calls, Anthropic API chat"),
("08", "Streamable HTTP", "Remote server + Starlette mounting"),
("09", "Images", "Color swatches, charts, gradients"),
("10", "Complex Inputs", "Nested Pydantic validation"),
]
headers = ["#", "Example", "Concepts"]
col_x = [Inches(1), Inches(2), Inches(5.5)]
col_w = [Inches(0.8), Inches(3.3), Inches(6.5)]
y0 = Inches(1.8)
for ci, h in enumerate(headers):
tb(s, col_x[ci], y0, col_w[ci], Inches(0.4), h, sz=18, color=ACCENT, bold=True)
for ri, (num, name, desc) in enumerate(rows):
y = y0 + Inches(0.55) + ri * Inches(0.48)
tb(s, col_x[0], y, col_w[0], Inches(0.4), num, sz=16, color=LIGHT, font="Menlo")
tb(s, col_x[1], y, col_w[1], Inches(0.4), name, sz=16, color=WHITE, bold=True)
tb(s, col_x[2], y, col_w[2], Inches(0.4), desc, sz=16, color=LIGHT)
# ════════════════════════════════════════════════════════════════
# Slide 14: Getting Started
# ════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(prs.slide_layouts[6])
add_bg(s)
tb(s, Inches(1), Inches(0.6), Inches(11), Inches(0.8),
"Getting Started", sz=40, bold=True)
steps = [
"1. Install the SDK",
" pip install 'mcp[cli]'",
"2. Create a server",
" python examples/01_basic_server.py",
"3. Test with the MCP Inspector",
" mcp dev examples/01_basic_server.py",
"4. Install in Claude Desktop",
" mcp install examples/01_basic_server.py",
"5. Or connect via Claude Code",
" claude mcp add demo python examples/01_basic_server.py",
]
for i, line in enumerate(steps):
is_code = line.startswith(" ")
tb(s, Inches(1.2), Inches(1.8) + Inches(i * 0.48),
Inches(10), Inches(0.45), line,
sz=18 if not is_code else 16,
color=WHITE if not is_code else ACCENT,
font="Helvetica Neue" if not is_code else "Menlo")
# ════════════════════════════════════════════════════════════════
# Slide 15: Closing
# ════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(prs.slide_layouts[6])
add_bg(s)
tb(s, Inches(1), Inches(2.0), Inches(11), Inches(1.2),
"One Protocol. Any Integration.", sz=44, bold=True, align=PP_ALIGN.CENTER)
tb(s, Inches(1), Inches(3.8), Inches(11), Inches(0.8),
"Tools + Resources + Prompts = Complete AI Context",
sz=28, color=ACCENT, align=PP_ALIGN.CENTER)
tb(s, Inches(1), Inches(5.5), Inches(11), Inches(0.5),
"modelcontextprotocol.io \u2022 github.com/modelcontextprotocol/python-sdk",
sz=18, color=LIGHT, align=PP_ALIGN.CENTER)
# ── Save ──────────────────────────────────────────────────────
out = "/Users/michaelwilliams/working/mcp-python-sdk-examples/MCP_Python_SDK.pptx"
prs.save(out)
print(f"Saved {out}")