Build an MCP Server in Python (Claude Code Uses It) — Transcript
Full transcript
- 0:00Copy a popular MCP tutorial today and
- 0:02its very first import can fail. On my
- 0:05Mac, even the install failed. By the
- 0:08end, you'll have a working MCP server in
- 0:11under 50 lines.
- 0:13>> [music]
- 0:13>> The two fixes old tutorials miss and
- 0:16plot code using your own tools. Build an
- 0:19MCP server.
- 0:20>> [music]
- 0:22>> MCP, the Model Context Protocol, is an
- 0:24open standard that lets AI apps use
- 0:27outside tools [music] and data.
- 0:29Anthropic introduced it in November
- 0:312024.
- 0:33Since December 2025,
- 0:36it's run under the Linux Foundation.
- 0:38[music] Think of an MCP server as a
- 0:40power strip for your tools. Build it
- 0:43once and any app with an MCP plug can
- 0:46use [music] every tool on it. Cload
- 0:48code, Cload desktop, Cursor, VS Code,
- 0:53Gemini CLI,
- 0:56and Codex from OpenAI. Last episode, our
- 1:00agent kept its two tools inside its own
- 1:03code.
- 1:04Today, we move them into a server and
- 1:06add a third, the latest posts from a
- 1:09website. A server can offer tools the
- 1:12model calls,
- 1:13>> [music]
- 1:13>> resources the app reads, and prompts you
- 1:16pick.
- 1:17Today, tools. And we'll use standards
- 1:20IO.
- 1:22The app starts our server as a program
- 1:25on your own machine. The official Python
- 1:28SDK is the MCP package.
- 1:32Version 2.3.0 is current and it needs
- 1:35Python [music] 3.10 or newer. Fix one.
- 1:39On an Intel Mac, the plain install
- 1:41fails. A dependency called cryptography
- 1:44[music]
- 1:44stopped shipping Intel Mac builds in
- 1:47June. Our only binary cryptography and
- 1:50it installs [music] an older build that
- 1:52works. Fix two. Version two renamed fast
- 1:56MCP to MCP server. So, the import line
- 2:00in older tutorials now fails. [music]
- 2:02No module named. The new line from
- 2:05mcp.server
- 2:07import MCPServer.
- 2:09>> [music]
- 2:10>> Here's a whole server. One line creates
- 2:12it with a name, notes, [music]
- 2:15and one sentence that tells the AI what
- 2:18it's for. Each tool is a normal Python
- 2:21function with mcp.tool on top, brackets
- 2:26included. The function's name becomes
- 2:28the tool's name, the docstring it's
- 2:31description, and the type hints its
- 2:33input [music] schema.
- 2:35Last time we wrote that schema by hand.
- 2:38Read note keeps last episode's guard.
- 2:42It finds the real path, symlinks
- 2:44included, and refuses anything outside
- 2:47the notes folder. One change since
- 2:50version 2.1.
- 2:52>> [music]
- 2:52>> If a tool crashes with an ordinary
- 2:55Python error, the model only sees error
- 2:58executing tool.
- 3:00So, we raise tool error and Claude gets
- 3:03the real reason. The new tool, latest
- 3:06post,
- 3:08reads an RSS feed with Python's built-in
- 3:11XML parser.
- 3:13Only HTTPS links,
- 3:15>> [music]
- 3:15>> at most 5 megabytes,
- 3:18at most 20 posts. Last line, mcp.run.
- 3:24With no arguments, it uses standard IO.
- 3:28So, standard output belongs to the
- 3:30protocol, log to standard error,
- 3:34>> [music]
- 3:34>> never print. Test it first before any
- 3:37model touches it.
- 3:39>> [music]
- 3:39>> The official MCP inspector needs Node
- 3:4222.19
- 3:44[music] or newer, which this Mac doesn't
- 3:47have. So, I use the SDK's own client, 14
- 3:52lines.
- 3:53It lists our three tools, reads
- 3:56todo.txt,
- 3:58and when I ask for the server's own
- 4:01file,
- 4:01>> [music]
- 4:01>> it refuses. And latest posts pulls the
- 4:05three newest tricky word posts live from
- 4:08the feed. Now, plug it in. In your
- 4:11terminal, Claude
- 4:13MCP at [music]
- 4:15notes, two dashes, then the command that
- 4:19starts the server. Claude MCP list
- 4:22[music] says it's connected. By default,
- 4:25it's just for you in this project.
- 4:28Scope user puts it in all your projects.
- 4:32Scope project writes a file your team
- 4:35can share. [music] And with a local
- 4:37model through Ollama,
- 4:39set enable tool search to false, so the
- 4:42tools load up front. Time for the real
- 4:45test. [music] I asked Claude code,
- 4:47running the free local model, "What's
- 4:49[clears throat] in todo.txt,
- 4:51and what [music] are the three latest
- 4:53tricky word posts?" It found our server
- 4:56and called read note. Right answer.
- 4:59>> [music]
- 5:00>> Then it called latest posts and made up
- 5:03the feed's address
- 5:04twice.
- 5:06Neither site exists. Our tool error
- 5:09passed back the real reason, so it
- 5:11didn't pretend.
- 5:12>> [music]
- 5:12>> It told me it couldn't get the posts.
- 5:16That's a lesson in tool design. I gave
- 5:18the model a choice it didn't need.
- 5:20[music] In version two, the address is
- 5:23fixed in the code. The model can't get
- 5:25it wrong, and nobody can point this tool
- 5:28[music] at another site. Same question,
- 5:30version two. Read note, then latest
- 5:33[music] posts with just a limit of
- 5:35three, and a clean answer. My to-do list
- 5:39[music]
- 5:40and the three newest posts. On this
- 5:43laptop, it took about 10 and 1/2
- 5:45minutes.
- 5:47The first request failed after 6
- 5:49minutes, [music] and Claude code retried
- 5:52it on its own. Now, safety. An MCP
- 5:56server is a normal program running with
- 5:59your permissions.
- 6:01It is not a sandbox. In September 2025,
- 6:06a fake postmark MCP package on NPM
- 6:10>> [music]
- 6:10>> added one line that quietly copied every
- 6:14email it sent to the attacker. And
- 6:17everything a server sends goes into the
- 6:19model's context.
- 6:21In April 2025,
- 6:23>> [music]
- 6:24>> researchers showed tool poisoning.
- 6:26Hidden instructions inside a tool's
- 6:28description. Our RSS tool brings web
- 6:31text in two. A post title could carry
- 6:35instructions. Even the official
- 6:37inspector has had security fixes as
- 6:40recently as the 21st of October.
- 6:44So, install servers you trust, pin their
- 6:47versions, and keep them updated. So, one
- 6:50MCP server, three decorated functions,
- 6:53[music]
- 6:54MCP.run,
- 6:55and one cloth MCP add.
- 7:00And don't make the model guess what your
- 7:02code [music] already knows. Next, we
- 7:05attack our own agent. Can a webpage
- 7:08hijack it through the text it reads? And
- 7:11how do we stop it?
About this transcript
This page contains the full transcript of Build an MCP Server in Python (Claude Code Uses It) by TrickyWorld, generated from the public captions YouTube serves with the video. The transcript has 941 words across 173 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.