MCP Tutorial: Build Your First MCP Server and Client from Scratch (Free Labs)
Video by KodeKloud on YouTube · 40 min · uploaded July 2025
Notes and analysis by BrainTube, written from the video. Not affiliated with KodeKloud. Watch on YouTube
In short
This 40-minute KodeKloud video takes a beginner from 'what is an agent' to a working FastMCP flight booking server connected to the Roo Code extension, then sketches a Python client. The spec walk-through (JSON-RPC 2.0, stdio and HTTP transports, tools, resources, prompts, roots, sampling, elicitation) is accurate and unusually complete for an intro. It is thin on how the model actually chooses tools, who controls resources and prompts, and how to secure a remote server.
The argument
The video argues that MCP exists to kill per-vendor integration code. Its running example is a flight agent that must call three airlines whose APIs all differ: one uses one path for flights, another a different path, and each returns a different shape. Writing that glue for hundreds of airlines does not scale. MCP replaces it with one contract: a server lists its capabilities in a fixed format, speaks JSON-RPC, and any compliant client can use it. Once you accept that, building a server is mostly decorating ordinary Python functions with the SDK, and building a client is a handful of calls to list tools, call a tool, read a resource and fetch a prompt. The labs exist to make each of those steps concrete.
Key ideas, with timestamps
- 3:48
An agent is an old automation script that asks an LLM
He compares agents to vRealize Orchestrator, System Center Orchestrator, Zapier or chained Python scripts. The only change is that branch choices, loop counts and the exit condition are delegated to an LLM. At 5:12 he shows a framework-free Python agent that extracts origin, destination and date, fetches flights, reads preferences and books, and he flags that all slide code is pseudocode.
- 6:39
The problem: every airline API is different
Inside the pseudocode fetch function, each airline gets its own tool call with its own endpoint name and its own response format. That is the cost MCP targets. The point is clearer here than in most explainers because you see three concrete, mismatched calls side by side.
- 13:20
What the spec actually requires
Reading from modelcontextprotocol.io, he lists the rules: JSON-RPC messages, a stateful connection, servers offering any of resources, prompts and tools, and clients offering sampling, roots and elicitation. His takeaway is that anyone can build a server as long as they follow the spec, and any client can then use it.
- 14:46
Tools, resources and prompts, derived from first principles
He imagines a world without MCP. A client would need the server's capabilities (tools, each with a description and input and output schema), reference data such as refund policies or FAQs (resources, each with a URI, name, title and description), and the server author's best instructions for using it (prompts with named arguments). Deriving the three primitives from need is the best teaching move in the video.
- 18:33
JSON-RPC and the two transports
A request carries jsonrpc 2.0, a method, params and an id. The response carries a result or an error plus the same id. JSON-RPC does not define transport, so MCP picks two: stdio and HTTP. At 21:28 he shows a Cursor-style mcp.json with a command, args and env, which launches the server in stdio mode, and at 22:25 he switches to a URL for a shared local or vendor-hosted server.
- 25:18
Lab: wiring an existing server into Roo Code
The lab uses Roo Code, a VS Code extension, with an OpenAI-compatible endpoint and a free DeepSeek model. The project MCP config runs the server with uv and server.py, the server shows a green status with its tools and resources, and a prompt to search flights from LAX to JFK triggers an approval dialog before the tool runs.
- 27:43
Building the server with FastMCP
The recipe: create the project with uv init, add the MCP package with its CLI extra, import FastMCP, then decorate plain functions as resources, tools and prompts. At 32:26 the lab adds a resource decorator to a get airports function with a file URI, then tool decorators to search flights and create booking. At 29:05 he covers stateless HTTP mode and streamable HTTP, and at 29:33 the MCP Inspector, started with npx, for testing before any client exists.
- 37:09
Client features: roots, sampling, elicitation
The server can push info, debug and progress messages back through a context object. Roots are folders the client allows the server to see. Sampling lets the server ask the client's LLM for a completion, so model choice and token limits stay with the client. Elicitation lets the server ask the end user a question, such as confirming the chosen flight, through a client callback.
What it gets right
Coverage is the strength. Most beginner MCP videos stop at tools. This one covers all six primitives, both transports, the JSON-RPC envelope, the Inspector, and the context object for progress updates. The section on sampling explains the design reason, not just the API: the server stays decoupled from any model, and the client keeps control of model choice and cost. That reasoning is what makes MCP servers reusable across clients.
The warning at 22:25 is also correct and easy to miss. A remote server receives your data, so authentication, authorization, privacy and trust in the operator matter more than they do for a local stdio process. The same goes for community servers, which he says at 9:59 come with no guarantee of testing or currency.
The lab flow is a sensible order: use a server, then build one, then build a client. Seeing a tool approval dialog in Roo Code before writing any code teaches more about the user experience than a diagram does.
What it leaves out or gets loose
- How tool choice really works. He calls MCP a guide that helps the AI choose the right APIs, but never shows that the tool name and description are what the model reads. In practice the quality of the description and the parameter schema decides whether the model calls the tool correctly. A lab step that rewrites a vague description and watches behavior change would teach more than the multiple-choice questions.
- Who controls each primitive. The spec's design is that tools are model-controlled, resources are application-controlled and prompts are user-controlled, usually surfaced as commands or menu items. The video presents prompts as a better system prompt the server author writes for the agent developer. That is partly true, but it hides that a user normally picks a prompt, and that many clients pass resources only when the user or app attaches them.
- Transport history. He lists stdio and HTTP and mentions streamable HTTP. As of the July 2025 upload, streamable HTTP had replaced the older HTTP plus server-sent events transport in the spec, and older tutorials still show the old one. Check which one your client supports.
- Security beyond one sentence. Tool descriptions enter the model's context, so a hostile server can inject instructions. Roots limit file access only if the server respects them. Remote servers in the spec use OAuth-based authorization, which the video does not show.
- The agent section is long for a build tutorial. Roughly the first ten minutes are agent background, and the slide at 8:36 about debugging a UI regression through git history is described as not using an MCP server, which muddies the use-case list.
How this applies to memory across AI tools
The video's resources section maps directly onto personal knowledge. Airport lists and refund policies are the same kind of thing as your notes and saved transcripts: reference data an agent should consult before it acts. The design choice that matters is how you expose it. A large knowledge base works better as a search tool than as a list of resources, because the model can query it on demand instead of the app loading everything up front. That is the pattern behind an MCP memory server.
BrainTube follows it. It saves YouTube videos with their transcripts, articles, PDFs and podcasts into one compiled knowledge base and exposes that as an MCP server, so Claude, ChatGPT, Cursor and other MCP clients can search the same material. If you want to build your own instead, the FastMCP recipe in this video is enough to start. Expose one well-described search tool first, then add resources only for small, stable reference files. For a setup walkthrough see give your AI memory with MCP.
Who should watch it
Watch it if you are new to MCP, comfortable with basic Python, and want one video that covers the spec end to end with hands-on labs. If you already know what an agent is, skip to 12:50, where the MCP part starts; 14:46 to 19:31 (primitives, JSON-RPC, transports) is the densest stretch, and 27:43 to 33:24 is the server build. Experienced MCP developers can jump to 37:09 for roots, sampling and elicitation, then stop. Skip it if you need production topics such as OAuth, deployment or tool-description design.
Frequently asked
- How do I build an MCP server in Python?
- Create a project with uv, add the official MCP SDK, import FastMCP and create a server object. Decorate ordinary functions with the tool, resource or prompt decorators, then run the server with stdio for local clients or HTTP for shared ones. Test it with the MCP Inspector before connecting a client such as Cursor, Claude Desktop or Roo Code.
- What is the difference between MCP stdio and HTTP transport?
- With stdio, the client launches the server as a local subprocess and they exchange JSON-RPC messages over standard input and output. It is simple and isolated, so it suits a single user on one machine. HTTP, now the streamable HTTP transport, runs the server as a network service that several clients or a whole team can share, which means you also need authentication.
- What are roots, sampling and elicitation in MCP?
- They are features the client offers to the server. Roots tell the server which local folders it may access. Sampling lets the server ask the client's model for a completion without holding its own API key. Elicitation lets the server ask the end user for input or confirmation in the middle of a task.
Keep videos like this one searchable
BrainTube saves YouTube videos with their transcripts into one compiled knowledge base that Claude, ChatGPT, Cursor and other MCP clients can search.
Go deeper
More video notes
- MCP Servers Explained & Built · Tech With Tim
- MCP Explained Simply — What It Is and Why It Exists · TechWorld with Nana
- How Model Context Protocol (MCP) actually works · Google Cloud Tech
- Model Context Protocol (MCP) Explained for Beginners: AI Flight Booking Demo! · KodeKloud
Are you the creator and want this page changed or removed? Contact us and we will act within 48 hours.