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
25 small wins to finish your pathNext lesson

Installation and setup

The official MCP Python SDK installs from PyPI. MCP servers do not call models, so the server side of this course needs no API key.

mcp 2.2.0, FastAPI and 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. Part 5 uses FastAPI from APIs for AI.

bash
pip install "mcp==2.2.0" "fastapi==0.141.1" pytest
Example
from importlib.metadata import version

print(version("mcp"))

The mcp[cli] extra and model keys

The mcp command, including the mcp dev inspector used in lesson 19, needs the [cli] extra. A server needs no key: the host that connects to it, such as Claude Code or Claude Desktop, uses its own account.

bash
pip install "mcp[cli]==2.2.0"

Only the agent in part 6 talks to a model, and lesson 21 gives it a stand-in, so the whole course runs without a key.

Try it yourself
  • Run mcp --help after installing the [cli] extra.
PreviousMCP overview

Little by little, you're building something great.