Microsoft Copilot Studio ❤️ MCP
欢迎来到Microsoft Copilot Studio ❤️ MCP实验室。在本实验室中,您将学习如何部署 MCP 服务器,以及如何将其添加到 Microsoft Copilot Studio。
什么是 MCP?
模型上下文协议 (MCP)是一种开放协议,它标准化了应用程序如何向 LLM 提供上下文,由Anthropic定义。MCP 提供了一种将 AI 模型连接到不同数据源和工具的标准化方法。MCP 允许创客将现有的知识服务器和 API 无缝集成到 Copilot Studio 中。
目前,Copilot Studio 仅支持工具。要了解更多关于当前功能的信息,请访问aka.ms/mcsmcp 。目前存在一些已知问题和计划改进。具体内容列于此处。
MCP 与连接器
什么时候使用 MCP?什么时候使用连接器?MCP 会取代连接器吗?
MCP 服务器通过连接器基础架构提供给 Copilot Studio 使用,因此这些问题实际上并不适用。MCP 服务器使用连接器基础架构,这意味着它们可以采用企业安全和治理控制措施,例如虚拟网络集成、数据丢失防护控制、多种身份验证方法(所有这些功能在此版本中均已提供),同时支持 AI 客服人员的实时数据访问。
因此,MCP 和连接器结合在一起确实效果更好。
先决条件
Azure 订阅(已添加付款方式)
拥有 GitHub 帐户并登录
Copilot Studio 试用版或开发者帐户
Power Platform 环境已预配
实验室
为了能够部署此 MCP 服务器并在 Microsoft Copilot Studio 中使用它,您需要执行以下操作:
根据模板创建一个新的 GitHub 存储库
选择
Use this template选择“创建新存储库”

选择合适的
Owner给它一个
Repository name您可以选择为其添加
Description选择
Private选择
Create repository这需要一点时间。完成后,您将被引导至新创建的存储库。
[!警告]
完成本实验中的步骤后,您将拥有一个在 Azure 上运行的公开可用的 MCP 服务器。理想情况下,您不希望出现这种情况。请确保在完成本实验后删除 Azure Web 应用。
部署 Azure Web 应用
前往
portal.azure.com
将鼠标悬停在
Resource groups选项卡上并选择Create
单击
Subscription下拉菜单并从列表中选择您的订阅
单击
Resource group名称文本框并输入资源组名称,例如“jokesgrp”
选择
Region下拉菜单,选择距离您最近的区域
单击
Review + createClick Review + create
单击
Create
选择
Go to resource group
选择
Create
点击
search box

键入
web app在 Web 应用搜索结果中选择
Create button

选择
Web App

选择
Name文本输入并输入网络应用的名称,例如“wegotjokes”

选择
Runtime stack下拉菜单并选择Node 22 LTS

选择
Region下拉菜单并选择距离您最近的区域

单击
Review + createClick Review + create

单击
Create

单击
Refresh以更新部署进度

部署完成后,选择
Go to resource

展开
Deployment选项卡

单击
Deployment Center

单击
Source下拉菜单并选择GitHub

选择
Authorize

选择
Continue

选择
Authorize AzureAppService

单击
Organization下拉菜单并选择您的组织

单击
Repository下拉菜单,然后从列表中选择您之前创建的 GitHub 存储库

单击
Branch下拉菜单并选择您的分支

保留其他所有内容的默认设置并选择
Save

单击
Refresh以更新部署状态

验证部署是否完成

创建 Power Platform 连接器
在左侧菜单中选择
More选择
Discover all按钮在“数据”下,选择
Custom connectors旁边的pin icon,将其固定到左侧菜单在左侧菜单中选择
Custom connectors选择
New custom connector选择
Create from blank
给连接器命名(例如
JokesMCP)选择蓝色的
Continue按钮选择
Swagger editor切换

从此处复制 yaml 代码并替换 Swagger 编辑器中的代码
在 Swagger 编辑器中,将
dummyurl.azurewebsites.net替换为你之前创建的 Web 应用的 URL。确保删除https://以及azurewebsites.net后面的所有内容。选择
Create connector来创建连接器
在 Microsoft Copilot Studio 中添加 MCP 服务器作为操作
现在,您已在 Azure 中运行 MCP 服务器,并在 Power Platform 中提供了连接器。此步骤涉及在 Microsoft Copilot Studio 中创建代理,并将 MCP 服务器添加到该代理。
选择右上角的环境选择器
选择合适的环境
在左侧导航中选择
Create选择蓝色的
New agent按钮
选择右上角的
Skip to configure
将名称更改为
Jokester添加以下
DescriptionA humor-focused agent that delivers concise, engaging jokes only upon user request, adapting its style to match the user's tone and preferences. It remains in character, avoids repetition, and filters out offensive content to ensure a consistently appropriate and witty experience.添加以下
InstructionsYou are a joke-telling assistant. Your sole purpose is to deliver appropriate, clever, and engaging jokes upon request. Follow these rules: * Respond only when the user asks for a joke or something related (e.g., "Tell me something funny"). * Match the tone and humor preference of the user based on their input—clean, dark, dry, pun-based, dad jokes, etc. * Never break character or provide information unrelated to humor. * Keep jokes concise and clearly formatted. * Avoid offensive, discriminatory, or NSFW content. * When unsure about humor preference, default to a clever and universally appropriate joke. * Do not repeat jokes within the same session. * Avoid explaining the joke unless explicitly asked. * Be responsive, witty, and quick.选择右上角的
Create

