Skip to main content
🎤 Luca Berton is speaking at Red Hat Summit & KubeCon EU 2026!Learn more →
intermediate

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.

6 lessons33mUpdated November 2026

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
1

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.

2
Typed tools, resources and prompts

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.

3
Streamable HTTP and running it as a service

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
4
Authentication and authorization

6 min

Make the server an OAuth resource server: verify bearer tokens, answer 401 and 403 correctly, publish metadata and check scopes per tool.

5
Hardening the server

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.

6
Container, kagent cluster and a tool binding

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 Lesson

First lesson is always free — no signup required

This course includes

6 hands-on lessons
Intermediate level
33m total
Final assessment

Want all courses?

See Pro plan →

Your instructor

Luca Berton

Founder and CEO, Open Empower. About the author

More in AI Agents

All courses in this track