Okay, so you're probably thinking, all right, I get it. 好吧，所以你可能会想，好吧，我明白了。
We can create something that spawns a server and that tells us a bunch of tools, but that doesn't sound 我们可以创建一些东西来生成一个服务器并告诉我们一堆工具，但这听起来并不好
much fun. 很有趣。
We want it to actually do stuff, and that's what we'll get to right now. 我们希望它能够真正发挥作用，这就是我们现在要做的。
So we are now going to make just a quick example of an agent that will use these tools. 因此，我们现在将制作一个使用这些工具的代理的快速示例。
So here we go. 那么我们开始吧。
Here are some instructions for our agent. 以下是给我们代理的一些说明。
You browse the internet to accomplish your instructions. 您浏览互联网以完成您的指示。
You're highly capable of browsing the internet independently to accomplish your task, including accepting 您非常有能力独立浏览互联网来完成您的任务，包括接受
cookies. 曲奇饼。
Clicking not now. 现在不点击。
If at one website it's a fruitful try another. 如果在一个网站上尝试是富有成效的，那么尝试另一个网站。
Be persistent until you've solved your assignment. 坚持不懈，直到完成任务。
So that's a nice set of instructions to prep our server. 这是一套很好的指导来准备我们的服务器。
So we now again use this same context manager as before, the one we used to collect the names of tools 因此，我们现在再次使用与之前相同的上下文管理器，即我们用来收集工具名称的上下文管理器
we pass in the parameters we want. 我们传入我们想要的参数。
And again remember that timeout. 再次记住那个超时。
And we'll do it for both of our files. 我们将为我们的两个文件执行此操作。
MCP server, the one that can write to the disk, and the playwright, one that can control a browser MCP 服务器，可以写入磁盘的服务器，以及剧作家，可以控制浏览器的服务器
in a fine grained way. 以细粒度的方式。
And we will create an agent and it is called investigator. 我们将创建一个代理，称为调查员。
We give it those instructions, we'll give it that model. 我们给它这些指令，我们会给它那个模型。
We might as well. 我们也可以。
Let's change this to be the latest and greatest GPT for one mini. 让我们将其更改为一台 mini 的最新、最好的 GPT。
And then look, this is it. 然后看，就是这样。
You then pass in a collection of MCP servers. 然后，您传入 MCP 服务器的集合。
You might remember in the past that you passed in. 你可能记得过去你曾进去过。
You could pass in tools directly in here. 您可以直接在此处传递工具。
Well, rather than tools you can pass in MCP servers. 好吧，您可以在 MCP 服务器中传递而不是工具。
And OpenAI agents SDK will query these for understanding their tools and provide those capabilities OpenAI 代理 SDK 将查询这些以了解其工具并提供这些功能
to this investigator agent. 给这位调查员。
And that is as complicated as it gets. 这很复杂。
That's how we equip our agents to be able to use these tools. 这就是我们如何让我们的代理能够使用这些工具。
And now, if you remember, do you remember the OpenAI agents SDK once you've created the agent? 现在，如果您还记得的话，您还记得创建代理后的 OpenAI 代理 SDK 吗？
That was step one. 这是第一步。
Step two is you set up a trace so that we can track this in the UI. 第二步是设置跟踪，以便我们可以在 UI 中跟踪它。
And then we call runner. 然后我们称之为跑步者。
And what is the assignment that I'm going to give our agent I'm going to say find a great recipe for 我要给我们的经纪人的任务是什么 我要说的是找到一个很好的秘诀
banoffee pie. 班诺菲饼。
Then summarize it in Markdown to banoffee. 然后用Markdown总结到banoffee。
And you may be wondering what on earth does banoffee pie? 您可能想知道班诺菲派到底是什么？
And I think it's a tragedy that you're wondering that banoffee pie. 我认为你想知道香蕉诺菲派是一个悲剧。
Us, us, us Brits, we're not well known for our cooking. 我们，我们，我们英国人，我们的烹饪并不出名。
Let's face it, we're not necessarily the purveyors of the great delicacies of the world, but banoffee 让我们面对现实吧，我们不一定是世界美食的提供者，但巴诺菲
pie is something that I think we invented, and it's really amazing. 我认为馅饼是我们发明的，它真的很棒。
And I think it's a great shame that more people don't know about it. 我认为更多的人不知道这一点是非常遗憾的。
And so that's why I'm doing you this service, by having this be the thing that we are going to have 这就是为什么我要为你提供这项服务，让这成为我们将要拥有的东西
an agent go off and investigate on our behalf. 一名特工代表我们出发进行调查。
And so with that, let's give this a whirl. 那么，让我们尝试一下。
Okay. 好的。
We will run this and off it goes. 我们将运行它并关闭它。
And a few seconds go by thinks about this request for us. 我们花了几秒钟思考这个请求。
It's spawning these MCP servers and a browser window has just popped up on my computer. 它正在生成这些 MCP 服务器，并且我的计算机上刚刚弹出一个浏览器窗口。
Move it! 移动它！
There we go. 我们开始吧。
So it appears to have gone to BBC Good Food. 所以它似乎去了 BBC Good Food。
So it obviously does know that this is something British and something is happening behind the scenes. 所以它显然知道这是英国的事情并且幕后正在发生一些事情。
It's thinking about this. 它正在思考这个问题。
You can see from the title of this page that it has indeed located a banoffee pie recipe. 从这个页面的标题可以看出，它确实找到了一份香蕉咖啡派的食谱。
So this is the result of the MCP server running. 所以这是MCP服务器运行的结果。
It is driving playwright. 它是推动剧作家。
We don't know everything that's doing behind the scenes, but sometimes you get to see it actually like 我们不知道幕后发生的一切，但有时你会看到它实际上就像
clicking around and navigating. 单击并导航。
But I suspect, yes, we will find that it has indeed found a recipe for banoffee pie. 但我怀疑，是的，我们会发现它确实找到了巴诺菲饼的配方。
And from just a quick look at this, I tell you that I'm hopeless at cooking. 快速浏览一下这个，我就告诉你我对烹饪毫无希望。
I can cook nothing. 我什么都不会煮。
I can hardly cook a boiled egg, but I can cook banoffee pie. 我几乎不会煮煮鸡蛋，但我可以煮香蕉诺菲派。
I know I can cook, I know how to make banoffee pie. 我知道我会做饭，我知道如何制作香蕉诺菲派。
And from a first glance at this, I think that this probably is a legit version of banoffee pie. 乍一看，我认为这可能是香蕉咖啡派的合法版本。
But most importantly, we need to look in our sandbox and open the preview of this file and confirm 但最重要的是，我们需要查看沙箱并打开该文件的预览并确认
that, sure enough, it has used the other MCP server. 果然，它已经使用了其他 MCP 服务器。
So not only has it used one MCP server to navigate the internet and locate a recipe for banoffee pie, 因此，它不仅使用一台 MCP 服务器来浏览互联网并找到香蕉咖啡派的食谱，
but it's also used the other MCP server to then write that to disk. 但它还使用其他 MCP 服务器将其写入磁盘。
And here it is on my computer. 这是在我的电脑上。
So I would say that is mission accomplished. 所以我想说这已经完成了。
We have used our first two MCP servers, and you probably remember from week two what comes next. 我们已经使用了前两台 MCP 服务器，您可能还记得第二周之后发生的事情。
We want to go and look in open IE at our trace so we can see what happened behind the scenes. 我们想要在打开的 IE 中查看我们的踪迹，这样我们就可以看到幕后发生了什么。
So go in the usual link up comes traces. 因此，在通常的链接中会出现痕迹。
Go in to investigate and see what happened, and we'll see that. 进去调查一下，看看发生了什么，我们会看到的。
Of course, it listed the MCP tools associated with each of its MCP servers, and it then used the browser 当然，它列出了与其每个 MCP 服务器关联的 MCP 工具，然后使用浏览器
navigate tool to be able to navigate the web page. 导航工具能够导航网页。
Yours may look different. 你的可能看起来不同。
You may have more action there, and it then used the file tools. 您可能在那里有更多的操作，然后它使用了文件工具。
For some reason it did a read file, but then it did the right file to write out the banoffee pie recipe 由于某种原因，它执行了读取文件，但随后执行了正确的文件来写出banoffee馅饼食谱
in there, and that shows the interactions between the tools. 在那里，它显示了工具之间的交互。
You should look at it, check it's behaving as you expect. 您应该查看它，检查它的行为是否符合您的预期。
Check it's using the right tools in the right way. 检查是否以正确的方式使用正确的工具。
So the aha moment when you realise what makes MCP so exciting is when you first see an MCP marketplace. 因此，当您第一次看到 MCP 市场时，您就会恍然大悟 MCP 为何如此令人兴奋。
That's what we're going to do right now. 这就是我们现在要做的。
The marketplaces are websites where you can see all the MCP servers that are out there available for 市场是一些网站，您可以在其中查看可用的所有 MCP 服务器
you to equip your agent with, and MCP is a very popular one, a very common one. 你给你的代理配备，MCP是一种非常流行的一种，一种非常常见的一种。
Let's go in here. 我们进去吧。
This is launching the marketplace. 这正在启动市场。
We see a bunch of different MCP servers in their featured list, including the playwright MCP server 我们在其特色列表中看到了一堆不同的 MCP 服务器，包括剧作家 MCP 服务器
that we just used. 我们刚刚使用过的。
And if we go into this, we can look at it. 如果我们深入研究这个问题，我们就可以研究一下。
We can see that it has the parameters that we use to integrate with it. 我们可以看到它具有我们用来与其集成的参数。
There you can have a look at the tools that you can call. 在那里您可以查看可以调用的工具。
If you use it. 如果你使用它。
You can see it was created by Microsoft, by the way, which gives you a sense that it's probably legit. 顺便说一句，您可以看到它是由 Microsoft 创建的，这让您感觉它可能是合法的。
And look through all of the information about the tools that it can run. 并查看有关它可以运行的工具的所有信息。
And if you press the explore tab in the main navigation, then you get to see the sort of search and 如果您按主导航中的探索选项卡，您将看到搜索的类型和
filter. 筛选。
Over here you can see the different MCP servers in the different categories. 在这里您可以看到不同类别的不同 MCP 服务器。
And this is where you should get like a wow feeling. 这就是你应该感到惊叹的地方。
There's 4000 in the research and data category. 研究和数据类别有 4000 个。
68 Browser automation knowledge and memory. 68 浏览器自动化知识和记忆。
Equipping your LLM to be able your agent to be able to remember things in different ways, 34 of them, 装备你的法学硕士，让你的代理人能够以不同的方式记住事情，其中​​ 34 种，
19 different calendar managers and then lots of monitoring visualization. 19 种不同的日历管理器以及大量的监控可视化。
I think somewhere here is developer. 我认为这里的某个地方是开发人员。
That's the really the really big category that has tons and tons of MCP servers, but developer tools. 这确实是一个非常大的类别，拥有大量的 MCP 服务器，但也有开发人员工具。
Here we go, 7344. 我们来了，7344。
So and I imagine there's some overlap between these categories. 所以我想这些类别之间存在一些重叠。
But but it gives you a sense that there's so much to pick from. 但它给你一种感觉，有很多东西可供选择。
There's there's so much that you can explore here for equipping your agents. 这里有很多东西可供您探索来装备您的特工。
And now let's go and look at a couple of other marketplaces. 现在让我们看看其他几个市场。
So the next link I have here is to glamour, which is another popular server marketplace. 因此，我在这里的下一个链接是魅力，这是另一个流行的服务器市场。
And you come in here and click on the every MCP server link. 您进入此处并单击每个 MCP 服务器链接。
And you get to see the ones on glamour. 你还可以看到那些充满魅力的人。
And they also have ratings for security, the how permissive the licensing is and the quality. 他们还对安全性、许可的许可程度和质量进行评级。
And you can read about how they how they come up with this. 您可以了解他们是如何想出这个办法的。
And that's helpful for, for assessing the security of these. 这对于评估这些的安全性很有帮助。
And again you see the volumes involved. 你会再次看到所涉及的数量。
There's a lot of these out there. 那里有很多这样的东西。
Now security brings up a great point. 现在安全提出了一个重要观点。
And there's obviously there's there's a lot of concern in the community about the security of MCP servers. 显然，社区对 MCP 服务器的安全性有很多担忧。
Because when you run an MCP server, it is running on your computer, running on your box. 因为当你运行MCP服务器时，它就在你的计算机上运行，​​在你的盒子上运行。
There is a whole thing about authentication of MCP servers. MCP 服务器的身份验证有一个完整的过程。
And again, that's talking more about when you're connecting to a remote MCP server, a hosted or managed 再说一次，这更多的是关于当您连接到远程 MCP 服务器（托管或托管）时的情况。
MCP server running somewhere else. MCP 服务器在其他地方运行。
And then there's ways that you can authenticate with that server. 然后您可以通过多种方式向该服务器进行身份验证。
But in this case, and typically most of the time you're running an MCP server, you're running somebody 但在这种情况下，通常在您运行 MCP 服务器的大部分时间里，您都在运行某人
else's code on your computer. 别人的代码在你的电脑上。
And so at first blush, you might say, okay, that's a real concern. 因此，乍一看，您可能会说，好吧，这确实是一个问题。
And it is. 确实如此。
But it's important to keep something in mind. 但记住一些事情很重要。
Ultimately running these MCP servers, it's like doing a pip install or an npm install. 最终运行这些 MCP 服务器，就像进行 pip 安装或 npm 安装一样。
You are installing open source code on your computer, and that is as dangerous as just doing a pip 您正在计算机上安装开源代码，这与仅仅执行 pip 一样危险
install of someone else's code. 安装别人的代码。
That's what you're doing. 这就是你正在做的事情。
The open source community. 开源社区。
Of course, it is something where you are signing up for some information risk that you need to manage, 当然，这是您注册时需要管理的一些信息风险，
and that means that you need to do your due diligence on the tools that you use, just as you would 这意味着您需要对您使用的工具进行尽职调查，就像您所做的那样
any package that you pip installed from PyPI. 您从 PyPI pip 安装的任何软件包。
It's exactly the same thing. 这是完全一样的事情。
If it's, of course, a package that's published by Microsoft or Anthropic, then you're probably in 当然，如果它是由 Microsoft 或 Anthropic 发布的软件包，那么您可能处于
good shape. 身材好。
If it's not, then you want to do the usual kind of investigation. 如果不是，那么您需要进行通常的调查。
You want to check that there's lots of git stars in the GitHub repo, that there's an active community, 您想要检查 GitHub 存储库中是否有很多 git star，是否有一个活跃的社区，
and that it has good feedback, and that you are satisfied with the kind of security reviews that have 并且它有良好的反馈，并且您对此类安全审查感到满意
happened for that MCP tool. MCP 工具发生了这种情况。
And and so MCP servers are only as safe as any code that you directly download and run on your computer, 因此，MCP 服务器的安全性与您直接下载并在计算机上运行的任何代码一样安全，
and you need to be very cognizant of that. 你需要非常清楚这一点。
Of course, there are some MCP servers that you can configure to run inside a Docker container, and 当然，您可以将一些 MCP 服务器配置为在 Docker 容器内运行，并且
that does give you some extra security controls there. 这确实给了你一些额外的安全控制。
But but ultimately, you should always be doing your security review by doing your own research of the 但最终，您应该始终通过自己的研究来进行安全审查
the publisher of this server and of the information about it, and looking into the code and the repo 该服务器及其信息的发布者，并查看代码和存储库
to satisfy yourself that this is something you want to run. 让自己确信这是你想要运行的东西。
One of the reasons that people are concerned about MCP service security is that people who aren't technologists. 人们担心 MCP 服务安全的原因之一是那些不是技术人员的人。
People who are just end users have the ability to add MCP servers to things like cloud desktop. 最终用户可以将 MCP 服务器添加到云桌面等内容中。
And that's more worrying because they don't have the same kinds of skills that you and I have. 这更令人担忧，因为他们不具备你我所拥有的技能。
They don't know how to go and track something down in GitHub, make sure it's got a community. 他们不知道如何在 GitHub 中追踪某些内容，确保它有一个社区。
Make sure that they have a good feeling about the publisher. 确保他们对出版商有良好的感觉。
So when it comes to to to you and me, we've got this knowledge. 因此，当涉及到你和我时，我们已经掌握了这些知识。
We know how to vet packages. 我们知道如何审查包裹。
Open source packages that we install. 我们安装的开源软件包。
And so we can do that kind of due diligence. 因此我们可以进行这种尽职调查。
The concern is more where end users are just adding these to Claude and they don't necessarily have 更令人担忧的是，最终用户只是将这些添加到 Claude，而他们不一定拥有
those skills. 那些技能。
And so that's an important distinction to to make. 因此，这是一个重要的区别。
But in addition to that, if you're looking at something like glamour, then you can look at the ratings 但除此之外，如果您正在寻找诸如魅力之类的东西，那么您可以查看收视率
that they give it for security. 他们为了安全而提供它。
And you can read about the kinds of tests that they carry out. 您可以了解他们进行的测试类型。
That means that they're comfortable giving it the A grade, and you can decide that you're only as a 这意味着他们愿意给它 A 级，而你可以决定你只是作为一个
starting point. 起点。
You're only going to take MCP servers that get three sets of A's on the glamour marketplace. 您只能采用在魅力市场上获得三组 A 的 MCP 服务器。