启用生成式 AI
Orchestration

在
Knowledge部分中禁用常识

在顶部菜单中选择
Actions

选择
Add an action

搜索您之前创建的连接器的名称(在本例中为
jokes)(参见下面屏幕截图中的数字 1)选择
Jokes MCP server(参见下面屏幕截图中的数字 2)

等待连接创建,完成后选择
Next

Description for the agent to know when to use this action更改为以下文本:
将其余部分保留为默认值,例如最终用户身份验证,您将在一分钟内了解更多信息。
选择
Add action将操作添加到代理

在
Test your agent窗格中选择refresh icon

在
Test your agent窗格中发送以下消息:
系统会显示一条消息,提示您运行此操作需要额外权限。这是因为操作向导中存在用户身份验证。
选择
Connect

这将打开一个新窗口,您可以在其中管理此代理的连接。
选择
JokesMCP旁边的Connect

等待连接创建并选择
Submit

现在应该已连接,因此状态应设置为
Connected

关闭浏览器中的“管理连接”选项卡
现在您应该回到 Jokester 代理屏幕。
在
Test your agent窗格中选择refresh icon

在
Test your agent窗格中发送以下消息:
现在将显示查克·诺里斯 (Chuck Norris) 的笑话 - 而不是额外的权限。

在
Test your agent窗格中发送以下消息:
现在将显示一个老爸笑话。

在
Test your agent窗格中发送以下消息:
现在将显示一个 Yo Mama 笑话。

以上就是 Jokes MCP 服务器在 Microsoft Copilot Studio 中的运行情况。本次实验也到此结束!希望您喜欢本次实验。请抽出时间填写我们的反馈表。
笑话 MCP 服务器详细信息
这是一个基于TypeScript SDK构建的MCP服务器。
通过此 MCP 服务器,您将能够从以下网站获取笑话:
如果您想在本地运行服务器,请确保在存储库的根目录中运行npm install 。
之后,您可以运行npm run build来构建服务器,并npm start来启动服务器。
工具
包含以下工具:
得到查克笑话
此工具从chucknorris.io检索随机的 Chuck Norris 笑话。
获取查克类别
此工具从chucknorris.io检索可用类别。
爸爸笑话
此工具从icanhazdadjoke.com检索随机老爸笑话。
让你妈妈笑话
此工具从yomama-jokes.com检索随机的 Yo Mama Joke。
已知问题和计划的改进
Microsoft Copilot Studio 中的 MCP 存在一些已知问题和计划改进。这些改进已在Microsoft Learn 文章中列出。
贡献
该项目欢迎您的贡献和建议。大多数贡献都要求您同意一份贡献者许可协议 (CLA),该协议声明您有权并确实授予我们使用您贡献的权利。详情请访问https://cla.opensource.microsoft.com 。
当您提交拉取请求时,CLA 机器人会自动判断您是否需要提供 CLA,并适当地修饰 PR(例如,状态检查、评论)。只需按照机器人提供的说明操作即可。您只需在所有使用我们 CLA 的仓库中执行一次此操作。
本项目已采用Microsoft 开源行为准则。更多信息请参阅行为准则常见问题解答,或联系opencode@microsoft.com提出其他问题或意见。
商标
本项目可能包含项目、产品或服务的商标或徽标。Microsoft 商标或徽标的授权使用须遵守Microsoft 的商标和品牌指南。在本项目的修改版本中使用 Microsoft 商标或徽标不得引起混淆或暗示 Microsoft 的赞助。任何第三方商标或徽标的使用均须遵守该第三方的政策。
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
MCP 服务器允许 Microsoft Copilot Studio 从三个来源获取随机笑话:查克·诺里斯笑话、老爸笑话和你妈妈笑话。
Related MCP Servers
- -security-license-qualityAn MCP server that enables Microsoft Copilot Studio to fetch jokes from multiple sources including Chuck Norris jokes, Dad jokes, and Yo Mama jokes.
- -security-license-qualityAn MCP server that enables Microsoft Copilot Studio to retrieve random jokes from various online sources including Chuck Norris jokes, Dad jokes, and Yo Mama jokes.Last updated -MIT License
- -security-license-qualityAn MCP server that integrates with Microsoft Copilot Studio to deliver random jokes from multiple sources including Chuck Norris, Dad jokes, and Yo Mama jokes upon user request.Last updated -MIT License
- -security-license-qualityAn MCP server that enables Microsoft Copilot Studio to fetch and deliver random jokes from multiple sources including Chuck Norris jokes, Dad jokes, and Yo Mama jokes.Last updated -MIT License