WEBVTT

00:00.160 --> 00:07.840
And welcome to week six, day two, the day in which we get to build our own MCP client and MCP server.

00:08.040 --> 00:11.480
MCP being the USB-C for I.

00:12.360 --> 00:17.680
And I've just realized this picture actually shows USB a for for I, I imagine a bunch of people are

00:17.680 --> 00:20.360
going to point this out to me from the last time I showed this picture.

00:20.600 --> 00:21.200
Sorry about that.

00:21.200 --> 00:28.280
But, you know, it's it's this this picture is showing what what it could be without having MCP, which

00:28.280 --> 00:30.960
is of course our USB-C for I.

00:31.480 --> 00:34.280
Anyways, moving on, let's get to it.

00:34.320 --> 00:39.920
As usual with these new things, I like to bring up the same material a couple of times to really drive

00:39.960 --> 00:40.960
the point home.

00:41.160 --> 00:48.640
The three pieces of the puzzle of MCP the host, which is the app like Cloud Desktop or our own agent

00:48.680 --> 00:55.200
platform, the MCP client, which is inside the host, and there's an MCP client for every MCP server.

00:55.480 --> 01:03.920
And the MCP server is one particular grouping of tools, contexts and prompts made by somebody that

01:04.020 --> 01:05.580
we can reuse.

01:05.820 --> 01:12.420
And I gave the example there of using fetch as a way of running a headless browser.

01:12.900 --> 01:13.340
Okay.

01:13.380 --> 01:15.460
And then also a reminder the architecture.

01:15.460 --> 01:19.180
This is a more busy diagram, but hopefully one that's quite familiar to you now.

01:19.460 --> 01:23.780
So the host the blue box there runs a number of MCP clients.

01:23.900 --> 01:27.020
And I talked about the three different approaches.

01:27.180 --> 01:34.940
The first of them that that first yellow box is where an MCP client talks to an MCP server that is running

01:35.140 --> 01:41.380
locally on that box, although in a different process that was typically sort of spawned by the MCP

01:41.380 --> 01:42.140
client.

01:42.140 --> 01:46.020
And they connect over standard input and output for that process.

01:46.060 --> 01:49.980
And it's known as a studio or stdio connection.

01:50.660 --> 01:54.140
And the second yellow box is very similar.

01:54.140 --> 01:59.020
Another MCP client running in the host connecting to an MCP server in a different process on the same

01:59.020 --> 01:59.500
box.

01:59.500 --> 02:04.820
But it's just to show that there will frequently be cases where that MCP server is in fact connecting

02:04.860 --> 02:07.550
to a to a remote server to carry out an API.

02:07.790 --> 02:10.710
Just that's how that's what the code does in that MCP.

02:10.750 --> 02:11.070
Server.

02:11.070 --> 02:13.790
Maybe it calls out to Google's weather API.

02:13.830 --> 02:15.470
Maybe it calls out to slack.

02:15.630 --> 02:18.830
Whatever it's doing, it happens to have an internet connection.

02:18.830 --> 02:20.510
So basically the two.

02:20.550 --> 02:23.150
First two orange boxes are basically the same thing.

02:23.150 --> 02:24.150
Just one of them happens to.

02:24.190 --> 02:25.110
Use the internet.

02:25.590 --> 02:28.270
But the third yellow box is a different architecture.

02:28.270 --> 02:34.950
And this is where you have an MCP client that's calling out to an MCP server running remotely.

02:34.950 --> 02:39.350
And there you would have to use the SSE type of transport.

02:39.550 --> 02:47.350
The server side events, which allows for it would do an HTTP push sorry post to send the message out,

02:47.390 --> 02:53.670
and then it would receive back the information streamed back using the SSE approach.

02:53.870 --> 03:00.590
And this is less common generally in MCP land, at least as of now, it's not so common, but we we

03:00.590 --> 03:01.870
will look at it at one point.

03:01.870 --> 03:07.830
But but most of the time you're running the servers locally and with apologies for the repetition.

03:07.830 --> 03:11.690
But you know, sometimes it helps to repeat just just like him prompting.

03:11.890 --> 03:14.650
It helps to repeat that when you're explaining things as well.

03:14.890 --> 03:21.090
But with that, what we're doing today is mostly making an MCP server, and we'll also make an MCP client.

03:21.090 --> 03:24.210
But that's a little bit of a of a red herring, as I'll explain.

03:24.210 --> 03:27.010
But this is mostly what we're going to be doing making an MCP server.

03:27.010 --> 03:28.850
And the question is why does one do that?

03:28.890 --> 03:31.330
Why do you create an MCP server?

03:31.330 --> 03:34.090
And the main reason you do it is for sharing.

03:34.210 --> 03:39.490
You're doing it because you're going to publish your MCP server somewhere and allow other people to

03:39.530 --> 03:42.370
incorporate your tools and resources.

03:42.370 --> 03:43.370
And maybe prompts.

03:43.890 --> 03:48.930
Less seems less common, but your tools mostly are in their projects.

03:49.250 --> 03:50.450
That is the reason.

03:50.490 --> 03:52.810
The primary reason for making MCP server.

03:53.050 --> 03:57.930
Also, if in your project you're using a bunch of MCP servers yourself that you're sharing, maybe you'd

03:57.930 --> 04:04.050
like to be consistent in terms of how you arm your LM, so you'd like to have your own MCP server to

04:04.090 --> 04:05.770
combine it with all of the others.

04:06.170 --> 04:10.610
And it's also worth doing it as an exercise to understand what happens behind the scenes.

04:10.610 --> 04:16.740
Building our own will help to reveal the the bits and pieces that make up MCP servers.

04:17.380 --> 04:22.220
But there are some reasons not to make an MCP server, and there's really just one of them I wanted

04:22.220 --> 04:28.020
to highlight, which is that, I mean, look, if we're making this just for our own project, for our

04:28.020 --> 04:35.580
own purposes, so we've got some tools and we would like to use them with our LLM then remember, like,

04:35.620 --> 04:39.420
it's actually really easy these days just to make a function into a tool.

04:39.460 --> 04:43.860
Back in the day, you needed to have all of that stuff around turning that that JSON gumph.

04:44.060 --> 04:49.700
But these days, if you're using open AI agents SDK, you're just putting an app function tool decorator

04:49.700 --> 04:52.380
over your function and then it's becoming a function tool.

04:52.420 --> 04:53.340
It's a tool right away.

04:53.340 --> 04:56.420
You can just pass that in as a tool into the agent.

04:56.620 --> 04:58.860
So it is quite easy to do this.

04:58.900 --> 05:02.900
And this is certainly something that is worth keeping in mind.

05:03.420 --> 05:10.260
It's not particularly worth building an MCP server just if it's only for your own personal use internally.

05:10.500 --> 05:13.980
Uh, and you might as well just just use a function tool decorator.

05:13.980 --> 05:17.180
So keep that keep that context in mind as we launch into this.
