本课程基于2026年MCP规范,通过14个工程实验讲解Python构建生产级无状态MCP服务器,涵盖幂等重试、持久化任务、OAuth/PKCE验证、多租户隔离与提示词注入防护,并提供旧版本迁移回滚方案。
原始标题:MCP Production: Secure, Scalable MCP Servers in Python

本课程是一门针对模型上下文协议(MCP)的进阶实战架构课,专注于解决 MCP 服务器从本地开发走向企业级生产环境时的核心痛点。
基于最新的 2026 年规范,课程通过 14 个工程实验,深入探讨如何构建在多副本、网关和负载均衡架构下稳定运行的无状态 MCP 服务器。课程不仅涵盖了应对分布式系统死穴的硬核解决方案——如利用安全句柄(Handles)实现幂等性重试、将长任务转化为抗重启的持久化任务、以及通过多轮请求引入人工审批机制,还系统性地拆解了生产级安全防护,包括 OAuth/PKCE 身份验证、多租户隔离缓存、以及防御提示词注入的测试驱动安全策略,并提供了从 2025 旧版本平滑迁移与回滚的完整演练方案。
Published 10/2026
Created by Runs Clean
MP4 | Video: h264, 1920×1080 | Audio: AAC, 44.1 KHz, 2 Ch
Level: Intermediate | Genre: eLearning | Language: English + subtitle | Duration: 58 Lectures ( 6h 58m ) | Size: 3.2 GB
Model Context Protocol servers that survive retries, replicas, OAuth and gateways. Built on the 2026 spec, in 14 labs.
What you’ll learn
⚡ Build an MCP server in Python, and the same contract in TypeScript, that handles discovery, capabilities and errors the way the spec says
⚡ Run stateless MCP servers on revision 2026-07-28 across two replicas behind a gateway, and prove both return the same answer
⚡ Make retries safe: replace session state with handles that carry an owner and an expiry, and catch an operation that runs twice
⚡ Pause a tool call for a person’s approval with Multi Round-Trip Requests, and make refusal and replay fail safely
⚡ Cache list and read results without letting one caller see another caller’s data
⚡ Secure an MCP server with OAuth and PKCE, checking issuer, audience and scopes, including the requests it has to reject
⚡ Deploy behind a load balancer with health checks, logs and per-tool metrics, and run long jobs as durable tasks that survive restarts
⚡ Migrate a 2025-11-25 server to revision 2026-07-28 with compatibility tests and a rollback you’ve actually rehearsed
⚡ Apply MCP security best practices against prompt injection in tool output and tool definitions, and prove each control with a test
⚡ Point a black-box conformance suite at your own MCP server and know what a pass does and doesn’t tell you
Requirements
❗ Python you’re comfortable with: running tests and reading a traceback. TypeScript helps in module 1, but you can follow the Python side only
❗ Reading HTTP requests, JSON and command-line output
❗ A computer that can run Docker Compose with a few containers at once
❗ Internet access the first time each lab runs, to pull images and pinned dependencies
Description
This course contains the use of artificial intelligence.
A tool call times out at two in the morning. The server had already written the order before the connection dropped. Your client retries, the load balancer sends the retry to another replica, and now there are two orders. Nothing in the response tells you which one is real, and every test you have still passes, because they all ran against one process.
That’s the distance between an MCP server that works on your laptop and one that holds up in production. Most Model Context Protocol material ends at the first tool call that works. This course starts there and puts your server through what production does to it: two replicas behind a gateway, OAuth tokens that were issued for some other service, a person who has to approve something halfway through a call, and a release you might have to roll back at short notice.
What you’ll build
✨ One request contract in Python, and the same contract in TypeScript, sent through a proxy to alternating replicas until you can prove both give the same answer.
✨ Explicit handles with an owner and an expiry in place of session state, and a business operation that you can tell has already run when the retry shows up.
✨ A human approval inside a tool call with Multi Round-Trip Requests, where saying no, walking away and replaying an old answer all fail safely.
✨ Caching that never shows one caller another caller’s data, measured on a workload you can rerun yourself.
✨ MCP authentication done properly: a local OAuth flow with PKCE, and issuer, audience and scope checked at the server, including every request you’re supposed to turn away.
✨ Durable tasks that survive a restart, then the whole service behind a load balancer with health checks, logs, per-tool metrics and a rollback you’ve actually rehearsed.
Written against the current spec
Everything targets revision 2026-07-28, the stateless one: no initialization handshake, no protocol sessions, and input requests that come back inside the result. If you run a server on 2025-11-25, module 9 is about moving it, with compatibility tests and the deprecated features that are still in the spec for now. You don’t need to learn the old model first.
Fourteen labs, and they have to pass
Every lesson was written against a lab that had already passed on a real machine. Docker Compose is the only thing you install. Images are pinned by digest, nothing asks for a cloud account or an API key, and each lab ships checks that break the code on purpose, so you watch the tests catch the exact defect they were written for.
Five extra modules
They go past the core contract into MCP security and what real deployments need. Agent security treats tool output as data and pins the tool definitions you approved, which is where prompt injection gets in. Resources and prompts are served without ever confirming what a caller can’t see. The production-gaps module covers one trace across the gateway, tokens from a real identity provider and a rate limit that holds across replicas. A decisions module maps each need to a pattern and what it costs you. The last one puts it all into a reference server with a black-box conformance suite you can point at your own server.
Who it’s for
Backend and platform engineers who already write Python and can read an HTTP request and a stack trace. If you’ve shipped an MCP tool and wondered what happens to it behind a load balancer, this was written for you. It isn’t an introduction to LLMs, and it doesn’t teach MCP from zero.
Who this course is for
⭐ Backend engineers building MCP servers that expose real tools and data
⭐ Platform engineers who own the gateway, the auth and the uptime around those servers
⭐ Engineers chasing a bug that only shows up on the second replica or after a retry
⭐ Developers with an MCP integration on revision 2025-11-25 who need a tested way to move to 2026-07-28
此处内容需要权限查看
会员免费查看



