Loading video player...
So, in this video, we're going to do
something cool. You'll learn how to
build your own custom Python-based MCP
servers and then use Claw Desktop as the
interface in order to execute your
Python scripts. Right? And now, why
would you bother watching this video and
learning this? Well, as a developer, I'm
sure you can relate to this. Whenever
you have to do something more than two
or three times, your engineering brain
kicks in and you're like, I can automate
this. But then, what ends up happening
is that you spend more time automating
the task than it would ever take you to
do that manually. With this setup, it's
so easy to create automations because
you don't have to worry about chron
jobs, UIs, or your deployments at all
because that's usually where the task
you thought would take 5 minutes to
automate now turns into two days. With
this approach, we can just simply run it
from cloud. All right, so let's dive
straight in and I'm going to walk you
through this step by step. If you're
completely new to building with MCP, I
recommend going through this crash
course for Python developers first. That
will explain all the basics. So that in
this video we can go pretty fast. So in
order to follow along you need Python UV
and cloud desktop and optionally cloud
code because that's where you can
integrate this as well. So everything is
here in the GitHub repository but I'm
going to walk through this like step by
step so you'll learn how to pretty much
do this on your own. Whenever you get a
new idea, it was like look I want to
build an MCP server for this. These are
the exact steps that you need to follow.
So I'm going to set up a project. So I
have a folder over here called MCP
server. So create this somewhere on your
machine. And then I'm going to open up a
new terminal session in here. And what I
can do, I can do a UV init. This is how
I would set up a project. So we can use
UV for that. Super convenient. Then we
go in here. So we go into the YouTube
folder and I'm going to open up in
cursor. So now we've created a project a
placeholder where we can implement the
specific YouTube MCP server that we want
to build and then I'm going to set up
the project structure which you can see
over here. So this is the layout that we
got going on. So what I'm going to do is
I'm going to take that main.py uh we can
pretty much leave that empty and I'm
going to rename that into server.py Pi
and then I'm going to create a source
folder where we're going to actually
implement the logic and the tools that
we want to use. So in here I'm going to
create a surface file that's going to be
a class that will host all of our
functionality in this case around the
YouTube transcript API. And then let's
see for this file or for this example we
also need a utils folder. Perfect. Now
then I'm also going to create a virtual
environment in here. So I do UV fenth
and then we're going to add the
following library. So we'll do python.
We'll do the mcp cli between quotes and
then we'll do the YouTube transcript
API. So we're going to add this to our
project. Make sure we have everything up
and running like this. And then let's
see. I'm going to add one more thing.
This is optional. You don't need this.
Let's do uv at ip kernel d-deaf to add
ipi kernel as a defaf dependency. So we
can run this in an interactive session.
And then next we want to quickly set up
the file. So you can simply copy paste
it from the cookbook or you can clone
the repository. But make sure that you
have the server set up over here. You
have the surface file, the utils and the
test.py. So this is simply like syncing
your repo. Make sure that we're on the
same page and then we'll continue with
the examples. So in the codebase we have
a very simple server setup with one
tool. If you're new to this you should
watch the crash course. Then we have a
test.py file where we can test our
function to get a transcript. Then we
have our service function which is
simply a wrapper around the YouTube
transcript API. This is a library that
we can install. We can leverage that.
And then there's a final util function
in here that can extract a video ID from
a URL. Right? So it's a very basic setup
and like I've said it's not so much
about these specific code examples in
there but it's about the patterns that
you use. creating a server and then
creating the tools and the functions
around that. And in this case, it's a
YouTube transcript API because it's a
use case that I personally find very
interesting to have in claude to be able
to ask summaries. But you can translate
this to any automation problem you can
imagine. All right. So with this setup
completed and a highle idea of what it
does, let's now actually test it to get
a feel for the outputs. So if I come to
the test.py, I can run this. I will do
this in the interactive session. We can
just as well do this in the terminal.
And then you can see these lyrics might
be familiar to you. We just got Rick
Rolled. And funny story here, this
actually happened when I was creating
this tutorial. I was creating this
test.py file over here and I was doing
like get uh the transcript and then you
can see how cursor does this
autocomplete, right? So I was like, "Oh,
sure. It doesn't matter. Let's get any
YouTube video." So yeah, I just got Rick
rolled by AI. I'm not sure how I feel
about that. Okay, awesome. So this now
works. So let's quickly zoom out a
little bit to showcase what we've done
here. Right? So we can test this
function here in test.py. And if you
follow the imports, this goes back to
the server. This goes back to this very
simple function that we have registered
as a tool in here. Again, this is all in
the MCP crash course registering tools.
And here we simply just use the surface
that we created and we call get
transcript. That's all this tool simply
does. And then the YouTube transcript
surface is just a wrapper around the
YouTube transcripts API. All right, so
that's how we set up a project, create
the surfer, and then add tools to it.
And the tools are Python functions. And
these can be as simple as a print
statement and as complex as triggering
an entire data pipeline or workflow and
waiting for the results and processing
them. That's the nice thing about this
approach. That's really the beauty in
here that we have this entry point where
we can pretty much automate anything
just by creating functions and services
around it. All right. So now with our
server created, we can run a test over
here. So we can run the server locally
and we can do that in the terminal and
we can run the command mcp
defaf and then we do server.py.
So we can run this. The first time you
do this, it will in ask you to install
the mcp inspector. So you just hit y on
your keyboard and then press enter. And
this is a very nice and convenient tool
also covered in the crash course. But
what we can do in here is we can
connect. And now we can go to tools and
you can list the tools. And now you can
see we have the get transcript function
in here. So this is a very convenient
way to test our MCP server before
plugging it into something like claw
desktop. So then next what you have to
do is here you can see the actual tool
itself and it you can see that it takes
the video URL or ID. So I'm going to
plug in this video which is my latest
YouTube video which is an AI engineering
road map. So, let's plug that in here.
And then I'm going to click run tool.
And if you scroll down, you'll see the
entire transcript over here. So, let me
give you the road map. Yeah, that's
that's the right video. And since you're
still watching this video, can you do me
a quick favor and hit that like button
below this video and also subscribe?
That would be much appreciated. So, now
we validated that we can run this inside
our test.py file. But we can also do it
in the MCP inspector, which is pretty
much the final test to say, look, okay,
now this is kind of like MCP ready. And
we can continue to implement this. So
coming back to the guide, there's one
optional thing that you can do here and
that is you if you seriously want to use
this, you can update these environment
variables and get a web share account.
So you can create a proxy. So if you use
this a lot, YouTube might ban you be or
ban you block your IP temporarily. Uh
it's nothing that bad, but we're using
YouTube's internal API to get the
transcript and for scraping purposes,
they will block this. So this is very
optional. You can get an account there.
Just plug it in as environment variables
and then you can do this. But if you
simply if you're simply follow along
with testing, you don't need to do this.
Okay. So now our application is ready to
connect to cloud desktop. So open up
cloud desktop, go to settings, then go
to developer, and then click on edit
config over here. This is going to show
your claw desktop config.json.
If you open this up, you can open this
in any text editor. So I have it opened
over here right now. And now we can
configure our MCP server. And the way
you do this, coming back over here, is
by using this command. And this is
actually something that took me quite
some time to figure out how to correctly
do this with UV because there is an
interesting thing that um you can do
here. And I will explain that in a bit.
But for now, all we need to do is we
need to take this absolute path over
here and we need to link that to where
our server.py is actually located. So if
you go over here, server.py, Pi you can
take this and you can go click on here
and you can say copy path. So you can
plug this in here and then you just need
to get rid of the server. So we have the
actual folder that it's in right now. So
you see this is under user and then you
can see the entire path and this is now
how we can instruct our MCP server to
say look this is the name it's called
YouTube. We run it with UV and these are
the arguments that you need to run. So
whenever our MCP server is accessed, it
will change to the directory and it will
run server.py. Now the cool thing about
using UV for this is that if we set up
our project correctly, which you may
have seen already, we don't have to
worry about creating virtual
environments and installing packages. UV
will handle all of that for us. And that
is by coming back over here. You see
this script over here? UV has a feature
where if you define the dependencies at
the top of a Python file like this in
this specific syntax with the slashes uh
forward and backward over here, whenever
UV enters this file and it will run it,
it will like on the fly create an
environment and install these
dependencies. And that's what's actually
a super great hack for working with MCP
servers and setting this up quickly
because otherwise these commands can get
really tricky over here to manage
correctly. All right. So that what you
then need to do is you can save this and
then close this out. Now we need to
restart claw desktop. So close it out
and open it up again. And now if we go
back to the settings again, go to
developer, you should see your YouTube
MCP server and it should say running. If
it says failed over here, you've you've
missed you've missed this step. So now
what we can do, and this is where it
gets super cool. Now if you go to a new
chat in CLA and for example, you can
pick a very fast model. Doesn't even
matter which one. You can click on the
tools over here and you should see that
your YouTube MCP server is connected. So
you can see it over here. This should be
connected. So now Claude has access to
that MCP server and anytime you mention
something about doing something with
YouTube summarizing or using a
transcript it will use this tool. Let me
give you an example. So it will ask can
you summarize this video. So what it
will do right now it will load the tools
and then we'll say look claude wants to
use the get transcript from YouTube. You
can say allow once or always allow. So
I'll just hit enter or click that for
now. And beautiful, it is now creating
the summary for us based on the YouTube
transcript. All right. So this is
already so cool, right? Because now as a
developer, you first of all, you don't
have to worry about deployments because
everything is locally. You also don't
have to worry about okay, where was this
script stored and how do I run it and
what parameters do I need to plug in
there? Because I'm I'm aware you can
also like run everything via the
terminal and do it like this. But the
nice thing about this is that that we
can leverage tools like clot and use
natural language. So we don't have to
remember all of that stuff and you can
now start to kind of like audit
everything you do on a day-to-day basis.
And whenever you feel like look this
this can be a quick little automation.
You can literally do it in a couple of
minutes and you can set it up. And
typically the logic itself to create an
automation is usually not that hard but
it's everything around that. deploying
it, configuring the arguments and then
remembering where it was, managing
dependencies. Right now it's here and
because it's already in the context of
cloud right now we have this basic
summary but we can also continue to ask
questions around this. So we can for
example ask like help me create a
learning plan for this. So it will go
off and do this. This is like context
that is now available within clot. And
the cool thing is that we can also start
to chain MCP servers together. So this
is just like one example but this is
just a starting point. You can take any
task really that you can automate and
build MCP servers around it and all
access it through this unified
interface. And now let's take this a
step further and connect it to cloud
code where we can use the same
functionality but then also immediately
create files on our system. So let's say
you create a new repository where you
want to store all of your notes. So you
want to create summaries and then you
also want to store them. What we can do
in here is we can open up a new terminal
and when cloud code is installed we can
also add MCP servers to that. The way
you do that is by using the following
command. So again the only thing that
you need to do is you need to change the
absolute path to your directory. And
then when you run that after that you
can do cloud MCP list and you can find
that the YouTube MCP server is now
connected. So now what I can do is I can
just start a new cloud code session and
I can say help me summarize this video
and create a report in markdown. So now
what you should find is look now Claude
code will figure out look I'm going to
summarize this. So now you can see it's
getting the transcript from the YouTube
video using our own MCP server. All
right. So here it is and it asks like
hey do you want to make this edit? There
we go. So now we should get this
markdown file. Now if we get rid of this
here you can now see we have a full
markdown file of everything that's in
here. So even if you don't like using
claw desktop for example, you can still
do this straight from the terminal and
just have a terminal tab open and
whenever you have a task in mind that
you want to do whether that's getting a
transcript or something completely else
that you want to do, you just type it in
the terminal in cloud code and cloud
code will then figure out what to do,
which parameters to plug in and how to
get the information in there. And now
the thing is this is just a simple
example of something that I personally
find useful and I think you'll like this
too. But this pattern generalizes to
countless small but effective like
development automations that we as
developers can do with the power of
Python. And now beyond just using these
MCP servers yourself to automate your
own work where I see a lot of untapped
potential right now as an entrepreneur
is actually selling this B2B because
let's face it so many people are already
using ChatGpt and Claude. They are
familiar with that environment but
they're hitting the limits the
integration limits. Now this is where
MCP servers come in and there are all
already so many MCP servers out there
but the general employee or business
owner has no idea how to integrate that.
Now that is where you can come in as a
developer and then help them. So you can
use off-the-shelf MCP layers but also
more importantly connect them with the
custom ones that I've just showed you
how to build and then make them specific
for the business that you're dealing
with. So you can automate entire
workflows that the employees themselves
can use from tools they're already
familiar with. And in this case, you
also don't have to worry about doing
entire complex deployments which have a
very high failure rate if you if you
look at the industry reports. So in my
opinion, this is such a good opportunity
as a developer to start a side hustle or
to start freelancing by helping
businesses implement MCP servers like
this. If you're interested in that and
want to learn how to find those clients,
you can check out the link in the
description. All right, and that's it
for this one. And I hope you found it
helpful. If so, please leave a like and
also hit that subscribe button. And then
next, I will show a video up here, right
here, that I think you'll like. So, go
watch this video right now to continue
learning AI.
Want to start freelancing? Let me help: https://go.datalumina.com/Geoociv Want to learn real AI Engineering? Go here: https://go.datalumina.com/ZtGE6rl 💼 Need help with a project? Work with me: https://go.datalumina.com/TMGbUvO 🔗 GitHub Repository https://github.com/daveebbelaar/ai-cookbook/tree/main/mcp/servers/youtube MCP Crash Course: https://youtu.be/5xqFjh56AwM ⏱️ Timestamps 00:00 Introduction to Custom MCP Servers 01:04 Setting Up Your Project Structure 03:43 Testing Your MCP Server 07:41 Connecting to Cloud Desktop 12:06 Integrating with Claude Code 13:40 Automating Workflows with MCP Servers 14:28 Opportunities in B2B Automation 📌 Description Learn how to build a custom Python MCP server and connect it to Claude Desktop for seamless automation. This tutorial shows how to use uv to manage dependencies and run local tasks with FastMCP. Perfect for developers who want to automate anything in Python without complex deployments. 👋🏻 About Me Hi! I'm Dave, AI Engineer and founder of Datalumina®. On this channel, I share practical tutorials that teach developers how to build production-ready AI systems that actually work in the real world. Beyond these tutorials, I also help people start successful freelancing careers. Check out the links above to learn more!