What is the Model Context Protocol (MCP) and why use it?

Day 1, 25 minutes · beginner

Goal of this lessonExplain how MCP hosts, clients and servers work together and set up a Python project with the official MCP SDK for Romy's shop.

Why it matters

In the tool use course you wrote tools for one program. The schema, the function and the loop all lived in your own script. If you wanted the same stock check in a chat app or a coding assistant, you had to wire it up again, once for every app. The Model Context Protocol, or MCP, fixes that. You write your tools once, as an MCP server, and every app that speaks MCP can use them. The official docs compare it to a USB-C port for AI applications: one standard plug for many devices.

This course follows Romy, who runs a small made-up second-hand book shop, Quillfeather Books. Customers ask her if a title is in stock, ask her to keep an eye out for a book, and ask when the shop is open. Over seven days you build a small MCP server for her shop, test it, connect it to Claude Desktop and Claude Code, and learn how to run servers safely. Today you learn the words and set up the project. At the end you have a working Python project with the official MCP SDK and a plan for Romy's server.

Before you start

This course builds on Tool use with the Claude API. You should know what a tool is, what a JSON schema looks like, and how a tool_use and a tool_result go back and forth. If the Claude API itself is new to you, start with Claude API basics.

Good news: building and testing the server needs no API key and no credits. An MCP server runs on your own computer, and you test it with a free tool. Claude only comes in when you connect the server to Claude Desktop in lesson 5 and to Claude Code in lesson 6. Claude Code needs a paid Claude plan or a Claude Console account; lesson 6 says more.

The words you need today

  • Protocol: a fixed set of rules for how two programs talk. Both sides know which messages exist and what they mean.
  • MCP (Model Context Protocol): an open standard for connecting AI applications to outside systems, such as files, databases and tools.
  • Host: the AI application the person uses, such as Claude Desktop or Claude Code. The host runs one or more clients.
  • Client: the part inside the host that keeps one connection open to one server. A host that uses three servers has three clients.
  • Server: a program that offers tools, data and templates to clients. It can run on your own computer or somewhere on the internet.
  • JSON-RPC: the message format MCP uses. Every message is a small piece of JSON with a method name, such as tools/list or tools/call. The SDK writes these messages for you.
  • SDK (software development kit): a library that does the protocol work, so you only write the functions.

How the pieces fit

The architecture page of the MCP docs describes it like this: the host creates one client for each server it connects to, and each client keeps its own dedicated connection. So when you add Romy's server to Claude Desktop, Claude Desktop starts a client for it. Add a second server and it starts a second client.

The messages travel over a transport: the way the bytes get from one side to the other. MCP has two:

Transport How it works Typical use
stdio The host starts the server as a program on the same computer and talks through its standard input and standard output Local servers, one client each
Streamable HTTP The client sends HTTP requests to a server at a web address Remote servers, many clients

Romy's server is a local stdio server. That is the simplest kind and the one the official build guide uses.

Three building blocks

A server can offer three kinds of things. The server concepts page names them and says who is in control of each:

Building block What it is Who decides when it is used
Tool A function the model can call, like the tools you already know The model
Resource Read-only data the app can put in front of the model, such as a file or a list The application
Prompt A ready-made instruction template the user picks, often from a menu or a slash command The user

For Romy that gives a clear plan: a tool to check stock and a tool to add a book to a wish list (lessons 2 and 3), a resource with the opening hours and a prompt for a customer reply (lesson 4).

The steps

  1. Install uv, the Python project tool the official build guide uses.
  2. Create the quillfeather project with a virtual environment and the MCP SDK.
  3. Check that the SDK loads.
  4. Check your Node.js version. The MCP Inspector, the test tool from lesson 2, runs on Node.js.
  5. Write down Romy's plan: which of her needs is a tool, a resource or a prompt, and who controls each.

Follow the steps below.

Today's actions

Ticks are not saved without an account

Do it in Claude API

Claude API

  1. On macOS or Linux: install uv with this command from the MCP build guide. Then close and reopen your terminal so the uv command is found.
    curl -LsSf https://astral.sh/uv/install.sh | sh
  2. On Windows: open PowerShell and install uv with this command instead. Then close and reopen PowerShell.
    powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
  3. On macOS or Linux: run these lines. They make the project folder, a virtual environment and an empty server file, and install the MCP SDK.
    uv init quillfeather
    cd quillfeather
    uv venv
    source .venv/bin/activate
    uv add "mcp[cli]"
    touch quillfeather.py
  4. On Windows: run these lines in PowerShell instead.
    uv init quillfeather
    cd quillfeather
    uv venv
    .venv\Scripts\activate
    uv add mcp[cli]
    new-item quillfeather.py
  5. Check that the SDK loads. You should see MCP SDK ready. Then run uv pip show mcp: the build guide asks for version 2.0.0 or higher.
    uv run python -c "from mcp.server import MCPServer; print('MCP SDK ready')"
  6. Run node --version. The MCP Inspector page asks for Node.js 22.23.4 or later in the 22 line, 24.22.1 or later in the 24 line, or 26.12.1 or later. If it is missing or older, install the LTS version from nodejs.org before lesson 2.
  7. Create mcp-notes.txt in the quillfeather folder, copy this plan into it and fill in the last column for each line.
    Romy's MCP server plan
    
    Need: is this title in stock?            Block: tool       Controlled by: 
    Need: put a book on the wish list        Block: tool       Controlled by: 
    Need: when is the shop open?             Block: resource   Controlled by: 
    Need: a friendly reply to a customer     Block: prompt     Controlled by: 
    
    My MCP SDK version: 
    My Node.js version: 

Note: Nothing here needs an API key or credits. uv init also makes a main.py: you can leave it, the course does not use it. If uv is not found after installing, open a new terminal window.

Checked on 4 December 2026 · Source: MCP docs: Build an MCP server (opens in a new tab)

Create a free account to save your progress. Sign in or sign up