Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
MCP Servers from Scratch: Model Context Protocol in Python
New

MCP Servers from Scratch: Model Context Protocol in Python

Build Model Context Protocol servers in Python with tools, resources and prompts, client checks, and host connections
Created byBuildspace Labs
Last updated 11/2026
English

What you'll learn

  • Register Python functions as MCP tools and call them through a client
  • Use type hints, defaults, and descriptions to define useful tool schemas
  • Return structured tool results and handle invalid arguments
  • Publish fixed resources and URI templates, then read them through a client
  • Register prompts and render them with named arguments
  • Check discovered capabilities, returned content, and error status with assertions
  • Prepare a local stdio server for registration in Claude Code or a desktop host
  • Limit tool input, permitted names, and result sizes

Course content

4 sections • 26 lectures • 59m total length
  • Welcome to the Course1:32
  • What MCP Solves2:25
  • How Hosts, Clients, and Servers Fit Together2:00
  • Who Makes It, Versions, and When to Use It1:54
  • What the Mac Setup Provides2:24
  • Set Up Python and MCP3:46
  • Call Your First Server Tool2:33

Requirements

  • Basic Python: writing functions, using dictionaries, and reading type hints

Description

This course contains the use of artificial intelligence.

AI assistants like Claude become far more useful when they can reach your own code and data. The Model Context Protocol (MCP) is the open standard that makes this possible: you write a small server, and any MCP host can discover what it offers and use it. In this course you build those servers yourself, in Python, one step at a time.

You start with the big picture: how a host, a client, and a server fit together, and the three kinds of capability a server can offer. Tools are actions, like converting a value or looking something up. Resources are readable data at an address. Prompts are reusable message templates a person can pick. Then you set up Python 3.11 and the official MCP package on your Mac, and build and call your first server.

From there, the coding lessons type and run real code on screen, so you see the server code and the client output side by side. You shape tool schemas with type hints, defaults, and descriptions, return structured results, publish fixed and templated resources, and render prompts with arguments. You write async handlers, read a resource from inside a tool, return clear errors, and check your server's behavior with assertions through a client.

The later sections show how servers connect to the outside world: the stdio and Streamable HTTP transports, the connection handshake, and registering your server in Claude Code and a desktop host. The final section is about trust: treating content as untrusted, giving tools only the access they need, validating input, allowlisting names, and keeping results small.

Who this course is for:

  • Python developers who want to give AI assistants like Claude access to their own functions and data through MCP
  • Developers building tools, resources, or prompts for an MCP host such as Claude Code or Claude Desktop
  • Developers who want to test their MCP servers and keep them safe with input checks and access limits
  • Beginners to MCP who know basic Python and want a hands-on, step-by-step start