WEBVTT

1
00:00:00.940 --> 00:00:05.020
Besides us making our own tools, it is

2
00:00:05.020 --> 00:00:08.360
also possible to consume MCP tools.

3
00:00:09.440 --> 00:00:13.300
MCP, or Model Context Protocol, you might have

4
00:00:13.300 --> 00:00:13.820
heard of.

5
00:00:14.200 --> 00:00:18.460
If you haven't, it's a protocol where others

6
00:00:18.460 --> 00:00:23.680
can expose their code, their actions, their information,

7
00:00:24.000 --> 00:00:26.740
and you to consume, so you don't need

8
00:00:26.740 --> 00:00:28.000
to use their APIs.

9
00:00:28.000 --> 00:00:31.759
A good example is GitHub, where if you

10
00:00:31.759 --> 00:00:35.440
use your GitHub MCP, it can list issues,

11
00:00:36.180 --> 00:00:38.300
create branches, and stuff like that.

12
00:00:39.980 --> 00:00:42.540
In our case, we are going to use

13
00:00:42.540 --> 00:00:45.940
the Microsoft Learn MCP server.

14
00:00:46.940 --> 00:00:49.460
So they show that they have an MCP

15
00:00:49.460 --> 00:00:49.800
server.

16
00:00:50.640 --> 00:00:52.760
There are two types of MCP servers.

17
00:00:52.940 --> 00:00:56.000
There are remote MCP servers and local MCP

18
00:00:56.000 --> 00:00:56.400
servers.

19
00:00:56.400 --> 00:00:58.740
In our case, we are going to show

20
00:00:58.740 --> 00:01:03.200
a remote MCP server because I think they

21
00:01:03.200 --> 00:01:07.300
are the future, and local MCPs are for

22
00:01:07.300 --> 00:01:09.900
niche areas in general.

23
00:01:11.280 --> 00:01:13.400
Beyond that, I'm not going to go into

24
00:01:13.400 --> 00:01:19.000
what MCP is in general unless you report

25
00:01:19.000 --> 00:01:21.260
back that you want a dedicated video on

26
00:01:21.260 --> 00:01:21.440
it.

27
00:01:22.000 --> 00:01:24.580
But just see it as someone who has

28
00:01:24.580 --> 00:01:26.820
written some code that you would not have

29
00:01:26.820 --> 00:01:27.640
had access to.

30
00:01:30.180 --> 00:01:33.420
So what we can see here is I

31
00:01:33.420 --> 00:01:37.260
have put in one more NuGet package, and

32
00:01:37.260 --> 00:01:40.700
that NuGet package is the modelcontextprotocol.

33
00:01:42.560 --> 00:01:46.560
Once we have that, we can do something

34
00:01:46.560 --> 00:01:47.300
like this.

35
00:01:49.840 --> 00:01:52.980
Await MCP client.create a new client.

36
00:01:52.980 --> 00:01:58.160
We want an HTTP client with the options

37
00:01:58.160 --> 00:02:02.220
of the endpoint being the Microsoft Learn MCP

38
00:02:02.220 --> 00:02:04.480
and its streamable HTTP.

39
00:02:06.000 --> 00:02:10.240
So here we can choose between some older

40
00:02:10.240 --> 00:02:13.560
models, and up here we can choose between

41
00:02:13.560 --> 00:02:19.400
HTTP and STDIO, which is the local.

42
00:02:21.060 --> 00:02:24.120
MCP clients come back, and you need to

43
00:02:24.120 --> 00:02:27.040
expose them, so I'm doing an await using

44
00:02:27.040 --> 00:02:27.400
here.

45
00:02:28.700 --> 00:02:30.880
But what we can do is we set

46
00:02:30.880 --> 00:02:31.900
a breakpoint here.

47
00:02:32.020 --> 00:02:33.920
We can see that whenever we have an

48
00:02:33.920 --> 00:02:36.720
MCP server, we can get what tools it

49
00:02:36.720 --> 00:02:36.980
has.

50
00:02:37.500 --> 00:02:40.360
So just like we've written some tools, Microsoft

51
00:02:40.360 --> 00:02:42.740
Learn have written some tools and exposed it

52
00:02:42.740 --> 00:02:43.800
to this URL.

53
00:02:44.460 --> 00:02:47.300
That's all there is to MCP, to be

54
00:02:47.300 --> 00:02:47.600
honest.

55
00:02:48.760 --> 00:02:52.480
So if we run it here and get

56
00:02:52.480 --> 00:02:54.920
the tools, we can see they have three

57
00:02:54.920 --> 00:02:55.460
tools.

