Jokes MCP Server

MIT License
  • Linux
  • Apple
Integrations
  • Enables interacting with the Jokes MCP Server in GitHub Copilot's agent mode to request and receive jokes from various categories, such as Chuck Norris jokes and Dad jokes.

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 和连接器结合在一起确实效果更好

⚙️ 先决条件

  • Visual Studio Code(链接
  • Node v22(最好通过nvm for Windowsnvm安装)
  • Git 安装(链接
  • Azure 开发人员 CLI(链接
  • Azure 订阅(已添加付款方式)
  • GitHub 帐户
  • Copilot Studio 试用版或开发者帐户
  • Power Platform 环境已配置 - 启用以下开关:

➕ 根据模板创建一个新的 GitHub 存储库

  1. 选择Use this template
  2. 选择“创建新存储库”
  3. 选择正确的Owner (当您只有一个所有者可供选择时,它可能已经被选中)
  4. 给它一个Repository name
  5. 您可以选择为其添加Description
  6. 选择Private
  7. 选择Create repository这需要一点时间。完成后,您将被引导至新创建的存储库。

⚖️ 选择:本地运行服务器或部署到 Azure

现在您可以选择!您可以在本地运行服务器,也可以将其部署到 Azure。

您需要针对这两项操作执行以下几个步骤:

  1. 通过运行以下命令克隆此存储库(将{account}替换为您自己的 GitHub 帐户名):git clone https://github.com/{account}/mcsmcp.git
  2. 打开 Visual Studio Code 并打开克隆的文件夹
  3. 打开终端并导航到克隆的文件夹

🏃‍♀️ 本地运行 MCP 服务器

  1. 运行npm install
  2. 运行npm run build && npm run start
  3. 在 Visual Studio Code 终端顶部选择PORTS
  4. 选择绿色的Forward a Port按钮
  5. 输入3000作为端口号(这应该与您在步骤 5 中运行命令时看到的端口号相同)。系统可能会提示您登录 GitHub,如果出现提示,请执行此操作,因为这是使用端口转发功能所必需的。
  6. 右键单击刚刚添加的行,然后选择Port visibility > Public ,以使服务器公开可用
  7. 按住 Ctrl 键并单击Forwarded address ,该地址应类似于: https://something-3000.something.devtunnels.ms
  8. 在以下弹出窗口中选择Copy以复制 URL
  9. 打开您选择的浏览器并将 URL 粘贴到地址栏中,在其后面输入/mcp并按 Enter

如果一切顺利,您将看到以下错误消息:

{"jsonrpc":"2.0","error":{"code":-32000,"message":"Method not allowed."},"id":null}

别担心——这个错误信息没什么可担心的!

🌎 部署到 Azure

[!IMPORTANT] 如先决条件中所述,此部分需要在您的计算机上安装Azure Developer CLI

如果您尚未登录,请确保登录 Azure 开发人员 CLI。

azd auth login

[!警告]
运行azd up后,您将在 Azure 上运行一个公开可用的 MCP 服务器。理想情况下,您不希望出现这种情况。完成本实验后,请务必运行azd down以从您的 Azure 订阅中删除所有资源。请前往本节了解如何运行azd down

在终端中运行以下命令:

azd up

对于唯一环境名称,请输入mcsmcplab或类似名称。选择要使用的 Azure 订阅,并选择位置值。之后,服务器部署需要几分钟时间。完成后,您应该能够访问末尾列出的 URL,并在该 URL 末尾添加/mcp

您应该再次看到以下错误:

{"jsonrpc":"2.0","error":{"code":-32000,"message":"Method not allowed."},"id":null}

👨‍💻 在 Visual Studio Code / GitHub Copilot 中使用 Jokes MCP 服务器

要使用 Jokes MCP 服务器,您需要使用服务器的 URL(可以是您的 devtunnel URL 或您部署的 Azure 容器应用程序)并在末尾添加/mcp部分,然后在 Visual Studio Code 中将其添加为 MCP 服务器。

  1. ctrl + shift + P (Windows/Linux) 或cmd + shift + P (Mac) 并输入MCP
  2. 选择MCP: Add Server...
  3. 选择HTTP (HTTP or Server-Sent Events)
  4. 将服务器的 URL 粘贴到输入框中(确保最后包含/mcp
  5. Enter
  6. 输入服务器的名称,例如JokesMCP
  7. 选择User Settings将 MCP 服务器设置保存到您的用户设置中这会将 MCP 服务器添加到你的settings.json文件中。它应该如下所示:
  8. 打开GitHub Copilot
  9. Ask ”切换到Agent
  10. 确保在选择工具图标时选择了JokesMCP服务器操作:

  1. 提出以下问题:
Get a chuck norris joke from the Dev category

这应该会给你这样的回应:

现在您已将JokesMCP服务器添加到 Visual Studio Code!

👨‍💻 在 Microsoft Copilot Studio 中使用 Jokes MCP 服务器

导入连接器

  1. 转到https://make.preview.powerapps.com/customconnectors (确保您处于正确的环境中)并单击**+ 新建自定义连接器**
  2. 选择Import from GitHub
  3. 选择Custom作为连接器类型
  4. 选择dev作为分支
  5. 选择MCP-Streamable-HTTP作为连接器
  6. 选择Continue
  7. 连接器名称更改为合适的名称,例如Jokes MCP
  8. 描述更改为适当的内容
  9. 将您的根 URL(例如something-3000.something.devtunnels.mssomething.azurecontainerapps.io )粘贴到Host字段中
  10. 选择**“创建连接器”**

[!警告]
您可能会在创建时看到警告和错误 - 它应该很快就会得到解决 - 但您现在可以忽略它。

  1. 关闭连接器

创建代理并添加 MCP 服务器作为工具

  1. 转到https://copilotstudio.preview.microsoft.com/
  2. 选择右上角的环境选择器
  3. 选择正确的环境( Get new features early开关的环境)
  4. 在左侧导航中选择Create
  5. 选择蓝色的New agent按钮
  6. 选择左侧的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. 选择右上角的Continue

  1. 启用生成式 AI Orchestration

  1. Knowledge部分中禁用常识

  1. 在顶部菜单中选择Tools

  1. 选择Add a tool

  1. 选择Model Context Protocol选项卡来过滤所有模型上下文协议服务器(参见下面屏幕截图中的数字 1)
  2. 选择Jokes MCP服务器(参见下面屏幕截图中的数字 2)

  1. 通过选择Not connected**“创建新连接”来创建新**连接

  1. 选择Create

  1. 选择Add to agent以将工具添加到代理

  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?

现在将显示查克·诺里斯的笑话,而不是额外的权限。如果不是这样,您可能错过了环境需要启用get new features early的先决条件

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

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

这就是在 Microsoft Copilot Studio 中运行的 Jokes MCP Server。

❌ 删除 Azure 资源

要在完成实验后删除 Azure 资源,请在终端中运行以下命令:

azd down

此命令将显示要删除的资源,然后要求您确认。按y确认后,资源将被删除。这可能需要几分钟,但最后您将看到确认消息:

💡 已知问题和计划的改进

Microsoft Copilot Studio 中的 MCP 存在一些已知问题和计划改进。这些改进已在Microsoft Learn 文章中列出。

🗣️ 反馈

希望您喜欢这个实验室。请花时间填写我们的反馈表,告诉我们如何改进!

🚀 贡献

该项目欢迎您的贡献和建议。大多数贡献都要求您同意一份贡献者许可协议 (CLA),该协议声明您有权并确实授予我们使用您贡献的权利。详情请访问https://cla.opensource.microsoft.com

当您提交拉取请求时,CLA 机器人会自动判断您是否需要提供 CLA,并适当地修饰 PR(例如,状态检查、评论)。只需按照机器人提供的说明操作即可。您只需在所有使用我们 CLA 的仓库中执行一次此操作。

本项目已采用Microsoft 开源行为准则。更多信息请参阅行为准则常见问题解答,或联系opencode@microsoft.com提出其他问题或意见。

™️商标

本项目可能包含项目、产品或服务的商标或徽标。Microsoft 商标或徽标的授权使用须遵守Microsoft 的商标和品牌指南。在本项目的修改版本中使用 Microsoft 商标或徽标不得引起混淆或暗示 Microsoft 的赞助。任何第三方商标或徽标的使用均须遵守该第三方的政策。

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 fetches jokes from multiple sources (Chuck Norris, Dad jokes, and Yo Mama jokes) and integrates with Microsoft Copilot Studio to create a humor-focused conversational experience.
    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

View all related MCP servers

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sakshi-sancheti/MCPwithMCS'

If you have feedback or need assistance with the MCP directory API, please join our Discord server