WEBVTT

00:00.280 --> 00:05.640
And you should be starting to feel really quite knowledgeable about MCP and MCP servers as we head into

00:05.680 --> 00:10.200
day three of our journey with MCP in week six.

00:10.440 --> 00:13.440
And one more time, I'm going to throw up the architecture slide.

00:13.440 --> 00:15.760
At this point, it's probably familiar to you.

00:16.120 --> 00:21.760
It's showing the computer with its host, potentially multiple hosts, and the host, which is something

00:21.760 --> 00:28.440
like our agents application ourself contains MCP clients, each containing each connecting to an MCP

00:28.480 --> 00:29.120
server.

00:29.360 --> 00:32.240
And we're going to be looking at different MCP servers today.

00:32.240 --> 00:35.280
We're going to be bringing in a whole zoo of them.

00:35.520 --> 00:38.680
And there's going to be all three kinds.

00:38.680 --> 00:40.080
We'll look at the first kind.

00:40.080 --> 00:40.800
You'll remember.

00:40.840 --> 00:46.200
Perhaps the simplest is when you have an MCP client running on your host, connecting to an MCP server,

00:46.200 --> 00:53.280
running on your computer in a different process outside, typically connecting over stdio.

00:53.360 --> 00:59.000
It can also connect over SSH, but but it's more normal to use the standard input output into that process

00:59.000 --> 00:59.920
that is spawned.

01:00.280 --> 01:03.120
And then the second configuration is basically the same thing.

01:03.120 --> 01:07.840
But we're just saying that this would be an example of when you have a server which isn't doing all

01:07.880 --> 01:11.560
of its processing locally, it's calling out to the internet to do it.

01:11.560 --> 01:13.680
It's using a web service or something like that.

01:14.040 --> 01:21.240
And then the third configuration, not as common, is when we call out to a server running remotely,

01:21.280 --> 01:27.840
an MCP client running on your computer in its host calling out to a remote MCP server.

01:28.280 --> 01:31.600
Okay, so let's just go and do all three of them right away.

01:31.640 --> 01:33.040
And we're in cursor.

01:33.040 --> 01:36.160
We're going to the sixth directory MCP.

01:36.160 --> 01:38.320
And we're going to the third lab.

01:38.520 --> 01:39.080
Welcome.

01:39.080 --> 01:40.400
Week six day three.

01:40.800 --> 01:45.320
And we do some usual imports including loading dot env.

01:45.600 --> 01:46.280
All right.

01:46.320 --> 01:47.040
Type one.

01:47.240 --> 01:51.600
Type one is going to be the MCP server that runs locally.

01:51.600 --> 01:53.080
And everything is local.

01:53.080 --> 01:54.600
And we're going to use a cool one.

01:54.800 --> 01:58.400
It's a knowledge graph based memory.

01:58.400 --> 02:01.640
So it's something which remembers information.

02:01.800 --> 02:09.830
And it does so by storing entities observations about those entities and relationships between the entities.

02:10.030 --> 02:17.550
And it's an MCP server that provides a suite of tools that can be used by our server to achieve all

02:17.550 --> 02:18.630
of those things.

02:19.150 --> 02:27.390
So it's one of these it's it's the parameters is we're making the mpc's command to run a node and we're

02:27.390 --> 02:28.230
passing in.

02:28.430 --> 02:30.750
This is actually an official anthropic implementation.

02:30.750 --> 02:31.670
So it's from them.

02:31.710 --> 02:35.110
It's from a model context protocol themselves.

02:35.110 --> 02:37.350
And it's called server memory.

02:37.510 --> 02:39.750
And let's collect the tools.

02:39.750 --> 02:41.630
And as always it's just as simple as this.

02:41.630 --> 02:46.630
This is the beauty of MCP that just a couple of lines of code like that and we're connecting to a bunch

02:46.630 --> 02:47.350
of tools.

02:48.110 --> 02:50.510
And so there's one called create entities.

02:50.510 --> 02:56.030
Create new entities in the Knowledge Graph, create relations, add observations, delete entities,

02:56.030 --> 03:01.910
delete observations, delete relations, read graph search nodes, open nodes.

03:01.910 --> 03:04.350
So you get a sense of what this is about.

03:04.670 --> 03:05.030
Okay.

03:05.070 --> 03:06.990
So now we have some instructions.

03:07.670 --> 03:14.150
I'm saying use your entity tools as a persistent memory to store and recall information about your conversations.

03:14.150 --> 03:18.710
So you do have to give it that, that that prepping because we're just arming it with all these tools.

03:18.710 --> 03:21.670
We're not necessarily telling it what to use them for.

03:21.830 --> 03:27.910
And as they explain in the documentation, in your instructions, you need to make it clear how frequently

03:27.910 --> 03:33.470
you expect it to use its memory or give it some, some kind of context to work with in terms of how

03:33.470 --> 03:35.990
to relate what it has to do with these tools.

03:36.750 --> 03:39.990
So my request my name is Ed, I'm an LM engineer.

03:39.990 --> 03:46.150
I'm teaching a course about AI agents, including the incredible MCP protocol, and SAP is a protocol

03:46.150 --> 03:51.310
for connecting agents with tools, resources, and prompt templates and makes it easy to integrate AI

