0Pricing
MCP Academy · Lesson

Add the MCP Python SDK

Pull in the official mcp package for your project.

Add the MCP Python SDK is a free MCP Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the MCP Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Time to Add the SDK

Your project is scaffolded, but it can't speak MCP yet. The next step is pulling in the official library that does all the heavy lifting. 📦

The Package Is Just mcp

The official Python SDK ships as a package simply named mcp. It contains everything you need to build servers and clients in plain Python.

Add It with uv

Inside your project folder, run uv add to install the SDK and record it as a dependency. One command grabs it and updates your project files.

uv add "mcp[cli]"

Why the [cli] Extra

The [cli] extra adds the command-line tools that run and inspect servers. Without it you get the library but miss the handy mcp commands.

Quote the Brackets

Always wrap the name in quotes, like "mcp[cli]". Many shells treat square brackets as special characters, and quotes keep them literal.

pip Still Works Too

If you prefer plain pip, the same package installs the same way. Either tool gives you an identical SDK, so pick whichever fits your workflow.

pip install "mcp[cli]"

It Records the Dependency

uv add doesn't just install; it writes mcp into your pyproject.toml. Anyone who clones your project gets the exact same requirement.

The Lockfile Pins Versions

uv also updates a uv.lock file that pins the exact resolved versions. That makes your installs reproducible on any machine, every time.

Confirm the Import

Verify the install worked by importing the SDK inside your environment. If nothing errors out, the mcp package is ready to use.

uv run python -c "import mcp; print('ok')"

Where the Server Lives

The class you'll use most is FastMCP, found under mcp.server.fastmcp. It's the high-level way to define tools without touching raw protocol details.

from mcp.server.fastmcp import FastMCP

One Import, Big Power

That single import unlocks decorators for tools, resources, and prompts. The SDK turns ordinary Python functions into capabilities an AI can call. ✨

Quick Check

You want the SDK plus its command-line helpers.

The SDK Is In

You added mcp[cli], recorded it in pyproject.toml, locked the versions, and confirmed the import. Your project can now build a real MCP server. 🎯

Frequently asked questions

Is the “Add the MCP Python SDK” lesson free?

Yes — the full text of “Add the MCP Python SDK” is free to read here on the web, and the MCP Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the MCP Academy course, upgrade to CoddyKit PRO.

What will I learn in “Add the MCP Python SDK”?

Pull in the official mcp package for your project. You practise MCP Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start MCP Academy?

No prior experience is required. MCP Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Add the MCP Python SDK” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this MCP Academy lesson?

Yes. Every MCP Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Install Python & uv
  2. Add the MCP Python SDK
  3. Meet the mcp CLI
  4. Project Layout for a Server
← Back to MCP Academy