Model Context ProtocolMCP Python SDK 2.2 · LangChain 1.4 · Python 3.10+
Dashboard
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
27 small wins to finish your pathNext lesson →

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.

Setting up the project with uv · from the Complete Agentic AI Course In 10 Hours · 273:06 to 278:46

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" pytest

Check that Python finds the installed version:

Example
from importlib.metadata import version

print(version("mcp"))

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.

bash
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

PackageUsed fromWhat it gives you
mcpthe first part onthe server class, the client, and the type helpers
mcp[cli]the inspector lessonthe mcp command and mcp dev
fastapipart 5mounting the server inside a web app
pytestpart 6running a server as a test fixture
langchain[mcp]part 6MCP tools as LangChain tools, and create_agent
langchain-groqpart 6the Groq chat model behind init_chat_model
httpxthe inspector lesson, optionalthe weather server's calls to api.weather.gov

When to pin these versions

  • Pin mcp==2.2.0 while 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.
Watch out. A version 1 tutorial that imports 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.
Try it yourself
  • Run mcp --help after installing the [cli] extra.
  • Run pip show mcp and compare its version with the one printed above.
  • Import from mcp.server import MCPServer in a Python shell to confirm the install.
PreviousMCP overview

Little by little, you're building something great.