Day 0: The terrain – three VMs, a local language model and the problem MCP solves
Goal: set up access to three VMs, install Python tools and Ollama, run a language model locally, and experience by hand how a tool call works without MCP · Duration: approx. 90 min · Prerequisite: three fresh VMs with Ubuntu 24.04, a computer with SSH
Where we start
All you need are three VMs with Ubuntu 24.04 that you can log in to via SSH with a username and password, and your own computer with a terminal. Nothing more – you set up everything else today.
Introduction
Before you write your first MCP server, you need a place where it can run and a language model that uses it. Today you build both. At the end of the day a language model runs on cp1 that you can query over an HTTP interface – and you will see that it has no answer to a simple question about your own machine.
Then you give the model a tool by hand. You write the tool description yourself into a JSON file, send it along, read the model’s response, run the command yourself and send the result back. That is tedious, and that is exactly the point: you see every step that MCP and your host will later take over for you. Once you have done this flow by hand, the rest of the course is much easier to understand.
Today you learn:
- to create your own SSH key for the lab and set up short names for the VMs,
- to install
uv, the tool you use to manage Python projects, - to install Ollama and run a language model locally,
- to query the model over its HTTP interface,
- to walk through a tool call (“tool calling”) completely by hand,
- to create the Python project you work in from Day 1 onward.
Background
The picture for today: a hotel without a front desk
One picture accompanies you through the whole course: a hotel. The guest is the person with a question. The language model is a clever guest who knows a lot but never leaves the building. It cannot walk to the laundry or call a taxi itself.
What the hotel offers outside its walls is done by outside contractors: the laundry, the taxi company, the florist. Each has a list of bookable services – “wash a shirt”, “taxi to the station”. Between guest and contractors sits the front desk: it knows all the lists, takes the guest’s wish, gets the guest’s signature, orders from the right contractor and brings the result up to the room.
Today there is no front desk yet. You are the bellhop who handles every wish on foot: you write the list of services on a slip for the guest, read the wish, walk to the laundry yourself and bring the result back. From Day 1 on, MCP takes this errand off your hands.
The terms
| Term | Meaning | in the picture |
|---|---|---|
| Language model | function “text in, text out”, without access to the outside world | the guest who never leaves the building |
| Tool | a function with name, description and parameters that the model can request | bookable service (“wash a shirt”) |
| Tool calling | the model asks for a tool call in a structured way, the application executes it | the guest fills in an order slip |
| MCP server | program that describes and runs tools | outside contractor (laundry, taxi) |
| Host with MCP client | application that talks to the model and the servers | front desk with a house line per contractor |
| Consent | the human allows a tool call | the guest’s signature |
Remember: The model asks, the application acts. The guest fills in the order slip – someone else has to do the walking.
What a language model can do – and what it can’t
Technically, a language model is a function: text in, text out. During training it has seen a huge amount of text and can produce plausible continuations from it. What it does not have is access to the outside world. It cannot open a file, cannot run a command, and knows no state that came into being after its training. If you ask a model how much space is free on your disk, it can only guess – or, if it is well trained, admit that it doesn’t know.
Tool calling: the model asks, the application acts
Modern models can do something else, though: along with the question
you can describe a list of tools to them – each with a
name, a description and the expected parameters. If the model considers
a tool helpful, it doesn’t answer with text but with a structured
request: “Please call freier_speicher with
rechner = cp1.” The model executes nothing
itself. The application that queries the model must read the
request, run the tool and return the result in a second request. Only
then does the model formulate its answer.
This flow is called tool calling or function calling, and it is the foundation of everything called an “agent” today. Every language model vendor implemented it a little differently – different field names, different formats. That is the first problem.
The N×M problem
The second problem is bigger. Imagine your company has three AI applications (a chat assistant, an IDE, an operations agent) and five systems they are supposed to use (ticket system, monitoring, wiki, database, servers). Without a common standard, someone writes custom glue code for every combination: 3 × 5 = 15 integrations, each with its own way of describing tools, reporting errors and checking access. Add one application and there are five more integrations.
The Model Context Protocol turns this around: every system gets one MCP server, every application one MCP client. N × M integrations become N + M. The server describes its tools in a fixed format; the client can list them, call them and pass the results to the model – no matter which model is behind it. How exactly this works is the topic of Day 1. Today you experience the state before MCP.
Why a local model
For this course the language model runs with Ollama directly on cp1. Ollama is a free program that downloads models, keeps them in memory and offers them over an HTTP interface on port 11434. This has three advantages: it costs nothing, no data leaves your lab, and you can inspect every request and response in detail. The drawback: without a GPU the model is slow, and an answer takes a few seconds. For understanding MCP this doesn’t matter – MCP is independent of which model uses the tools.
The model is called qwen3:4b-instruct: a model from the
Qwen 3 family with 4 billion parameters, shrunk (“quantized”) to 2.5 GB
and trained to follow instructions (“instruct”). It supports tool
calling and answers in German. Larger models are smarter, but too slow
on a CPU; smaller ones often pick the wrong tool.
The terrain
| VM | IP in the lab | Role | Size |
|---|---|---|---|
| cp1 | 172.16.0.126 | workstation, language model, host | 4 vCPU, 12 GB |
| worker1 | 172.16.0.228 | MCP servers over HTTP (from Day 8) | 2 vCPU, 8 GB |
| worker2 | 172.16.0.83 | authorization server (from Day 12) | 2 vCPU, 8 GB |
Your addresses are different. Wherever the course shows
172.16.0.…, use your own. If a command block starts with
# on cp1, you run it on cp1;
# on your computer means the machine you are sitting
at.
Drill 1: Access to the three VMs
Where you are: on your own computer, in a terminal.
What you have afterwards: your own SSH key and short names with which
ssh cp1works without a password.
Throughout the course you work on the VMs via SSH. A separate key just for this lab keeps it apart from your other access; you can simply delete it at the end.
Step 1 – create the key.
# on your computer
ssh-keygen -t ed25519 -f ~/.ssh/mcpa -C mcpa-laborssh-keygen creates a key pair of private and public
key.
-t ed25519selects the key type Ed25519 – short, fast and the standard today.-f ~/.ssh/mcpasets the file name: the private key goes to~/.ssh/mcpa, the public one to~/.ssh/mcpa.pub. The private key stays on your computer, the public one goes to the VMs.-C mcpa-laboris a comment. It later appears in theauthorized_keysfile on the VMs so that you can recognize the key there.
The program asks for a passphrase. For a lab you may leave it empty by pressing Enter.
Expected (shortened):
Generating public/private ed25519 key pair.
Your identification has been saved in /home/du/.ssh/mcpa
Your public key has been saved in /home/du/.ssh/mcpa.pub
The key fingerprint is:
Step 2 – copy the public key to the VMs.
First cp1:
# on your computer
ssh-copy-id -i ~/.ssh/mcpa.pub [email protected]ssh-copy-id logs in once with a password and appends the
public key to the user’s ~/.ssh/authorized_keys file on the
VM.
-i ~/.ssh/mcpa.pubsays which public key is transferred.[email protected]is the user and address of the VM. If your user has a different name, replaceubuntu.
The call asks for the password once and ends with
Number of key(s) added: 1. Then the same for worker1:
# on your computer
ssh-copy-id -i ~/.ssh/mcpa.pub [email protected]And for worker2:
# on your computer
ssh-copy-id -i ~/.ssh/mcpa.pub [email protected]Both also end with Number of key(s) added: 1.
Step 3 – set up short names. So that you don’t have
to type key, user and address every time, you add the VMs to the SSH
configuration. Open the file ~/.ssh/config in an editor
(for example nano ~/.ssh/config) and add this block at the
end:
Host cp1
HostName 172.16.0.126
Host worker1
HostName 172.16.0.228
Host worker2
HostName 172.16.0.83
Host cp1 worker1 worker2
User ubuntu
IdentityFile ~/.ssh/mcpa
Each Host section applies to the short names listed.
HostName is the real address, User the user on
the VM and IdentityFile the private key. The last section
lists all three names at once so that you only have to write user and
key once.
Check: ask each VM for its name, one at a time:
# on your computer
ssh cp1 hostname
ssh worker1 hostname
ssh worker2 hostnamessh cp1 hostname logs in under the short name, runs the
command hostname (it prints the name of the VM) and logs
out again immediately.
Expected: one line per VM:
cp1
worker1
worker2
If there is no password prompt and the three names appear, access is
in place. If your VMs have different names, give them the names from the
course now: sudo hostnamectl set-hostname cp1 on the first
VM, and likewise on the others.
If it doesn’t work
Permission denied (publickey)in step 2: the VM does not allow password login. Put the contents of~/.ssh/mcpa.pubinto~/.ssh/authorized_keyson the VM via your virtualization console.- Password prompt despite key: usually the path in
IdentityFileis wrong, or the file~/.ssh/confighas tabs instead of spaces in a place SSH doesn’t like.ssh -v cp1shows which keys SSH tries. WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED: you reinstalled the VM, and your computer still knows the VM’s old key. Check that it really is your VM, and remove the old entry withssh-keygen -R 172.16.0.126.
Remember: One key per lab, short names in
~/.ssh/config– then every login is justssh cp1.
Save your progress? Sign up for free
Drill 2: Names and base packages on all VMs
Where you are: on cp1, worker1 and worker2, one after the other (
ssh cp1etc.).What you have afterwards: VMs that know each other by name, and the tools
curlandjq.
From Day 8 on, programs on cp1 talk to servers on worker1. For that,
the VMs should know each other by name – without a DNS server of their
own. The file /etc/hosts takes care of this; each line
contains an address and one or more names.
Step 1 – open /etc/hosts. The file
belongs to root, hence sudo:
# on cp1
sudo nano /etc/hostssudoruns the editor with administrator rights; otherwise you could not save.nanois a simple editor in the terminal: save with Ctrl+O and Enter, quit with Ctrl+X.
Step 2 – two changes.
- Enter your own name correctly. Ubuntu enters the
hostname under the address
127.0.1.1. If the VM was renamed, the old name is still there. Change this line so that the VM’s name follows127.0.1.1– on cp1 that is127.0.1.1 cp1. - Append the three lab names. Write these three lines at the end of the file (with your addresses):
172.16.0.126 cp1
172.16.0.228 worker1
172.16.0.83 worker2
Leave the other lines of the file as they are. Save, quit.
The same on worker1 and worker2. Log in with
ssh worker1, open the file again with
sudo nano /etc/hosts, put the name worker1
after 127.0.1.1 and append the same three lines. On worker2
likewise, with 127.0.1.1 worker2.
Step 3 – check the file.
# on cp1
grep -E "127.0.1.1|cp1|worker" /etc/hostsgrep -Esearches for lines that match a pattern;-Eallows|for “or”.
Expected on cp1:
127.0.1.1 cp1
172.16.0.126 cp1
172.16.0.228 worker1
172.16.0.83 worker2
Step 4 – check name resolution.
# on cp1
ping -c1 -W2 worker1ping -c1sends exactly one packet,-W2waits at most two seconds for a reply.
Expected (excerpt – the first two lines; a short statistic follows below):
PING worker1 (172.16.0.228) 56(84) bytes of data.
64 bytes from worker1 (172.16.0.228): icmp_seq=1 ttl=64 time=1.32 ms
The line 64 bytes from worker1 (172.16.0.228) shows: the
name was resolved to the correct address, and worker1 replies.
Step 5 – fetch package lists.
# on cp1, worker1 and worker2
sudo apt-get update -qqapt-get updateloads the current package lists;-qqmakes the output very terse.
Step 6 – install base packages.
# on cp1, worker1 and worker2
sudo apt-get install -y -qq jq curlapt-get install -y jq curlinstalls the two packages and answers the confirmation prompt with “yes” (-y).curlsends HTTP requests from the command line – you use it to talk to Ollama today and to MCP servers from Day 8.jqformats and filters JSON. Both are already present on many systems; thenapt-getjust reports that they are up to date.
If it doesn’t work
ping: worker1: Temporary failure in name resolution: the line for worker1 is missing in/etc/hosts. Check withcat /etc/hostswhether step 2 ran on this VM.- Duplicate lines after editing several times are
harmless but ugly. Open the file with
sudo nano /etc/hostsand delete the repetitions.
Remember:
/etc/hostsis the front desk’s phone book: address and name on one line, and every VM needs its own copy.
Save your progress? Sign up for free
Drill 3: uv – managing Python projects
Where you are: on cp1, then on worker1.
What you have afterwards: the program
uvon both VMs.
Ubuntu 24.04 ships Python 3.12, but you shouldn’t install libraries system-wide: the system itself needs specific versions, and multiple projects interfere with each other. The solution is one virtual environment per project – a directory with its own libraries.
uv does this for you. It creates projects, manages
virtual environments, installs libraries and records in a lock file
(uv.lock) exactly which versions are installed. It is very
fast and is also recommended by the official MCP documentation.
# on cp1 and worker1
curl -LsSf https://astral.sh/uv/0.13.10/install.sh | shcurldownloads the install script for version 0.13.10. The version is part of the address so that you get exactly what this course was tested with.-Lfollows redirects,-ssuppresses the progress display,-Sstill shows errors,-faborts on an HTTP error instead of printing an error page.| shpasses the script directly to the shell. The script detects your processor architecture (x86_64 or arm64), downloads the matching program and puts it in~/.local/bin– without root rights.
Expected:
downloading uv 0.13.10 x86_64-unknown-linux-gnu
installing to /home/ubuntu/.local/bin
uv
uvx
everything's installed!
On a fresh VM you may additionally see a hint to add
$HOME/.local/bin to the search path. You do that with:
# on cp1 and worker1
source $HOME/.local/bin/envsource reads the file into the running shell; it extends
the PATH variable in which the shell looks for programs. On
every new login this happens automatically.
Check:
# on cp1 and worker1
uv --versionExpected:
uv 0.13.10 (x86_64-unknown-linux-gnu)
On a machine with an ARM processor it says
aarch64-unknown-linux-gnu there.
If it doesn’t work
uv: command not found: the search path has not been extended yet. Runsource $HOME/.local/bin/envor log in again.
Remember: One project, one virtual environment –
uvcreates it, you start programs withuv run.
Save your progress? Sign up for free
Drill 4: Ollama and the language model
Where you are: on cp1.
What you have afterwards: Ollama as a service and the model
qwen3:4b-instructon disk.
Step 1 – download and run the install script.
First you download the official install script into a file. This way
you can read it with less /tmp/ollama-install.sh before
running it:
# on cp1
curl -fsSL https://ollama.com/install.sh -o /tmp/ollama-install.sh-o /tmp/ollama-install.shwrites the download into this file instead of onto the screen.
Then you run it:
# on cp1
OLLAMA_VERSION=0.40.19 sh /tmp/ollama-install.shOLLAMA_VERSION=0.40.19in front of the command sets an environment variable for this one call only. The script reads it and installs exactly this version instead of the latest.sh /tmp/ollama-install.shruns the script. It asks for yoursudopassword, creates a userollama, installs the program to/usr/localand sets up a systemd service that starts Ollama at boot.
Expected (the last lines):
>>> Creating ollama systemd service...
>>> Enabling and starting ollama service...
Created symlink /etc/systemd/system/default.target.wants/ollama.service → /etc/systemd/system/ollama.service.
>>> The Ollama API is now available at 127.0.0.1:11434.
>>> Install complete. Run "ollama" from the command line.
WARNING: No NVIDIA/AMD GPU detected. Ollama will run in CPU-only mode.
The GPU warning is correct and harmless in this lab: the model runs on the CPU.
Step 2 – is the service running?
# on cp1
systemctl is-active ollamasystemctl is-active ollamaasks systemd whether the service is running; the answer is one word.
Expected:
active
Step 3 – which port does it listen on?
# on cp1
ss -ltnpss -ltnpshows programs waiting for connections:-llistening only,-tTCP only,-nnumbers instead of names,-pwith process.
Expected (excerpt – look for the line with
11434):
LISTEN 0 4096 127.0.0.1:11434 0.0.0.0:*
Step 4 – does the interface answer?
# on cp1
curl -s localhost:11434/api/versioncurl -s localhost:11434/api/versionasks the HTTP interface for its version;-ssuppresses the progress display.
Expected:
{"version":"0.40.19"}
Note 127.0.0.1:11434: Ollama only listens on the local
address. It is not reachable from worker1 or your computer – which is
good, because the interface has no authentication. Everything that talks
to the model therefore runs on cp1.
Step 5 – download the model.
# on cp1
ollama pull qwen3:4b-instructollama pull downloads a model from the Ollama library.
The name before the colon is the model family, after it comes the
variant. The download is 2.5 GB; the progress display ends with
success.
Step 6 – what is on disk?
# on cp1
ollama listollama list shows all downloaded models.
Expected:
NAME ID SIZE MODIFIED
qwen3:4b-instruct 0edcdef34593 2.5 GB 3 minutes ago
Step 7 – what can the model do?
# on cp1
ollama show qwen3:4b-instructollama show shows the properties of a model.
Expected (shortened):
Model
architecture qwen3
parameters 4.0B
context length 262144
quantization Q4_K_M
Capabilities
tools
thinking
completion
The important section is Capabilities:
tools means the model supports tool calling. Without this
capability it would be useless for this course.
context length is the number of tokens (word pieces) the
model can process at once; Q4_K_M describes the reduction
to about 4 bits per weight.
If it doesn’t work
Error: pull model manifest: … connection refused: the service is not running.sudo systemctl status ollamashows the reason,journalctl -u ollama -n 30the latest messages.- Download aborts:
ollama pullresumes where it left off on the next call.
Remember: Ollama listens only on
127.0.0.1:11434and has no authentication. Withouttoolsunder Capabilities a model is no use for this course.
Save your progress? Sign up for free
Drill 5: Querying the model – and hitting its limit
Where you are: on cp1.
What you have afterwards: a first answer from the model over the HTTP interface.
Ollama offers an interface for conversations at
/api/chat. You send a JSON object with the model name and a
list of messages, and the model replies with a new message.
Step 1 – send the question, save the answer.
# on cp1
curl -s http://localhost:11434/api/chat -o antwort-0.json -d '{
"model": "qwen3:4b-instruct",
"stream": false,
"messages": [
{"role": "user", "content": "Wie viel Platz ist auf der Festplatte von cp1 frei? Antworte in einem Satz."}
]
}'-o antwort-0.jsonwrites the response into a file (antwort= “answer”). This way you can take it apart calmly afterwards.-d '…'sends the text in single quotes as the body of a POST request.curlchooses the POST method automatically as soon as it has data to send."model"names the model."stream": falseasks for a single, complete answer instead of many small pieces produced while writing."messages"is the conversation so far. The question asks, in German, how much space is free on cp1’s disk, answered in one sentence. Each message has a role:userfor you,assistantfor the model,systemfor background instructions and – just as important –toolfor results from tools. The command prints nothing – the response is in the file.
Step 2 – read the essentials of the response.
# on cp1
jq '{model, content: .message.content, total_s: (.total_duration/1e9|floor)}' antwort-0.jsonjq '{…}' antwort-0.jsonbuilds a smaller object from the response: the model name, the text of the answer (.message.content) and the duration. Ollama returnstotal_durationin nanoseconds;/1e9turns it into seconds,floorrounds down.
Expected (the wording varies from run to run):
{
"model": "qwen3:4b-instruct",
"content": "Ich kann keine Informationen über die freien Speicherplatz auf einer Festplatte namens „cp1“ bereitstellen, da dieser Begriff nicht existent oder nicht definiert ist.",
"total_s": 9
}
This is the honest answer of a model without access to the outside
world: it says it cannot provide information about a disk named “cp1”
because that term does not exist. It doesn’t even know that
cp1 is the machine it is running on. The first request
takes longer because Ollama first loads the model into memory; after
that it stays loaded for five minutes.
Remember: Without tools the guest can only guess. Knowledge about your system enters the conversation only through a bookable service.
Save your progress? Sign up for free
Drill 6: A tool call by hand
Where you are: on cp1, in the directory
~/mcpa/tag00.What you have afterwards: two JSON files and an understanding of which steps a host takes for every tool call.
Now you give the model a tool. Because the request gets longer, you write it into a file.
Step 1 – create the working directory.
# on cp1
mkdir -p ~/mcpa/tag00mkdir -p creates the directory including missing parent
directories and reports no error if it already exists.
# on cp1
cd ~/mcpa/tag00cd changes into it. All further commands of this drill
run here.
Step 2 – the first request with a tool description. Create the file in the editor:
# on cp1, in ~/mcpa/tag00
nano anfrage-1.jsonContent:
{
"model": "qwen3:4b-instruct",
"stream": false,
"messages": [
{"role": "user", "content": "Wie viel Platz ist auf der Festplatte von cp1 frei? Antworte in einem Satz."}
],
"tools": [
{
"type": "function",
"function": {
"name": "freier_speicher",
"description": "Liefert den freien Plattenplatz im Wurzeldateisystem eines Rechners in GB",
"parameters": {
"type": "object",
"properties": {
"rechner": {"type": "string", "description": "Hostname, z. B. cp1"}
},
"required": ["rechner"]
}
}
}
]
}Save with Ctrl+O and Enter, quit with Ctrl+X.
What’s new is the "tools" block. It describes a tool
that doesn’t even exist yet – the model only gets the description:
"type": "function"– the kind of tool; Ollama only knows functions."name"– the name the model uses to request the tool (freier_speicher, “free storage”)."description"– the description in natural language (here: returns the free disk space of a machine’s root file system in GB). It is the only thing from which the model recognizes what the tool is good for. A bad description leads to wrong calls."parameters"– a JSON Schema that describes the inputs: an object ("type": "object") with a propertyrechner(“machine”) of type string, which is required ("required"). JSON Schema shows up everywhere in MCP; Day 3 explains it in detail.
Step 3 – send the request.
# on cp1, in ~/mcpa/tag00
curl -s http://localhost:11434/api/chat -d @anfrage-1.json -o antwort-1.json-d @anfrage-1.json– the@reads the content from the file.-o antwort-1.jsonsaves the response.
Step 4 – read the model’s message.
# on cp1, in ~/mcpa/tag00
jq .message antwort-1.jsonjq .messageshows only the model’s message.
Expected (your id will be
different):
{
"role": "assistant",
"content": "",
"tool_calls": [
{
"id": "fVoZH73fJ4vU1jdeIXz9SIUP2SzSEyh2",
"function": {
"index": 0,
"name": "freier_speicher",
"arguments": {
"rechner": "cp1"
}
}
}
]
}
Read this response carefully. content is empty – the
model wrote no text. Instead tool_calls contains a request:
tool freier_speicher, argument rechner with
the value cp1. The model extracted the machine name from
your question and put it into the form the schema requires.
Nothing was executed. Now it’s your turn.
Step 5 – run the tool yourself. You play the application and execute what the tool is supposed to do:
# on cp1
df -BG --output=avail / | tail -1dfshows file system usage.-BGprints sizes in gigabytes,--output=availonly the column with the free space,/only the root file system.tail -1drops the header and shows only the last line.
Expected (your number will be different):
60G
Step 6 – return the result. The model doesn’t
remember the first request – each request stands on its own. You
therefore send the whole conversation again: your
question, the model’s request and the tool’s result as a message with
the role tool.
# on cp1, in ~/mcpa/tag00
nano anfrage-2.json{
"model": "qwen3:4b-instruct",
"stream": false,
"messages": [
{"role": "user", "content": "Wie viel Platz ist auf der Festplatte von cp1 frei? Antworte in einem Satz."},
{"role": "assistant", "content": "",
"tool_calls": [{"function": {"name": "freier_speicher", "arguments": {"rechner": "cp1"}}}]},
{"role": "tool", "tool_name": "freier_speicher", "content": "{\"rechner\": \"cp1\", \"frei_gb\": 60}"}
],
"tools": [
{
"type": "function",
"function": {
"name": "freier_speicher",
"description": "Liefert den freien Plattenplatz im Wurzeldateisystem eines Rechners in GB",
"parameters": {
"type": "object",
"properties": {
"rechner": {"type": "string", "description": "Hostname, z. B. cp1"}
},
"required": ["rechner"]
}
}
}
]
}The second message repeats the model’s request, the third brings the
result: "role": "tool" marks a tool result,
"tool_name" says which tool it comes from, and
"content" contains the result as text. The quotes in the
result are escaped with \ because the result itself is a
string inside JSON.
Step 7 – send the second request.
# on cp1, in ~/mcpa/tag00
curl -s http://localhost:11434/api/chat -d @anfrage-2.json -o antwort-2.jsonStep 8 – read the answer.
# on cp1, in ~/mcpa/tag00
jq -r .message.content antwort-2.jsonjq -rprints the text without surrounding quotes (-r= raw).
Expected:
Auf der Festplatte von cp1 ist 60 GB frei.
Now the model can answer (“60 GB are free on cp1’s disk”) – with a number it would never have seen on its own.
What you just did by hand
Count everything you had to do as the “application”:
- describe the tool in a format that exactly this model understands,
- examine the model’s response and recognize that it wants a tool,
- decide whether you want to allow that at all,
- run the tool – here with a
dfcommand that only you knew, - bring the result into the right format and send it back with the whole conversation.
Steps 1 and 4 depend on the tool, steps 2, 3 and 5 on the application. Without a standard, every application rewrites all five steps for every tool. MCP splits exactly along this line: an MCP server takes over steps 1 and 4 – it describes its tools and runs them. The host with its MCP client takes over steps 2, 3 and 5 – it talks to the model, asks the human for permission and passes results on. Between the two lies a fixed protocol. From Day 1 on you build both sides.
If it doesn’t work
parse errorfromjqor a response with"error": the JSON file is broken, usually because of a missing comma or quote.jq . anfrage-1.jsonchecks the file and names the line and column of the error.- The model answers with text instead of
tool_calls: small models don’t always decide the same way. Send the request again. If a call never comes, check withollama showwhether the model liststoolsunder Capabilities.
Remember: Five errands per tool call: describe, recognize the request, allow it, run it, send the result back with the whole conversation. The contractor does two of them, the front desk three.
Save your progress? Sign up for free
Drill 7: The project for the course
Where you are: on cp1, in the directory
~/mcpa.What you have afterwards: a Python project with the official MCP SDK in which all further days work.
# on cp1
cd ~/mcpa# on cp1, in ~/mcpa
uv init --bare --python 3.12 .uv init creates a new Python project.
--barecreates only the project filepyproject.toml, no sample files and no Git repo.--python 3.12sets which Python version the project requires – the one shipped with Ubuntu..means: in the current directory.
Expected:
Initialized project `mcpa` at `/home/ubuntu/mcpa`
Now you add the MCP SDK:
# on cp1, in ~/mcpa
uv add "mcp[cli]==2.3.0"uv addadds a dependency topyproject.toml, creates the virtual environment.venvif needed, installs the package along with everything it needs, and writes the exact versions touv.lock.mcpis the official Python SDK of the Model Context Protocol.[cli]is an extra: it additionally installs the command-line toolmcp.==2.3.0pins the version.- The quotes prevent the shell from interpreting the square brackets as a file name pattern.
Expected (the last lines of a longer list):
+ typer==0.29.3
+ typing-extensions==4.16.0
+ typing-inspection==0.4.5
+ uvicorn==0.54.0
Among the installed packages you find old acquaintances from the
Python world: pydantic validates data against schemas,
starlette and uvicorn will later provide the
HTTP server, httpx is the HTTP client.
Check 1 – the project file.
# on cp1, in ~/mcpa
cat pyproject.tomlcatprints the project file.
Expected:
[project]
name = "mcpa"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = [
"mcp[cli]==2.3.0",
]
Check 2 – the SDK in the environment.
# on cp1, in ~/mcpa
uv run mcp versionuv runruns a command inside the project’s virtual environment – you never have to activate it by hand.mcp versionis the tool you just installed.
Expected:
MCP version 2.3.0
Check 3 – the files.
# on cp1, in ~/mcpa
ls -als -ashows all files, including hidden ones that start with a dot.
Expected:
.
..
.venv
pyproject.toml
tag00
uv.lock
.venv is the virtual environment, uv.lock
the lock file with all versions. uv manages both for you. From Day 1 on
you create a subdirectory for each day and start programs with
uv run.
Remember:
uv addadds, installs and pins the version;uv runstarts inside the environment. That is all the Python tooling you need in this course.
Save your progress? Sign up for free
Exercise: A second tool (15 min)
Extend anfrage-1.json with a second tool
laufzeit (“uptime”) that returns for how many days a
machine has been running (parameter rechner). Ask the
question “Seit wann läuft cp1?” (“How long has cp1 been running?”) and
check which tool the model chooses. Determine the real value with
uptime -p and return it.
Solution
In the "tools" array, add a comma after the first tool
and then this object:
{
"type": "function",
"function": {
"name": "laufzeit",
"description": "Liefert, seit wie vielen Tagen ein Rechner läuft",
"parameters": {
"type": "object",
"properties": {"rechner": {"type": "string"}},
"required": ["rechner"]
}
}
}
Change the question to "Seit wann läuft cp1?". The model
answers with a tool_calls entry for laufzeit,
not for freier_speicher – it read and compared the
descriptions. uptime -p prints the uptime in readable form
(-p = pretty, for example up 30 minutes). You
build the second request like anfrage-2.json, with
"tool_name": "laufzeit" and the result as
content.
Save your progress? Sign up for free
Challenge: Misleading the model (10 min)
In anfrage-1.json, change only the
description of freier_speicher to “Liefert das
Wetter in einer Stadt” (“Returns the weather in a city”) and send the
disk space question again. What happens – and what does that say about
the role of the description?
Solution
The model no longer calls the tool. tool_calls is
missing, and the text reads something like: “Ich kann den freien
Speicherplatz auf der Festplatte von cp1 nicht bestimmen, da dafür kein
entsprechendes Werkzeug …” (“I cannot determine the free space on cp1’s
disk because there is no suitable tool …”). Even though the tool is
still called freier_speicher, the model takes it for a
weather service. For the model, the description is the only information
about what a tool does; the name alone is not enough. Two lessons follow
from this that stay with you throughout the course: good descriptions
are mandatory (Day 5) – and whoever controls a tool’s description can
steer the model’s behavior. That is exactly what attacks such as
tool poisoning exploit (Day 11).
Save your progress? Sign up for free
Checkpoint
# on your computer
ssh cp1 hostname
ssh worker1 hostname
ssh worker2 hostnameExpected: cp1, worker1,
worker2 without a password prompt.
# on cp1
systemctl is-active ollamaExpected: active
# on cp1
ollama list | grep -c qwen3:4b-instructgrep -c counts the matching lines.
Expected: 1
# on cp1
cd ~/mcpa# on cp1, in ~/mcpa
uv run mcp versionExpected: MCP version 2.3.0
# on worker1
uv --versionExpected:
uv 0.13.10 (x86_64-unknown-linux-gnu) (or
aarch64-…)
Exam questions
1. A language model responds to a request containing
tool descriptions with a tool_calls entry. Who runs the
tool?
- the model itself, before it answers
- the application that queried the model
- the model vendor on its servers
- nobody –
tool_callsis just a hint for the user
- nobody –
2. How does a model recognize which of several tools fits a question?
- by the tool’s name alone
- by the order in the list
- by name, description and parameter schema
- by the return value of the last call
3. Three AI applications are to use four internal systems. How many integrations do you need without a common standard, and how many with MCP (one client per application, one server per system)?
- 12 and 12
- 12 and 7
- 7 and 12
- 7 and 1
4. Why must the second request to the model contain the original question again?
- because the interface is stateless and the model doesn’t remember earlier requests
- because otherwise the model calls the tool again
- because Ollama needs the question for billing
- it doesn’t have to; the
toolrole is enough
- it doesn’t have to; the
5. Which task does the server take on in the MCP architecture?
- talking to the language model and displaying its answers
- describing and running tools
- asking the human for consent
- training the model
Solutions
- B. The model only produces a structured request. The application must execute it – in MCP the host forwards the request via its client to the right server. A is the most common misconception about tool calling.
- C. The model sees name, description and schema. The description carries the most meaning, as the challenge showed.
- B. Without a standard 3 × 4 = 12 integrations, with MCP 3 clients + 4 servers = 7.
- A. Each request to the chat interface stands on its own; the conversation lives in the application, not in the model.
- B. The server describes and executes. Talking to the model and obtaining consent are tasks of the host.
Interview Note
“What is the difference between tool calling and MCP?” – Tool calling is a model’s ability to request a tool call in a structured way; every model vendor has its own format for it. MCP is a protocol between the application and the tool provider: it defines how tools are described, discovered and called – independent of the model. The host translates between the two worlds.
Enterprise Note
In an organization, a locally run model is often not a stopgap but a
requirement: when data must not leave the house, when costs need to be
predictable, or when a network runs without internet access. MCP
separates the choice of model from the integration of systems – a server
you write for a local model works unchanged when a different model is
later behind it. Note, however: Ollama’s interface has no
authentication. It belongs, as here, on 127.0.0.1 or behind
a proxy with access control.
Summary
- You made three VMs reachable with your own SSH key and short names and taught them to know each other by name.
- Ollama runs on cp1 with the model
qwen3:4b-instruct, reachable only locally on port 11434. - Without tools, a language model has no access to the outside world.
- With tool calling, the model asks for a call; the application executes it and returns the result together with the whole conversation.
- A tool’s description controls whether and how the model uses it.
- MCP divides the work: the server describes and runs tools, the host talks to the model and the human. N × M integrations become N + M.
- In
~/mcpaa Python project with MCP SDK 2.3.0 is waiting for Day 1.
Commands at a glance
For review: all commands of this day with the parameters you used.
| Command | What it does | Parameters |
|---|---|---|
ssh-keygen -t ed25519 -f <file> -C <comment> |
creates a key pair | -t type, -f file name, -C
comment |
ssh-copy-id -i <datei.pub> <user>@<host> |
adds the public key on the VM | -i which key |
ssh <host> <command> |
logs in and runs a command | short name from ~/.ssh/config |
sudo nano <file> |
edit a file with root rights in the editor | Ctrl+O save, Ctrl+X quit |
ping -c1 -W2 <host> |
checks name resolution and reachability | -c count, -W timeout in s |
sudo apt-get install -y -qq <packages> |
installs packages | -y no prompt, -qq terse |
curl -LsSf <url> \| sh |
downloads an install script and runs it | -L redirects, -s silent, -S
show errors, -f abort on HTTP error |
curl -fsSL <url> -o <file> |
downloads into a file | -o output file |
OLLAMA_VERSION=<v> sh <script> |
installs Ollama at a fixed version | variable for this call only |
systemctl is-active <service> |
is the service running? | – |
ss -ltnp |
listening ports with process | -l listening, -t TCP, -n
numbers, -p process |
ollama pull <model> · ollama list ·
ollama show <model> |
download model · list · properties | <family>:<variant> |
curl -s <url> -d '<json>' -o <file> ·
-d @<file> |
POST request with body (from file), response into a file | -d data, @ reads file, -o
output file |
jq <filter> <file> |
formats and filters JSON from a file | -r without quotes, -c one line |
df -BG --output=avail / |
free space | -BG in GB, --output column |
uv init --bare --python 3.12 . |
creates a Python project | --bare only pyproject.toml,
--python version |
uv add "<package>[extra]==<version>" |
adds and installs a dependency | [extra] extras, == pinned version |
uv run <command> |
runs a command in the project environment | – |