Lesson 2 · Unit 03
The Model Context Protocol
One protocol between AI apps and tools: hosts, servers and JSON-RPC
What you practise
- One protocol between agents and tools: clients and servers, tools, resources and prompts, a request and its response as JSON-RPC messages, local and remote transports
Try a question from this lesson
Pick one
3 AI apps each need to reach 4 services: code hosting, a database, a calendar, files. How many integrations with custom glue for every pair, and with one shared protocol?
Hint
With a shared protocol, each app implements it once and so does each service.
Correct answer
12 custom, or 7 with a shared protocol
Why
Every pair needs its own glue: 3 × 4 = 12. With a shared protocol each app implements it once and each service once: 3 + 4 = 7, and a new app costs 1, not 4. The Model Context Protocol (MCP) is such a protocol.
The ideas
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
Host, client, server
In MCP the host is the AI application. For every server it connects to, it creates one client, and each client talks to exactly one server.
A server offers three things: tools the model can call, resources (data to read as context) and prompts (templates a user can pick).
host (the AI app)
client 1 <-> server: files
client 2 <-> server: database
client 3 <-> server: calendarConcept
Two kinds of failure
A protocol error means the request itself was no good: an unknown tool, a malformed message. The server answers with a JSON-RPC error in place of a result.
A tool execution error means the request was fine but the tool failed: a bad date, an API that is down. It comes back as a normal result with isError set to true and a message the model can read and act on.
10 more exercises in the app
- 2× true or false
- 1× match the pairs
- 4× multiple choice
- 1× fill the blanks
- 1× order the lines
- 1× type the answer
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.