58
00:02:56.360 --> 00:02:58.940
They have a tool for doc search, meaning

59
00:02:58.940 --> 00:03:03.540
searching the entire Microsoft Learn site, a tool

60
00:03:03.540 --> 00:03:07.160
for finding code samples, and a tool for

61
00:03:07.160 --> 00:03:09.660
fetching a specific Learn site.

62
00:03:11.860 --> 00:03:14.500
Right now, I have not given the tools.

63
00:03:14.500 --> 00:03:17.440
You can see I've commented them out here

64
00:03:17.440 --> 00:03:18.260
on purpose.

65
00:03:18.960 --> 00:03:21.400
That is to show what we can do

66
00:03:21.400 --> 00:03:23.300
with the tools and without the tools.

67
00:03:25.860 --> 00:03:29.100
So I am here, and if I go

68
00:03:29.100 --> 00:03:32.660
in and ask the question, make a –

69
00:03:32.660 --> 00:03:34.020
oh, I didn't show that.

70
00:03:34.440 --> 00:03:36.400
The instructions here are you are an expert

71
00:03:36.400 --> 00:03:38.700
in the C-Sharp version of Microsoft Agent

72
00:03:38.700 --> 00:03:39.320
Framework.

73
00:03:39.840 --> 00:03:42.900
Use tools to find your knowledge, and assume

74
00:03:42.900 --> 00:03:45.780
Azure OpenAI with API key is used.

75
00:03:46.980 --> 00:03:49.020
So a little like we do up here.

76
00:03:50.860 --> 00:03:53.580
And if we ask that without – we

77
00:03:53.580 --> 00:03:57.280
just add to LLM, which, by the way,

78
00:03:57.360 --> 00:04:00.420
is 4.1 nano.

79
00:04:00.700 --> 00:04:03.560
That was released about one and a half

80
00:04:03.560 --> 00:04:07.040
years before Microsoft Agent Framework came along.

81
00:04:07.440 --> 00:04:10.280
It will not know anything about what this

82
00:04:10.280 --> 00:04:10.620
is.

83
00:04:11.480 --> 00:04:14.200
But if we say make an example on

84
00:04:14.200 --> 00:04:17.240
how to make an agent, it will not

85
00:04:17.240 --> 00:04:18.640
say I do not know.

86
00:04:19.480 --> 00:04:22.180
It will come back and say it's this

87
00:04:22.180 --> 00:04:24.500
made-up nonsense.

88
00:04:25.480 --> 00:04:28.500
So it wants to use Windows Forms.

89
00:04:28.540 --> 00:04:30.460
It wants to use Newtonsoft.

90
00:04:30.660 --> 00:04:34.520
It do something with OpenAI here, and then

91
00:04:34.520 --> 00:04:37.980
it does all kinds of things that doesn't

92
00:04:37.980 --> 00:04:38.360
exist.

93
00:04:39.200 --> 00:04:44.020
It has just made stuff up trying to

94
00:04:44.020 --> 00:04:44.760
go to OpenAI.

95
00:04:45.000 --> 00:04:48.260
I have also seen it make some agent

96
00:04:48.260 --> 00:04:49.540
packages and so on.

97
00:04:49.560 --> 00:04:51.140
So if we start it again and try

98
00:04:51.140 --> 00:04:52.820
to ask the same question, it will come

99
00:04:52.820 --> 00:04:53.700
up with something new.

100
00:04:56.240 --> 00:04:57.880
Let me ask the same question again.

101
00:05:03.900 --> 00:05:05.660
So now it wants to use some COM

102
00:05:05.660 --> 00:05:08.420
import in order to make an AI agent

103
00:05:08.420 --> 00:05:08.860
trooper.

104
00:05:09.640 --> 00:05:12.360
This probably doesn't exist in the world, or

105
00:05:12.360 --> 00:05:14.000
if it does, it's certainly not what we

106
00:05:14.000 --> 00:05:14.300
want.

107
00:05:15.900 --> 00:05:20.440
So this is Hallucination's big style because it's

108
00:05:20.440 --> 00:05:23.740
in an area it doesn't know anything about.

109
00:05:25.420 --> 00:05:28.920
But if we give to the tool, which

110
00:05:28.920 --> 00:05:33.720
is essentially give it access to the entire

111
00:05:33.720 --> 00:05:38.780
Microsoft Learn portal, which of course also have

112
00:05:38.780 --> 00:05:44.740
Microsoft agent framework, among other things, it will

113
00:05:44.740 --> 00:05:46.220
become much better at this.

114
00:05:46.720 --> 00:05:49.260
Not perfect, but much better.

