Installation and setup
The MCP Python SDK is a pip package that installs the server class, the client, and an optional command line inspector.
Last updated: 29 Sep, 2026 · MCP 2.2
The SDK ships two halves in one package: the server you build tools on, and the client that connects to it. FastAPI and pytest are added here for the later parts. The versions are pinned so your output matches the lessons.
The video starts from an empty folder opened in Cursor. uv init turns it into a uv project, uv venv creates an environment, and a requirements.txt lists langchain-groq, langchain-mcp-adapters and mcp, the package whose FastMCP class the servers use. uv add -r requirements.txt installs them, the uv way of writing pip install -r requirements.txt.
The video installs the mcp 1.x of its day. This course pins mcp 2.2.0, where the server class is called MCPServer, and langchain-mcp-adapters requires an mcp below 2.0, so the agent lessons use LangChain's own MCP support, the langchain[mcp] extra, instead. The pip, uv and Colab tabs below all install the same pinned versions.
Installing mcp, 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.
pip install "mcp==2.2.0" "fastapi==0.141.1" pytestCheck that Python finds the installed version:
from importlib.metadata import version
print(version("mcp"))2.2.0
Adding the mcp[cli] extra for the inspector
The mcp command, including the mcp dev inspector, needs the [cli] extra. The inspector itself is covered in MCP Inspector with mcp dev.
pip install "mcp[cli]==2.2.0"Adding LangChain and a Groq key for the agentOptional
Part 6 connects a real model to the shop server. It uses LangChain to call the model and to load MCP tools, and Groq's free API to serve the model, openai/gpt-oss-120b. Install these when you reach MCP tools with an LLM:
pip install "langchain[mcp]==1.4.2" "langchain-groq==1.1.3"The key is first needed in Tool calling with a model. Create a key at console.groq.com/keys; Groq's free plan has a daily token limit that covers this course. Set it where Python can read it:
export GROQ_API_KEY=gsk_...The weather server from the MCP crash course, run in MCP Inspector with mcp dev, calls a free weather API with httpx. It needs no key, only the package: pip install "httpx==0.28.1".
What each package is for
| Package | Used from | What it gives you |
|---|---|---|
mcp | the first part on | the server class, the client, and the type helpers |
mcp[cli] | the inspector lesson | the mcp command and mcp dev |
fastapi | part 5 | mounting the server inside a web app |
pytest | part 6 | running a server as a test fixture |
| langchain[mcp] | part 6 | MCP tools as LangChain tools, and create_agent |
| langchain-groq | part 6 | the Groq chat model behind init_chat_model |
| httpx | the inspector lesson, optional | the weather server's calls to api.weather.gov |
When to pin these versions
- Pin
mcp==2.2.0while following the course so schemas and error text match. - Add the
[cli]extra only when you want the inspector; the library works without it. - Install FastAPI and pytest when you reach the parts that use them, not before.
from mcp.server.fastmcp import FastMCP will fail here. In version 2 the server class is MCPServer from mcp.server, and mcp.server.fastmcp does not exist.Related
- Previous: MCP overview
- Next: Tools without MCP
- Reference: MCP Python SDK
- Run
mcp --helpafter installing the[cli]extra. - Run
pip show mcpand compare its version with the one printed above. - Import
from mcp.server import MCPServerin a Python shell to confirm the install.
Little by little, you're building something great.