0:00 in this video I'm going to show you how
0:01 to build a custom MCP server in Python
0:04 and connect that to an AI agent this is
0:07 going to be very beginner friendly but
0:08 it's going to illustrate what an MCP
0:10 server actually is and how you make your
0:12 own and how you can extend this to do
0:14 some really cool stuff now excuse the
0:16 shirt i don't usually wear a tank top
0:17 when I'm recording videos but it is
0:19 extremely hot here so please don't get
0:21 too distracted and let's get into the
0:22 video all right so first things first if
0:24 you don't understand MCP servers yet I
0:27 made a video on them that's been doing
0:29 really well in the past few days
0:30 explaining exactly what they are there's
0:32 some diagrams i show you how to connect
0:34 it to AI code editors for example like
0:36 cursor but the quick gist is that an MCP
0:39 server just provides various tools or
0:41 resources to something like an AI agent
0:44 so that it can utilize additional
0:45 context or it can call an API or it can
0:48 save a node or connect to a database it
0:50 can do things outside of its current
0:52 abilities so here I'm going to show you
0:54 how to make your own MCP server so that
0:56 you can write your own tools that you
0:58 provide to AI agents it could be other
1:00 AI agents or your own AI agents it
1:02 doesn't really matter and MCP servers
1:04 are just kind of the new fancy term for
1:06 essentially how LLMs and AI tools
1:09 communicate with each other okay so
1:11 let's get into it here i'll link this
1:12 video in the description in case you
1:13 want more information now we're going to
1:15 be using the MCP Python SDK which makes
1:18 this very easy to do and there are a few
1:20 setup steps so we're going to be using
1:22 UV so first thing you need to do if you
1:24 don't have this installed is install UV
1:27 this is a package manager that's just
1:29 significantly better than pip i'll have
1:30 a video coming out about this in a few
1:32 days that will talk about it more in
1:33 depth but anyways if you're on Windows
1:35 you're going to want to copy this first
1:36 command into PowerShell it will install
1:39 UV for you and if you're on Mac or Linux
1:41 you can copy any of these commands and
1:43 again install UV now you can install
1:46 this using Pi or PIP but I don't
1:48 recommend that you do that because it's
1:50 going to make it a lot more complicated
1:51 later in the video okay beyond that I am
1:54 going to suggest that you download
1:55 Claude Desktop this is free and it's
1:57 going to be one of the easiest ways to
1:59 test our MCP server so please just
2:01 download this cuz I'm going to show you
2:02 how to add your MCP server to Claude
2:04 Desktop so you can actually see an LLM
2:07 interacting with it and using those
2:08 various tools okay so once we have UV
2:11 installed we're just going to follow the
2:13 instructions here from the readme of the
2:16 uh MCP Python SDK and what we need to do
2:19 is initialize a new UV project so I'm
2:21 going to put this on the right hand side
2:22 of my screen and I'm going to open up
2:24 the code editor that I'll be using for
2:25 this video which is PyCharm now you may
2:27 be wondering why am I using PyCharm this
2:30 really is just the best IDE to be using
2:32 it has tons of tools built in makes it
2:34 really easy to work with Python code
2:36 view the documentation especially if
2:38 you're working with things like servers
2:39 or APIs it has a built-in network tabs
2:42 you can directly test them there and a
2:43 ton of other great features i also do
2:46 have a long-term partnership with
2:47 PyCharm where I'm able to give you
2:48 access to a 3month free extended trial
2:51 of their PyCharm Pro subscription you
2:54 can get access to that with the details
2:56 that are in the description check it out
2:58 see if you like it and obviously for
2:59 this video you can use anything that you
3:01 want but I do recommend PyCharm but the
3:03 first step is to just open some kind of
3:05 folder in whatever code editor you want
3:07 to use okay so I'm using PyCharm and
3:09 I've opened a folder called MCP server
3:12 tutorial to open that you typically are
3:13 going to go to the file menu you're
3:15 going to go to open you can make a new
3:17 folder or you can open an existing one
3:19 and I suggest you just make a new folder
3:20 and then open that okay so from here I'm
3:23 going to open up my terminal in my
3:24 terminal I'm in the current directory
3:26 where I want to initialize this project
3:28 and because I've already installed UV
3:30 and let me just quickly zoom in here so
3:32 you guys can actually see this i'm going
3:34 to type UV init and then dot when I do
3:36 the dot this means initialize a new UV
3:39 project in the current directory okay so
3:41 we have UVIT dot so that's kind of what
3:43 this wanted us to do here and next we
3:46 need to install the dependencies and the
3:47 dependency is going to be MCP and then
3:49 CLI so we're simply going to go here and
3:52 say UV add MCP CLI okay that's going to
3:55 install it instantly using UV and if we
3:58 look here at our directory we should see
4:00 a few files we have a uh venv this is
4:03 our virtual environment we have main.py
4:06 we have this readme we have all of these
4:08 things all right so that's installed now
4:10 the next step here is going to be to
4:11 open this main.py file if you don't have
4:14 the file again you can create one uh
4:16 don't worry about the interpreter i'm
4:17 going to fix that here in 1 second and
4:19 then we're going to start writing a
4:20 simple MCP server we're going to test it
4:22 and then we will adapt this to be
4:24 something a little bit more custom all
4:25 right all right so to get started here
4:27 we can literally just copy the code from
4:28 the quick start guide here again I'm
4:30 going to link this GitHub in the
4:31 description and you can see here that
4:33 what we do is we say from
4:36 mcp.server.fastmcp we have fastmcp we
4:39 create an MCP server we give this a name
4:41 in this case it's called demo then we
4:44 create a tool and then we have a
4:46 resource now I'm going to talk about
4:47 what these are in one second but this is
4:49 literally all you need in order to get
4:51 started with the MCP server and the next
4:53 step is to actually install this or use
4:56 it from some LLM or some AI tool so
4:58 again I literally just copied this from
5:00 the quick start but I'm going to show
5:01 you now how we install this into Claw
5:03 Desktop so we can start testing it and
5:05 then we'll change this to a more custom
5:06 example now look we have a tool okay we
5:09 have a tool that allows us to add two
5:10 numbers obviously that's pretty naive
5:12 and then we have a greeting okay or a
5:14 resource and we can greet someone based
5:16 on their name so in order to install
5:18 this we can do it manually or we can use
5:20 the MCP CLI that we just installed so
5:23 I'm going to open up my terminal again
5:24 make sure you're in the same directory
5:26 of your UV project and what you can type
5:28 is uvun and then mcp install and then
5:33 the name of your Python file and in this
5:35 case it's not server.py it's main.py
5:38 because that's what I named the file
5:40 okay so I'm going to go with
5:41 main.py now when I do that what it
5:44 should do is add this configuration to
5:46 our Claude desktop i'm going to show you
5:48 how we get that configuration and then
5:50 how we check if this is working okay so
5:52 now that we've done that we're going to
5:53 open up Claude now obviously that step
5:56 only works if you have Claude desktop
5:57 installed you don't need to use Claude
5:59 desktop but this is a good demo for this
6:01 video so we're going to open this up
6:03 here and what we can do if we want to
6:05 check the configuration is we can go
6:07 here to the three kind of uh what do you
6:10 call it bars or the menu we can go to
6:12 file and we can go to settings i'll have
6:14 my editor zoom in here so you guys can
6:15 see this from settings we're going to go
6:18 to developer and we're going to go here
6:20 to edit config okay now from edit config
6:23 it's likely going to open up some
6:25 directory for you what you're going to
6:26 want to do is open up this claw desktop
6:28 configuration file okay so I'm going to
6:31 open this up just in Sublime Text but
6:33 you can open this in anything that you
6:35 want and you're going to see that you
6:36 have some command and then you have some
6:39 arguments now what this is saying is hey
6:41 we're going to use UV the thing that you
6:42 just installed we're going to run it
6:44 with this MCP CLI and then we're going
6:46 to run the command MCP run and then this
6:49 server right here now once that's
6:52 running within Claude we should actually
6:54 be able to see this however there's some
6:57 common errors that can occur that I'm
6:58 going to show you how to get over so
7:00 really this configuration is added and
7:02 we should be able to see the MCP server
7:04 but the MCP server should show up right
7:06 here and we're not seeing it right now
7:08 now I ran into a bunch of issues with
7:10 this when I was testing and I found a
7:12 few potential fixes the first fix is
7:14 just to shut down claw desktop
7:16 completely so force quit it from your
7:18 task manager or your process list and
7:20 then reopen it so let's try that and see
7:22 if it works if it doesn't I'm going to
7:23 show you the alternative solution so I
7:25 just opened my task manager here and I'm
7:27 just going to shut down Claude desktop
7:29 okay so I'm going to end the task and
7:30 then I'm just going to wait a second and
7:32 I'm going to reopen it okay so we're
7:33 going to reopen Claude now we're hoping
7:36 that once this loads it's going to spin
7:37 up our MCP server and it looks like it
7:40 actually did so you see here now that we
7:41 have a hammer and that we have I guess
7:43 this kind of like plug here where we can
7:45 attach something from the MCP now that's
7:46 not going to work right now but we can
7:48 go to available MCP tools and we can see
7:50 that we have this add tool from the
7:52 server demo and it says it adds two
7:55 numbers so now what I can do is I can
7:57 use say something like can you add 1 + 7
8:02 and it should go ahead and use this MCP
8:04 tool this one right here that's
8:06 available okay let's see if it does that
8:08 you can see that it says running ad from
8:10 demo and we're going to say yes we will
8:12 allow this for this chat it's using the
8:14 parameter A and B and then it gets the
8:16 result which is eight okay this is a
8:18 very very simple demo of using the MCP
8:21 server but the point is if it doesn't
8:22 work restart it now if that's still not
8:25 working for you another way to fix this
8:26 is to put the absolute path to where UV
8:29 is installed now the absolute path for
8:31 where UV is installed will depend on
8:33 your operating system and how you
8:35 installed it but I'm going to show you
8:36 how you can find it so you can go to
8:38 your terminal and you can type which if
8:41 you're on Mac or Linux and then UV when
8:43 you do that it should show you the
8:45 location of where this was installed and
8:47 then what you can do is put the absolute
8:49 location to this UV file now in my case
8:52 I can also type where UV and notice it's
8:55 not showing me where this exists i can
8:57 try something like where UV.exe exe and
8:59 it's still not showing it to me so what
9:01 I had to do is look up the default
9:03 installation location and I found that
9:05 the location for this was the following
9:07 i'm just going to open it up right now
9:08 okay so again we'll zoom in here but the
9:10 default location on Windows if you
9:12 install this with the PowerShell command
9:14 is going to be C/ user/ the name of your
9:17 user in my case I called mine user kind
9:19 of silly but this would be like Tim or
9:21 Joe or like whatever your current user
9:23 is on Windows and then dot /local and
9:25 then /bin inside of here you have the UV
9:28 directory so what you could do if this
9:30 command wasn't working is you would
9:32 change the configuration here to be the
9:34 following you would put your directory
9:35 you would escape these with two
9:37 backslashes because that's just how it
9:39 works here in Windows and then you would
9:41 do
9:43 /uv.exe so you're pointing directly to
9:45 this UV executable so that you can
9:47 actually use it again same thing on Mac
9:49 you put the absolute location to the UV
9:51 executable file it won't be.exe it will
9:54 probably just be UV or UV.sh SH or
9:56 something along those lines now clearly
9:58 I don't need that because this is
9:59 working so I will just leave it as UV
10:01 and you could add other servers here as
10:04 well using the same configuration that
10:05 you see like this where essentially what
10:07 happens is once Claude boots up it runs
10:10 this command runs the server it's then
10:12 able to connect to this using the
10:13 standard input output protocol we don't
10:15 need to talk about that in too much
10:16 depth and utilize your tools okay so now
10:19 that this is working we are going to
10:22 shut down claude again and we're going
10:24 to go into our editor and we're actually
10:25 going to write a useful MCP server and
10:28 to do that we're quickly going to cover
10:29 some of the important concepts related
10:31 to MCP servers that are here on this
10:33 page so what we can do with MCP servers
10:36 is we can expose data through resources
10:38 so think of like a get endpoint like a
10:40 HTTP get endpoint where you're exposing
10:42 like a database or some context or a
10:45 memory or whatever like just anything
10:48 that is essentially retrieving data okay
10:50 that's a resource that you can expose
10:53 via MCP another thing that you can do is
10:55 provide a tool now a tool is something
10:57 that typically does something maybe it
10:59 goes and scrapes the web or it adds a
11:01 new user it performs some operation and
11:04 again that's something that you know
11:05 these AI agents like to use a lot and
11:07 that you can provide with an MCP server
11:09 you also can provide a prompt so this is
11:11 a reusable template for interacting with
11:14 LLMs and I'm going to show you all of
11:16 those in this video and how they connect
11:17 with Claude so you can see for a
11:19 resource you do something like at
11:21 mcp.resource okay for a tool you do
11:24 mcp.tool and for a prompt you do
11:26 atmc.prompt you also can connect images
11:29 and context i'm not going to show that
11:31 right now uh but that is something that
11:33 you can't do okay cool so let's get out
11:36 of that let's go back into our editor
11:38 and let me show you a real tool that
11:40 might actually be useful or at least
11:42 demonstrates how you write this out all
11:44 right so I just cleared my file here so
11:45 we just have some basic code so we're
11:47 kind of just starting from scratch and
11:48 what I'm going to do is I'm just going
11:49 to call this AI sticky notes okay and
11:52 the idea is going to be that we're going
11:54 to allow the uh AI to kind of take some
11:57 notes and store that in some external
11:59 storage in this case we'll just use like
12:00 a notepad file and this will show us how
12:02 we can kind of like read and write and
12:04 get resources and utilize tools uh it'll
12:07 be interesting enough to at least give
12:08 you like the kind of starting template
12:10 for building your own MCP so what we're
12:13 going to do is we're going to go up here
12:14 and we're going to say import OS cuz
12:15 we're going to use this in 1 second and
12:17 we're going to define a variable called
12:19 notes file and we're going to make this
12:21 equal to just like
12:23 notes.txt okay you know this is going to
12:25 be where we are storing the notes that
12:28 the MCP server will actually have access
12:30 to now we're going to make a function
12:32 we're just going to say insure file and
12:34 all this is going to do is just make
12:36 sure that this file exists before we
12:38 start trying to use it so we're going to
12:40 say if not
12:41 os.path.exists and then the notes file
12:43 you can see my autocomplete is taking
12:45 over here then what I'm going to do is
12:46 I'm going to say with open notes uh file
12:50 wf i'll explain this in one second then
12:52 I'm going to say f.right Right and I'm
12:55 just going to write an empty uh line in
12:57 here like an empty string okay you don't
12:59 really need to do this but this is what
13:00 we're going to do so we're going to say
13:01 if not os.path.exists what this is doing
13:04 is saying all right does this file exist
13:06 if it does not exist then we're going to
13:07 use this fancy Python syntax which
13:09 essentially will open up a file for us
13:11 and make sure there's no errors doing
13:12 that this is going to create a new file
13:14 because we did this in W mode this means
13:16 it will create and override any file
13:18 that currently exists and then we just
13:20 write nothing into it just so that we
13:22 have something happening inside of this
13:24 width statement okay so we're going to
13:25 run that before we do any operation on
13:27 our file just to make sure the file is
13:29 indeed there now we're going to make an
13:31 MCP tool now to make an MCP tool is
13:34 super straightforward all you have to do
13:36 is type at MCP tool and then make sure
13:38 you close your parenthesis here and this
13:40 is what's called a decorator in Python
13:42 it's something that essentially modifies
13:44 a function you don't need to worry too
13:45 much about what that means then what we
13:48 can do is we can give the tool a name
13:50 and we do that by defining a function
13:52 with the name of the tool so in this
13:54 case we say define add note okay and now
13:58 we've just made a tool called add notes
14:01 that our LLM or that our AI agent would
14:03 be able to call now for this function
14:05 we're going to specify the parameters or
14:07 the values that the AI agent would pass
14:09 to it so for adding a note we probably
14:12 have like a message that we want the AI
14:14 agent to pass so we can specify as many
14:17 parameters as we want but we need to
14:19 make sure that we specify a type for
14:22 those parameters so the AI agent knows
14:24 how to pass them so we're going to say
14:26 message and then colon string and then
14:29 we're also going to specify the return
14:31 type of this function by using a type
14:33 hint in Python so we're going to use a
14:34 dash and then the greater than sign and
14:36 then string okay now what this
14:39 effectively says is hey we have this
14:40 function we take in some message this
14:42 will be given by the LLM or by the AI
14:45 agent it's going to return some string
14:48 and then inside of here we can start
14:50 writing out the actual function so the
14:52 first thing we're going to do is we're
14:53 going to say insure file so we're going
14:55 to make sure the file does exist then
14:56 we're going to say with open and same
14:58 thing we're going to open the notes file
15:01 we're going to open this in a mode which
15:03 stands for append mode which means we're
15:05 not going to override it but we're going
15:06 to write to the end and then we're going
15:08 to say f.right write and we're going to
15:11 write the message plus a new line
15:14 character this means we will go down to
15:15 the next line in the file after we write
15:17 the message and then we're just going to
15:20 return a string that says note saved
15:23 okay so just give the LLM some output
15:25 that this actually was successful now at
15:28 this point this tool is done if we go
15:30 back to Claude and we restart it we'll
15:32 be able to start using this tool and
15:34 adding a new note but there's one more
15:36 step that you don't want to forget now
15:38 that step is adding what's called a dock
15:41 string okay and you can see in PyCharm
15:42 here it automatically populated it again
15:44 another advantage of using something
15:45 like PyCharm now a dock string is
15:48 essentially a comment so you can see
15:50 that I've done three quotation marks
15:51 here that you put at the top of a
15:53 function that describes what the
15:55 function does the parameters that it
15:57 takes and the return type or what that
15:59 return value actually is now this is
16:02 super important because the MCP server
16:04 will be able to read this and see what
16:06 this tool actually does and if it should
16:09 be using it so sure you can give it a
16:11 descriptive name like add notes but if
16:13 you want to be more specific you put
16:15 that in the dock string and this will
16:16 really dictate how well your tools work
16:18 and how often they get called so I
16:20 actually have a dock string that I'm
16:22 just going to copy in here it doesn't
16:23 follow this exact format uh but that's
16:25 fine and you can see that it says append
16:27 a new note to a sticky note file
16:30 arguments message string this note uh
16:32 the note content to be added and it says
16:34 returns a string confirmation message
16:36 indicating the note was saved okay so
16:39 now we've documented this tool so that
16:41 the AI actually knows when to use it so
16:44 let's try to test this out now before we
16:46 move on to the next step so we're going
16:48 to open up Claude and I just want to go
16:51 back here to new chat i want to look
16:54 here and see what we have and it still
16:56 has ad right it's still running that old
16:58 MCP so what we need to do again is we
17:00 need to shut this down so we're going to
17:02 go to task manager we're going to search
17:04 for claude okay we're going to end the
17:07 task and then we're just going to wait a
17:09 second reboot it and it should now run
17:11 our new MCP server and that's because
17:14 it's kind of running in the background
17:15 so here now if we look at this you can
17:16 see that we have add note so for add
17:18 note I'm going to say can you add a
17:23 note saying Tim is the best okay and
17:27 let's see what it says
17:29 and it says I'll add that note for you
17:30 and then notice it's asking us to use
17:32 this tool so I'm going to allow that for
17:34 the chat this is the message okay I
17:36 saved the note and then we can see kind
17:38 of the result here it said note saved
17:40 and then if we come here to PyCharm we
17:42 actually don't see the notes.txt file
17:44 and the reason for that is that it's
17:46 saving relative to the location where
17:48 the UV command is running or at least
17:51 where uh the MCP or sorry Claude is
17:53 running our MCP server so that's
17:56 actually something good we need to
17:57 hardcode the path where we want to save
17:59 notes.txt because right now it's kind of
18:01 saving in like a random location that we
18:03 don't have access to which I just
18:04 realized when we were running this so
18:06 what I'm going to do is quickly change
18:07 this so it's going to be relative to
18:09 where this current file is so it saves
18:11 it in this directory so we'll be able to
18:13 access it later okay so I just adjusted
18:15 this here this should now make it so
18:17 that it's always going to save it in the
18:19 same directory uh where this current
18:21 main.py file is so we did os.path.join
18:24 we got the directory name of this file
18:26 so underscore
18:28 file and then we have
18:30 notes.txt now I'm not sure if that's
18:32 going to work right now we could close
18:33 this and rerun it but let's move on to
18:36 the next function then we can test it
18:37 out after that all right so I'm going to
18:38 do this one a little bit faster i'm
18:40 going to say mcp.tool and I want this
18:42 one to be one that can read a file so
18:44 I'm going to say define read notes okay
18:48 this is going to return a string i'm
18:50 just going to copy in the dock string
18:51 i'll put all this code in the
18:53 description i just want to save us a
18:54 little bit of time here then I'm going
18:55 to say with and I'm just going to go
18:57 with my autocomplete because now it's so
18:58 damn good with notes file we're going to
19:00 open this in R mode which stands for
19:02 reading so it's not going to modify the
19:04 file we're going to say content is equal
19:06 to F read and then dot strip this is
19:10 just going to remove any new line
19:12 characters or white spaces at the end
19:14 then we're going to say return content
19:17 or we're going to say no content or no
19:21 notes yet okay so that if we don't have
19:24 any content then we'll just return no
19:25 notes yet instead okay so now we have an
19:28 add note and a read note and I want to
19:30 move on and add a resource now to add
19:33 the resource we're going to say at MCP
19:34 and this time we're going to say
19:36 resource now the resource is different
19:38 it's not a tool it's more like just
19:40 reading information so in this case we
19:42 could do something like getting the most
19:43 recent note so to do that we're going to
19:45 call this notes colon slash and then
19:49 latest okay now there's ways to embed
19:53 dynamic variables inside of your
19:54 resource for example if I go back here
19:56 let me just bring this up uh and we look
19:59 at the resource let me find where the
20:01 resource is we should be able to see
20:04 here that you can do something like this
20:06 so you can say like users user
20:08 ID/profile and then you can see that you
20:10 can put a user ID as a parameter we
20:12 don't need to do that for our notes but
20:13 that is something you can do with the
20:14 resource wanted to mention that but here
20:17 we're just saying okay you can get the
20:19 notes latest resource that's how we're
20:21 referring to it then we're going to say
20:24 get latest note this is going to return
20:27 a string and for the latest note again
20:30 we're going to ensure the file we can
20:32 actually just copy this cuz it's going
20:33 to be the same thing and this time we're
20:35 going to get the read
20:37 lines okay we're going to call this
20:42 lines and then what we're going to do is
20:45 return lines
20:48 one strip if lines else we're going to
20:53 say no notes yet okay so what this is
20:57 saying is all right we're going to get
20:58 the most recent line or the last line
21:00 we're going to strip off any of the new
21:02 line or whitespace characters then we're
21:04 only going to do that if lines so if
21:06 this list actually has at least one
21:08 value so we don't get an index error
21:10 otherwise we're just going to say no
21:11 notes yet okay so that's a resource and
21:14 then lastly I'm going to bring in a
21:16 prompt so I'm going to say atmc.prompt
21:18 prompt for the prompt we're going to say
21:20 define and then this is going to be note
21:25 summary_prompt okay if we can spell this
21:29 correctly and then this is going to be
21:32 of type string and then inside of here
21:34 what we're going to do is we're actually
21:35 just going to give a prompt that will
21:36 summarize all of the notes that
21:38 currently exist because that's something
21:39 that we might want to do so I'm going to
21:40 say with open uh notes file r uh as f
21:44 I'm going to say content equals and
21:47 again f read.strip we should really put
21:49 that into a function because it's very
21:50 repetitive but for now that's fine we're
21:52 going to say if not content then we're
21:55 going to say return there are no notes
21:58 yet okay otherwise we can return an
22:02 fstring and this is going to say
22:05 summarize the current notes and then
22:08 inside of here we are going to put the
22:11 content okay so this is just a reusable
22:14 prompt uh that again we can pull in from
22:15 the MCP server now for both of these
22:17 again I'm just going to copy in from my
22:19 other monitor here a few of the doc
22:21 strings to make them a bit clear so
22:23 generate a prompt asking the AI to
22:24 summarize all the current notes okay and
22:26 then for the latest note same thing now
22:29 I know this example is quite simple but
22:30 you can imagine that if you had an
22:31 advanced prompt with multiple values and
22:33 variables and things that you could just
22:35 put that in this function and then you
22:36 can just keep reusing that prompt over
22:38 and over and over again and it can grab
22:40 external data if it needs to same thing
22:42 for the resource again quite simple but
22:44 if you had a resource like a large
22:46 database you want to run a SQL query all
22:48 the time or something you could put that
22:49 into a resource and then your AI agent
22:52 can continue to use that similarly to a
22:54 tool okay so that is our code for our
22:57 MCP server same thing again we need to
23:01 close down claude so let's close this
23:04 down i need to get this thing here and
23:07 press end task and then let's rerun it
23:10 and test this out and make sure that
23:12 it's all working okay so we can see now
23:14 we have two tools available add note and
23:16 read notes and we have this connection
23:18 and you can see that we can get the note
23:19 summary prompt or we can get notes
23:21 latest for example and we can bring that
23:23 in as kind of extra context to our
23:25 prompt so I can say you know what are
23:28 the notes or something and let's see
23:30 what it says says based on the
23:32 information there are no notes yet okay
23:34 totally fine and you can see here now in
23:36 PyCharm this notes file got created so
23:38 let's make a few notes so let's go make
23:42 10 notes on monkeys okay and let's see
23:47 if it uses our MCP server to do that so
23:49 let's go allow for this chat and it has
23:52 a message it's using the add note
23:53 function and it's just going to keep
23:54 doing this and you can see behind me
23:56 notes are getting populated in this
23:57 notes.txt file so let's wait for that to
23:59 finish and then we can use the other
24:00 tools all right so that is done now
24:02 let's try to use maybe our prompt so
24:04 let's go to uh here and let's go the
24:06 note summary prompt and let's just go
24:09 enter here and let's just use this
24:10 prompt and see I've shared document
24:12 called note summary prompt contain 10
24:14 monkey notes I just created for you
24:15 appears to asking for a summary of these
24:16 notes would you like me to create a
24:17 concise summary and I'm going to say yes
24:20 okay so run this prompt i'll summarize
24:22 the notes about the monkeys for you and
24:24 then you can see that it's running add
24:26 note okay that's interesting that's not
24:27 what I wanted it to do but what it did
24:29 is it actually added a note to my notes
24:31 file that contained the summary so
24:33 monkey summary uh interesting kind of
24:35 proves that I guess you know you need to
24:37 be a little bit more specific here but
24:38 let's say can you get the latest note uh
24:43 and let's see if it will do that for us
24:45 okay I'll retrieve the latest note it's
24:47 getting read note okay let's do this
24:50 and let's see okay it gets the notes and
24:52 it says monkey summary this is the
24:53 latest note blah blah blah okay you guys
24:55 get the idea you can mess around with
24:57 this obviously you don't need me just to
24:58 play with this you know stupid example
25:00 um in this video but the point of this
25:02 was to show you how to make a custom MCP
25:04 server in Python and hopefully not over
25:06 complicate the process in my opinion
25:09 this is so damn cool because the types
25:11 of things you can do with this are
25:12 really just endless like even right now
25:14 when I'm running this I'm imagining all
25:16 of the times in the past where I've
25:18 needed to like manually create fake data
25:20 and add that to my database now I could
25:22 have an MCP server i could connect that
25:24 to Claude i could say "Claude make 100
25:27 fake users for me." And it can just do
25:29 that in my database i don't need to like
25:31 manually copy and paste them or run some
25:33 custom script i just connect it to a
25:35 tool that goes and does whatever I need
25:37 now that's obviously a simple example
25:39 you can get crazy with this but think
25:41 about how cool these MCP servers
25:43 actually are and really what you can do
25:45 if you have a little bit of imagination
25:47 so I hope you guys enjoyed the video if
25:48 you did make sure to leave a like
25:49 subscribe to the channel and I will see
25:51 you in the next one
25:56 [Music]