Mule 4制作的YouTube MCP服务器
使用MuleSoft将您的YouTube API轻松连接到MCP服务器。本指南将帮助您在本地和您最喜欢的应用程序中设置、运行和使用服务器。
此服务器正在连接到 YouTube数据API(v3).
观看制作和跑步视频: https://youtu.be/EE1QLCuzGVk
获取YouTube API密钥
- 转到 谷歌云控制台.
- 创建一个新项目。
- 引导到 API和服务 汉堡菜单上。
- 点击 启用API和服务.
- 添加 YouTube数据API v3 选项。
- 回到 API和服务.
- 点击 凭证.
- 选择 创建凭据>API密钥.
- 打开新创建的API密钥并在 API限制,选择 限制密钥
- 添加 YouTube数据API v3 选中标记。
- 保存您的更改。
\[!注意\] 此API密钥将用于连接到MCP服务器。
在本地运行Mule应用程序
- 克隆此存储库:
git clone - 在Anypoint代码生成器或Anypoint Studio中打开项目。
- 运行Mule应用程序。
- 注意HTTP侦听器的端口(默认值:
8081).
运行超级网关
- 打开终端窗口。
- 运行以下命令(确保端口与Mule应用程序的HTTP侦听器匹配):
npx -y supergateway --sse http://localhost:8081/sse --ssePath /sse --messagePath /message- 您应该看到类似于以下内容的输出:
[supergateway] Starting...
[supergateway] Supergateway is supported by Supermachine (hosted MCPs) - https://supermachine.ai
[supergateway] - outputTransport: stdio
[supergateway] - sse: http://localhost:8081/sse
[supergateway] - Headers: (none)
[supergateway] Connecting to SSE...
[supergateway] Stdio server listening\[!提示\] 不要关闭此终端窗口。
检查MCP服务器是否正在运行
- 打开一个新的终端窗口并运行:
npx @modelcontextprotocol/inspector- 您应该看到如下输出:
Starting MCP inspector...
⚙️ Proxy server listening on 127.0.0.1:6277
🔑 Session token:
Use this token to authenticate requests or set DANGEROUSLY_OMIT_AUTH=true to disable auth
🔗 Open inspector with token pre-filled:
http://localhost:6274/?MCP_PROXY_AUTH_TOKEN=
(Auto-open is disabled when authentication is enabled)
🔍 MCP Inspector is up and running at http://127.0.0.1:6274 🚀- 复制
Open inspector with token链接并在浏览器中打开它。 - 选择运输类型
SSE和URLhttp://0.0.0.0:8081/sse. - 点击 连接.
- 如果无法连接,请确保使用了正确的代理身份验证/会话令牌。
- 连接后,转到 工具 然后单击
youtube-search服务器。 - 在中添加您的YouTube API密钥
key参数并单击 运行工具. - 您应该会收到回复或成功的结果。
将MCP服务器添加到您的应用程序
- 打开应用程序的JSON配置文件(例如。,
claude_desktop_config.json克劳德)。 - 添加以下配置(确保端口与您的设置匹配):
{
"mcpServers": {
"youtube": {
"command": "npx",
"args": [
"-y",
"supergateway",
"--sse",
"http://0.0.0.0:8081/sse",
"--ssePath",
"/sse",
"--messagePath",
"/message"
]
}
}
}- 如果需要,请重新启动您的应用程序(对于Claude,需要重新启动)。
使用示例
一旦一切准备就绪,您可以向您的代理提出以下问题:
- 搜索Prostdev YouTube频道,给我最后5个视频。使用此api密钥: `
`
- 创建一个LinkedIn帖子,突出显示前4个视频。
- 请确保将链接添加到帖子中的视频。
享受使用您的YouTube MCP服务器Mule集成! 🎬🚀