115
00:05:52.120 --> 00:05:54.940
So if we ask the same, make an

116
00:05:54.940 --> 00:05:57.200
example on how to make an agent.

117
00:05:57.480 --> 00:05:59.420
Let me make it big so we can

118
00:05:59.420 --> 00:06:00.800
see it better.

119
00:06:01.360 --> 00:06:04.720
It will now call the tool and look

120
00:06:04.720 --> 00:06:06.660
at the code and so on, and now

121
00:06:06.660 --> 00:06:08.780
it suddenly knows Microsoft agent framework.

122
00:06:09.820 --> 00:06:12.240
So it now knows it needs to use

123
00:06:12.240 --> 00:06:14.960
Azure OpenAI and stuff like that.

124
00:06:15.040 --> 00:06:17.020
It gets it from environment variables.

125
00:06:17.220 --> 00:06:18.540
We did it a bit different.

126
00:06:19.600 --> 00:06:22.600
And it's using not the API key, but

127
00:06:22.600 --> 00:06:24.620
now we can actually use it as a

128
00:06:24.620 --> 00:06:29.080
teaching experiment on how you instead use the

129
00:06:29.080 --> 00:06:34.240
role-based access control for Azure by simply

130
00:06:34.240 --> 00:06:36.000
just giving up the default.

131
00:06:36.220 --> 00:06:38.360
And the reason for this is that all

132
00:06:38.360 --> 00:06:43.580
the Microsoft samples use this, and they don't

133
00:06:43.580 --> 00:06:46.840
actually give a sample on how to get

134
00:06:46.840 --> 00:06:51.520
it with an API key because they don't

135
00:06:51.520 --> 00:06:53.840
want to have API keys rolling around in

136
00:06:53.840 --> 00:06:54.440
their samples.

137
00:06:54.440 --> 00:06:58.280
But beyond that, it gets an Azure client.

138
00:06:58.480 --> 00:07:00.880
It turns it into a chat client, and

139
00:07:00.880 --> 00:07:04.680
it says create agent, uses instructions and names,

140
00:07:04.920 --> 00:07:07.560
and do exactly as we have learned over

141
00:07:07.560 --> 00:07:09.420
the last few lectures.

142
00:07:10.400 --> 00:07:12.540
And then it gives links to where we

143
00:07:12.540 --> 00:07:16.060
can find information about this further on into

144
00:07:16.060 --> 00:07:16.580
the system.

145
00:07:19.660 --> 00:07:24.820
So that is the power of MCP, that

146
00:07:24.820 --> 00:07:27.720
we can, with just these few lines of

147
00:07:27.720 --> 00:07:29.340
code, have the entire system.

148
00:07:29.720 --> 00:07:32.460
Had Microsoft learned, had an API, we could

149
00:07:32.460 --> 00:07:34.100
have probably have built a lot of code

150
00:07:34.100 --> 00:07:36.440
and exposed that as a tool, but we

151
00:07:36.440 --> 00:07:38.260
don't need to because of MCP.

152
00:07:38.940 --> 00:07:42.380
GitHub in the same manner, and so on

153
00:07:42.380 --> 00:07:43.020
and so forth.

154
00:07:44.100 --> 00:07:46.220
MCP can do much, much more.

155
00:07:46.860 --> 00:07:50.440
Again, there's local tools for controlling browsers and

156
00:07:50.440 --> 00:07:53.660
stuff like that, but it's a bit beyond

157
00:07:53.660 --> 00:07:57.100
the scope of this introduction video at least.

158
00:07:58.020 --> 00:08:00.300
But all we do is we make our

159
00:08:00.300 --> 00:08:03.820
tools, and conveniently, those tools can be cast

160
00:08:03.820 --> 00:08:06.160
into those AI tools that we need down

161
00:08:06.160 --> 00:08:06.440
here.

162
00:08:07.420 --> 00:08:09.460
So very, very easy to do.

163
00:08:10.720 --> 00:08:13.320
One thing that are difficult to do right

164
00:08:13.320 --> 00:08:16.440
now is authentication against MCP servers.

165
00:08:17.000 --> 00:08:19.420
It's easy to do with API keys and

166
00:08:19.420 --> 00:08:23.640
stuff like that, but the entire OAuth part

167
00:08:23.640 --> 00:08:26.600
of it is very, very brand new in

168
00:08:26.600 --> 00:08:31.080
this package, so many of the OAuth options

169
00:08:31.080 --> 00:08:34.120
don't work as of this recording.

170
00:08:34.799 --> 00:08:37.340
But these open and free ones are very

171
00:08:37.340 --> 00:08:39.080
easy to use, as you can see.
