E1 · See the pieces
5 minRun the listar block after installing the kit (lesson 2, first block).
Done when: node listar.mjs → 2 ferramentas · 1 recurso · 1 prompt, with era: modern and saída: 0.
Lesson 1 · 15 min
Before you write code, separate the pieces. The MCP server offers three things (tools, resources, and prompts), the client lives inside the app with the model, and the transport is just the pipe. In this lesson you connect a client to the kit's server and see each piece listed.
Start the lesson
Goal: tell a tool, a resource, and a prompt apart, and say who is the host, client, server, and transport in your service.
Click each block.
Split of control according to the official v2 SDK documentation (Tools, Resources, and Prompts pages), read on 10/19/2026.
In the kit, a fictional course class service.
A function the model decides to call based on its name, description, and input schema. It can only read, or it can change something in the world.
In the kit: buscar_turmas (read-only) and reservar_vaga (has consequences).
Is there an MCP class with an open seat?
Read-only data, identified by a URI, that the client lists and attaches as context. The app decides what to read, not the model.
In the kit: turmas://catalogo, the whole catalog in JSON.
A ready-made request, with arguments, that the client shows for the person to choose (like a slash command or menu item).
In the kit: convite_turma, which builds the request for an invitation to a class.
If it changes something or depends on the user's question, it's a tool. If it's stable context the app can attach, it's a resource. If it's a shortcut the person triggers, it's a prompt.
Most services start with just tools, and that's fine.
The current protocol version is 2026-07-28 (MCP versioning page, read on 10/19/2026). The previous one was 2025-11-25.
What changes the most for anyone coming from 2025: there is no more initialize handshake or session (Mcp-Session-Id); each request carries the version and capabilities in _meta; the client discovers the server with server/discover; and a server that needs to ask the user something returns input_required instead of opening its own request. Roots, Sampling, and Logging were deprecated.
The official SDK that implements this is the v2 line (@modelcontextprotocol/server and @modelcontextprotocol/client, 2.3.1, from 10/05/2026). The old @modelcontextprotocol/sdk package (1.32.1) still speaks 2025-11-25: it's what you'll find in most tutorials.
You need the kit installed (lesson 2, first block). The client talks to the server in the same process, with no port.
cd ~/projetos/formacao-webmcp-mcp-v72/kit node listar.mjs; echo "saída: $?"
// listar.mjs — connects an MCP client to the classes server, in the same process (no port),
// and shows the anatomy: protocol era, tools, resources, and prompts.
import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client';
import { createMcpHandler } from '@modelcontextprotocol/server';
import { createServer } from './servidor.mjs';
const handler = createMcpHandler(createServer);
const transporte = new StreamableHTTPClientTransport(new URL('http://teste.local/mcp'), {
fetch: (url, init) => handler.fetch(new Request(url, init))
});
// mode 'auto': asks server/discover; if the server is old, falls back to initialize.
const cliente = new Client({ name: 'listar', version: '1.0.0' }, { versionNegotiation: { mode: 'auto' } });
await cliente.connect(transporte);
const { tools } = await cliente.listTools();
const { resources } = await cliente.listResources();
const { prompts } = await cliente.listPrompts();
console.log(`era: ${cliente.getProtocolEra()}`);
for (const t of tools) console.log(`ferramenta: ${t.name} · readOnlyHint=${t.annotations?.readOnlyHint}`);
for (const r of resources) console.log(`recurso: ${r.uri}`);
for (const p of prompts) console.log(`prompt: ${p.name}`);
console.log(`${tools.length} ferramentas · ${resources.length} recurso · ${prompts.length} prompt`);
await cliente.close();
await handler.close();era: modern ferramenta: buscar_turmas · readOnlyHint=true ferramenta: reservar_vaga · readOnlyHint=false recurso: turmas://catalogo prompt: convite_turma 2 ferramentas · 1 recurso · 1 prompt saída: 0
era: modern means the client and server agreed on revision 2026-07-28. With mode: 'legacy' (the v2 client's default) they would fall back to the 2025 initialize.
Rehearsal in the kit and the map of your service.
Run the listar block after installing the kit (lesson 2, first block).
Done when: node listar.mjs → 2 ferramentas · 1 recurso · 1 prompt, with era: modern and saída: 0.
In a file named mapa-mcp.md, list what your service would expose as a tool, as a resource, and as a prompt. Mark each tool as read or consequence.
Done when: grep -c -E "leitura|consequência" mapa-mcp.md → at least 3.
Question 1 of 4
Who decides to call an MCP tool?skill
Question 2 of 4
The full class catalog, in JSON, that the app can attach as context, is what?skill
turmas://catalogo) is a resource. If it depended on the user's question, it would be a tool.turmas://catalogo) is a resource. If it depended on the user's question, it would be a tool.Review: The three things a server offersQuestion 3 of 4
What did the 2026-07-28 revision remove from the protocol?skill
Mcp-Session-Id; server/discover came in.Mcp-Session-Id; server/discover came in.Review: Revision 2026-07-28: what changed on one screenQuestion 4 of 4
You install @modelcontextprotocol/sdk 1.32.1 by following a tutorial. Which revision does it speak?
LATEST_PROTOCOL_VERSION = '2025-11-25'. 2026-07-28 is in the v2 line (@modelcontextprotocol/server 2.3.1).LATEST_PROTOCOL_VERSION = '2025-11-25'. 2026-07-28 is in the v2 line (@modelcontextprotocol/server 2.3.1).Review: Revision 2026-07-28: what changed on one screenPick an option. The explanation appears after you try.