All video notes
Video notes · MCP

MCP Tutorial: Build Your First MCP Server

Video by codebasics on YouTube · 14 min · uploaded April 2025

Notes and analysis by BrainTube, written from the video. Not affiliated with codebasics. Watch on YouTube

In short

Codebasics builds a small Python MCP server for HR leave management with the official SDK's FastMCP class, installs it into Claude Desktop with one command, and shows Claude picking the right tool from plain-English questions. It is a good first hands-on demo and the advice about docstrings is the most important line in it. It skips everything that matters once the data is real: persistence, validation, authorisation and the risk of letting a model call a write tool.

The argument

The video's point is that a first MCP server is mostly ordinary Python. You describe each capability as a decorated function with a clear docstring, the SDK turns those into tools, and an MCP client like Claude Desktop decides when to call them and with which arguments. The presenter frames it around a real need at his company, an assistant that helps an HR manager answer leave questions and file leave, and keeps the code deliberately tiny so the round trip from question to function call is easy to see.

Key ideas, with timestamps

  1. 0:00

    A concrete use case, a generic client

    The target is an HR assistant for leave management at his company, backed by an employee database. Ideally the client would be an internal chatbot, but at 1:08 he uses Claude Desktop as a ready-made MCP client to keep the tutorial short. That split between your server and any client is the right first lesson.

  2. 1:41

    Setup: the SDK and uv

    He installs the MCP Python SDK with pip, installs the uv package manager, and at 2:49 runs uv init to scaffold a project with main.py, pyproject.toml and a README. At 3:28 he takes the SDK's two-number addition example from its PyPI page.

  3. 3:38

    Let a chatbot draft the server

    He pastes the addition example into ChatGPT, asks for a leave-management version, iterates with a few follow-up prompts and copies the result back. It is an honest look at how many people actually write their first server.

  4. 4:20

    FastMCP, mock data and three tools

    The server creates a FastMCP object and reads from a hard-coded dictionary of two employees: E001 with 18 days left and two days taken, E002 with 20 days and none taken. At 4:56 he notes that servers can expose tools, resources and prompts, then defines three tools: get leave balance, apply for leave and get leave history. A greeting resource at 6:06 rounds it out.

  5. 5:38

    Docstrings are the interface

    He stresses that each tool's docstring guides the model on when and how to call it. The payoff comes at 12:34: asked for leave on the fourth of July, Claude passes the date in the exact format the apply-leave docstring specifies. This is the most transferable point in the video.

  6. 6:46

    One command into Claude Desktop

    Running the SDK's mcp install command on main.py through uv writes a leave manager entry into Claude Desktop's config. At 7:41 he explains enabling developer mode, then shows Settings, Developer, Edit Config, where the JSON tells Claude Desktop to launch the server with uv on startup. At 9:52 he fixes a typer error by upgrading the library.

  7. 10:15

    Plain questions become function calls

    Asked how many days E001 has, Claude 3.7 Sonnet calls the balance tool with the right ID and answers 18. A follow-up about the same person resolves the reference and returns Christmas Day and January 1st. At 12:00 a typo-laden request to book July 4th for E002 triggers an approval prompt, then the balance drops to 19.

What it gets right

It shows the whole loop in under 14 minutes. Scaffold, write functions, install into a client, restart, ask a question, watch the tool call. For someone who has only read about MCP, seeing Claude Desktop list the three tools and pick one from a vague question makes the protocol concrete.

Docstrings as the contract is exactly right. The model never sees your code, only the tool name, parameter schema and description. The date-format example proves it. When a tool misbehaves in practice, the description is usually the first thing to fix.

The mcp install shortcut saves a common failure. Hand-editing claude_desktop_config.json with the wrong path or interpreter is where many first attempts break. Showing the generated entry afterwards, rather than hiding it, helps viewers debug later.

What it leaves out

State does not survive a restart. The data lives in a Python dictionary, so the July 4th booking disappears when Claude Desktop relaunches the server. Swapping in SQLite or a real HR database is the obvious next step and is not shown.

The write tool has no guardrails. Apply leave does not check that the dates are in the future, that the balance is sufficient, or that the request is not a duplicate. Nothing checks who is asking. A model can be talked into calling write tools by text in a document or chat, so the server, not the model, must enforce rules. Claude Desktop's approval prompt at 12:55 helps, but it is a client feature, not your protection.

Resources and prompts are mentioned, not explained. The greeting resource is never used in the demo, so viewers do not learn when data belongs in a resource (something the client reads) rather than a tool (something the model calls).

Local stdio only. This server runs as a child process of Claude Desktop on one machine. To reach it from a web chat app or a teammate's client, it would need to run as a remote server over HTTP with authentication, which, as of the video's April 2025 upload, was still settling in the spec.

Some setup is redundant. Installing the SDK globally with pip and then managing the project with uv mixes two environments, which is a common source of errors like the typer issue he hit.

How this applies to memory across AI tools

Swap leave balances for your own notes and the same pattern becomes a memory server: a search tool and maybe a save tool, with docstrings that tell the model when to use them. The gotchas carry over too. Persistence, sensible limits on what a write tool may change, and remote access are what turn a demo into something you rely on. The guide to giving your AI memory over MCP covers those steps.

If you would rather not run that server yourself, BrainTube is a hosted option for research material: it saves YouTube videos with their transcripts, articles, PDFs and podcasts into one compiled knowledge base and exposes it as an MCP server, so Claude, ChatGPT, Cursor and other MCP clients can search it. For other approaches, see MCP memory servers compared.

Who should watch it

Watch it if you know basic Python and want to see a working MCP server in Claude Desktop before reading the spec; the code walkthrough at 4:20 to 6:40 and the install and config steps at 6:46 to 9:20 are the parts to follow along with. The demo at 10:15 to 13:30 is worth watching for how Claude maps questions to tools. Skip it if you already have a server running or need production patterns such as databases, authentication or remote hosting. Note the video was made in April 2025, so Claude Desktop's menus and the SDK's commands may have changed.

Frequently asked

How do I build an MCP server in Python?
Install the official MCP Python SDK, create a FastMCP server object, and decorate ordinary functions as tools with clear docstrings and typed parameters. Run the server and register it with a client such as Claude Desktop. The SDK's install command can write the client config entry for you.
Why are docstrings important in MCP tools?
The model only sees each tool's name, parameter schema and description, never the code. The docstring tells it when to call the tool and what format arguments should take, such as a date format. Vague descriptions are a common cause of wrong or missed tool calls.
How do I add an MCP server to Claude Desktop?
Add an entry under mcpServers in Claude Desktop's config file with the command that starts your server, then restart the app. In the codebasics tutorial this is reached through Settings, Developer, Edit Config, and the SDK's install command writes the entry automatically. Menu names may differ in newer versions.

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.

Start free

Go deeper

More video notes

Are you the creator and want this page changed or removed? Contact us and we will act within 48 hours.