03:51.350 --> 03:53.710
agents with capabilities.

03:53.710 --> 04:01.310
That is some a request that we are going to make a prompt to this LM so let's do that.

04:01.350 --> 04:10.870
And this is the familiar code again so simple with we frame it with the with MCP service studio passing

04:10.870 --> 04:13.550
in the parameters to to associate with this.

04:13.950 --> 04:20.830
Um, and then we simply call our agent with the system prompt, with the model with the server that

04:20.830 --> 04:22.430
we've just created.

04:22.710 --> 04:27.230
And then we run it or run passing in this request, this, this prompt right here.

04:27.230 --> 04:28.830
So that is what I'm going to do right now.

04:28.830 --> 04:33.310
And that is running, doing its thing, thinking stuff is happening.

04:35.310 --> 04:36.550
Hopefully good stuff.

04:36.590 --> 04:37.550
It's certainly take its time.

04:37.550 --> 04:38.070
But there we go.

04:38.190 --> 04:41.470
Okay, I've noted your details and information about the MCP protocol.

04:41.470 --> 04:42.590
Here's what I've recorded.

04:42.870 --> 04:45.350
Uh, me the MCP protocol agents.

04:45.350 --> 04:47.510
And you can see it's got like observations.

04:47.830 --> 04:50.750
And if there's anything else you'd like to add or modify, let me know.

04:51.070 --> 04:52.030
So that's cool.

04:52.310 --> 04:55.470
Well, let's find out if it really has remembered any of this.

04:55.470 --> 05:00.910
So we are going to, uh, make make a we're going to pass in the same instructions, the same system

05:00.910 --> 05:02.830
prompt, this system prompt.

05:02.870 --> 05:04.950
There's nothing about me in that system prompt.

05:05.310 --> 05:08.550
And then as the user prompts, we're going to say, my name is Ed.

05:08.590 --> 05:09.670
What do you know about me?

05:10.190 --> 05:13.630
So we're calling the stateless GPT four mini.

05:13.670 --> 05:15.630
It doesn't have any other context about me.

05:15.870 --> 05:18.510
Let's see how it responds to that question.

05:20.350 --> 05:21.350
Here's what I know about you.

05:21.390 --> 05:21.590
Editor.

05:21.590 --> 05:22.710
You're an LM engineer.

05:22.750 --> 05:24.270
You teach a course about AI agents.

05:24.270 --> 05:26.350
You're involved with the MCP protocol.

05:26.950 --> 05:31.790
Additionally, you teach about AI agents, which are intelligent systems capable of performing tasks

05:31.790 --> 05:33.870
autonomously and utilized for enhanced functionality.

05:33.870 --> 05:34.350
There you go.

05:34.390 --> 05:35.790
It seems pretty decent to me.

05:36.110 --> 05:41.270
Uh, I guess you're involved with the MCP protocol as perhaps taking it a bit far, but never mind.

05:41.310 --> 05:42.550
We'll we'll give it.

05:42.590 --> 05:43.590
We'll give it that one.

05:43.790 --> 05:45.150
Uh, and, uh.

05:45.350 --> 05:45.630
Yeah.

05:45.670 --> 05:47.950
Have a, have a, uh, hopefully you're playing with this yourself.

05:47.990 --> 05:49.390
Have an experiment with it.

05:49.550 --> 05:51.310
Uh, and we'll look at the trace in a sec.

05:51.550 --> 05:56.070
And just before we look at the trace, let's just look at the documentation for a second for this,

05:56.110 --> 05:57.870
which is right here.

05:58.110 --> 06:04.470
Uh, so this, uh, describes using the graph, uh, memory server tells you about the concepts, what

06:04.470 --> 06:05.910
to do, how to use it.

06:06.030 --> 06:12.390
Uh, the fact that that it stores relations and observations in addition to entities and how that works.

06:12.390 --> 06:14.470
So it's interesting to read through that.

06:14.470 --> 06:15.470
So take a look.

06:15.790 --> 06:19.940
Uh, and then we will now look at our trace.

06:20.460 --> 06:22.180
Uh, where is that now?

06:22.180 --> 06:22.780
Here we go.

06:22.820 --> 06:23.980
Look at the trace.

06:23.980 --> 06:28.260
So this is again going into platform Openai.com traces.

06:28.540 --> 06:30.660
And this is the conversation right here.

06:31.020 --> 06:35.100
So you can see that it, uh, it called search nodes.

06:35.100 --> 06:40.700
This is for the um, the, the second, the second call to, to read in its memory.

06:40.820 --> 06:46.540
And you can see that it read in some observations that I'm teaching with a course about, I'm involved

06:46.540 --> 06:51.740
with MCP protocol and it got its information from its memory.

06:51.940 --> 06:54.380
Uh, so there you have it.

06:54.380 --> 07:02.980
There you can see the, uh, the use of a type one of a, of an MCP, uh, server that was using local

07:02.980 --> 07:09.180
storage and using that adding functionality to store a memory in that format.

07:09.180 --> 07:16.140
And that means that just just through using this MCP server, you can now add this kind of structured,

07:16.420 --> 07:20.140
relationship driven memory to any of your agents.
