MCPMCP Python SDK 2.2 · Python 3.10+
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
24 small wins to finish your pathNext lesson

What you are going to build

You will finish this course with an MCP server for a shop's support team, and a small agent that connects to it, reads its tools and uses them to answer customers.

MCP, the Model Context Protocol, is an open standard for connecting AI applications to tools and data. Write a server once, and Claude Code, Claude Desktop, Cursor, VS Code and your own agents can all use it, with no custom code for each one.

What happens when an agent uses your server
Connect. The application starts or reaches your server, and the two agree on a protocol version and what each side supports.Step 1 of 4
The six parts of the course
The ideatools without MCPa first servera clientToolsargumentsstructured outputerrorsannotationsResources and promptsresourcestemplatespromptsInside a handlercontextlifespanprogressasking the userRunning itstdioHTTPinside FastAPIreal hostsAn agenttools for a modela stand-in modelthe looptestsMCP

No API key

Servers do not talk to models, so most of the course needs no model at all. Part 6 adds an agent, and you write a small stand-in model for it that chooses tools from the user's message. Every output is from a real run on the pinned SDK.

What you need

  • Python 3.10 or later.
  • Functions, type hints, Pydantic and async from Python for AI. Part 5 uses FastAPI from APIs for AI.
Example
pip install "mcp==2.2.0" "fastapi==0.141.1" pytest

mcp is the official Python SDK, version 2. Much older example code online uses version 1, where the server class was called FastMCP; the ideas carry over, the names do not always.

Back toAll frameworks

Every expert started right here.