Build and Secure an MCP Server
Build a real MCP server in Python with the official SDK, serve it over HTTP, add authentication and hardening, then deploy it to a kagent cluster.
What you'll learn
- Build an MCP server in Python with typed tools, a resource and a prompt, and test it with the MCP Inspector
- Serve a server over Streamable HTTP and call it with curl, a Python client and the Inspector
- Protect a remote server with bearer tokens, scopes and the 401 and 403 responses the specification asks for
- Harden a server with input validation, an allowlist, rate limits, an audit log and a design that treats stored text as data
- Package a server as a container and deploy it to a Kubernetes cluster as a non-root, read-only workload
- Register the server with kagent as a RemoteMCPServer and bind chosen tools to an AgentTemplate
Who this is for
- • DevOps engineers deepening their expertise
- • SREs building production-grade systems
- • Backend developers expanding into infrastructure
Prerequisites
- • Comfortable with Python and the command line
- • uv, Node 22 or newer, curl and jq installed
- • For the last lesson: Docker, kind, kubectl and the kagent cluster from the kagent course
Course content
2 modules, 6 lessons, 33m of video
Module 1
3 lessons, 16 min
5 min
Meet hosts, clients and servers, then build a first MCP server in Python with one tool and test it over stdio with the MCP Inspector.
6 min
Write tool schemas and descriptions that a model can use, return errors it can act on, and add a resource and a prompt. Test with a Python client.
6 min
Serve the same server over Streamable HTTP, call it by hand with curl, from a Python client and from the Inspector, and read its log.
Module 2
3 lessons, 18 min
6 min
Make the server an OAuth resource server: verify bearer tokens, answer 401 and 403 correctly, publish metadata and check scopes per tool.
6 min
Add input validation, an allowlist, a rate limit, an audit log, Host and size limits, and a design that treats stored text as data, then test each one.
7 min
Package the server as a container, deploy it to the kagent cluster, register it as a RemoteMCPServer and bind two of its tools to an AgentTemplate.
Get started
Start Free LessonFirst lesson is always free — no signup required
This course includes
Want all courses?
See Pro plan →Your instructor

Founder and CEO, Open Empower. About the author
More in AI Agents
All courses in this trackOpenClaw: Your First AI Agent
Deploy OpenClaw locally or on a small VPS, add real tools, create one reusable automation, and apply essential security guardrails. You'll leave with a working 'Ops Assistant' that generates a Daily Brief, creates an Action Queue, and does it all safely.
Beginner · 7 lessons · 1 h
Preview free lesson
Claude Code Masterclass: Ship Real Code with AI
Stop treating AI like a magic autocomplete and start using it like a sharp junior engineer who sits next to you — one you direct, review, and hold accountable. In 10 hands-on modules you'll master the Plan → Implement → Test → Review → Commit loop and use it to ship real, tested code with Claude Code: Best-of-N, honest test suites, safe git workflows, multimodal prompts, refactoring & docs, reusable skills, the GitHub MCP server, lifecycle hooks, and a production-readiness checklist. You stay the engineer of record — Claude proposes, you decide what ships.
Intermediate · 10 lessons · 5 h
Preview free lesson
MLflow on Kubernetes: ML at Scale
Build scalable MLOps with MLflow, KServe, Docker, and Kubernetes. Automate deployments, monitor models, and workflows. Learn to deploy ML models to Kubernetes at scale, implement CI/CD pipelines, track experiments, perform hyperparameter tuning, and build production-ready ML services.
Intermediate · 15 lessons · 1 h 28 min
Preview free lesson