Microsoft Copilot Studio ❤️ MCP Jokes Server

Integrations

  • Allows for deploying the MCP server from a GitHub repository to an Azure Web App through the GitHub integration in Azure's Deployment Center.

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 存储库

  1. 选择Use this template
  2. 选择“创建新存储库”
  3. 选择合适的Owner
  4. 给它一个Repository name
  5. 您可以选择为其添加Description
  6. 选择Private
  7. 选择Create repository这需要一点时间。完成后,您将被引导至新创建的存储库。

[!警告]
完成本实验中的步骤后,您将拥有一个在 Azure 上运行的公开可用的 MCP 服务器。理想情况下,您不希望出现这种情况。请确保在完成本实验后删除 Azure Web 应用。

部署 Azure Web 应用

  1. 前往portal.azure.com
  2. 将鼠标悬停在Resource groups选项卡上并选择Create
  3. 单击Subscription下拉菜单并从列表中选择您的订阅
  4. 单击Resource group名称文本框并输入资源组名称,例如“jokesgrp”
  5. 选择Region下拉菜单,选择距离您最近的区域
  6. 单击Review + create Click Review + create
  7. 单击Create
  8. 选择Go to resource group
  9. 选择Create
  10. 点击search box

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

  1. 选择Web App

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

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

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

  1. 单击Review + create Click Review + create

  1. 单击Create

  1. 单击Refresh以更新部署进度

  1. 部署完成后,选择Go to resource

  1. 展开Deployment选项卡

  1. 单击Deployment Center

  1. 单击Source下拉菜单并选择GitHub

  1. 选择Authorize

  1. 选择Continue

  1. 选择Authorize AzureAppService

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

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

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

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

  1. 单击Refresh以更新部署状态

  1. 验证部署是否完成

创建 Power Platform 连接器

  1. 转到https://make.powerapps.com/
  2. 在左侧菜单中选择More
  3. 选择Discover all按钮
  4. 在“数据”下,选择Custom connectors旁边的pin icon ,将其固定到左侧菜单
  5. 在左侧菜单中选择Custom connectors
  6. 选择New custom connector
  7. 选择Create from blank
  8. 给连接器命名(例如JokesMCP
  9. 选择蓝色的Continue按钮
  10. 选择Swagger editor切换

  1. 此处复制 yaml 代码并替换 Swagger 编辑器中的代码
  2. 在 Swagger 编辑器中,将dummyurl.azurewebsites.net替换为你之前创建的 Web 应用的 URL。确保删除https://以及azurewebsites.net后面的所有内容。
  3. 选择Create connector来创建连接器

在 Microsoft Copilot Studio 中添加 MCP 服务器作为操作

现在,您已在 Azure 中运行 MCP 服务器,并在 Power Platform 中提供了连接器。此步骤涉及在 Microsoft Copilot Studio 中创建代理,并将 MCP 服务器添加到该代理。

  1. 转到https://copilotstudio.microsoft.com
  2. 选择右上角的环境选择器
  3. 选择合适的环境
  4. 在左侧导航中选择Create
  5. 选择蓝色的New agent按钮
  6. 选择右上角的Skip to configure
  7. 将名称更改为Jokester
  8. 添加以下Description
    A 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.
  9. 添加以下Instructions
    You 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.
  10. 选择右上角的Create

  1. 启用生成式 AI Orchestration

  1. Knowledge部分中禁用常识

  1. 在顶部菜单中选择Actions

  1. 选择Add an action

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

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

  1. Description for the agent to know when to use this action更改为以下文本:
Trigger this action when a user asks for a joke. It can provide Chuck Norris jokes, Dad jokes and Yo Mama jokes.

将其余部分保留为默认值,例如最终用户身份验证,您将在一分钟内了解更多信息。

  1. 选择Add action将操作添加到代理

  1. Test your agent窗格中选择refresh icon

  1. Test your agent窗格中发送以下消息:
Can I get a Chuck Norris joke?

系统会显示一条消息,提示您运行此操作需要额外权限。这是因为操作向导中存在用户身份验证。

  1. 选择Connect

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

  1. 选择JokesMCP旁边的Connect

  1. 等待连接创建并选择Submit

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

  1. 关闭浏览器中的“管理连接”选项卡

现在您应该回到 Jokester 代理屏幕。

  1. Test your agent窗格中选择refresh icon

  1. Test your agent窗格中发送以下消息:
Can I get a Chuck Norris joke?

现在将显示查克·诺里斯 (Chuck Norris) 的笑话 - 而不是额外的权限。

  1. Test your agent窗格中发送以下消息:
Can I get a Dad joke?

现在将显示一个老爸笑话。

  1. Test your agent窗格中发送以下消息:
Can I get a Yo Mama joke?

现在将显示一个 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 的赞助。任何第三方商标或徽标的使用均须遵守该第三方的政策。

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

MCP 服务器从多个来源(查克·诺里斯、老爸笑话和你妈妈笑话)获取笑话,并与 Microsoft Copilot Studio 集成以创建以幽默为中心的对话体验。

  1. 什么是 MCP?
    1. MCP 与连接器
      1. 先决条件
        1. 实验室
          1. 根据模板创建一个新的 GitHub 存储库
          2. 部署 Azure Web 应用
          3. 创建 Power Platform 连接器
          4. 在 Microsoft Copilot Studio 中添加 MCP 服务器作为操作
        2. 笑话 MCP 服务器详细信息
          1. 工具
            1. 得到查克笑话
            2. 获取查克类别
            3. 爸爸笑话
            4. 让你妈妈笑话
          2. 已知问题和计划的改进
            1. 贡献
              1. 商标

                Related MCP Servers

                • -
                  security
                  A
                  license
                  -
                  quality
                  An MCP server that enables Microsoft Copilot Studio to fetch jokes from multiple sources including Chuck Norris jokes, Dad jokes, and Yo Mama jokes.
                  Last updated -
                  TypeScript
                  MIT License
                • -
                  security
                  A
                  license
                  -
                  quality
                  An MCP server that enables Microsoft Copilot Studio to fetch and deliver various types of jokes (Chuck Norris, Dad jokes, and Yo Mama jokes) from multiple online joke APIs.
                  Last updated -
                  TypeScript
                  MIT License
                • -
                  security
                  A
                  license
                  -
                  quality
                  A Model Context Protocol server that enables Microsoft Copilot Studio to fetch jokes from various sources including Chuck Norris jokes, Dad jokes, and Yo Mama jokes.
                  Last updated -
                  TypeScript
                  MIT License
                • -
                  security
                  A
                  license
                  -
                  quality
                  An 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 -
                  TypeScript
                  MIT License

                View all related MCP servers

                ID: 029g4iy5aw