MCP服务器:Youtube字幕提取器
👉👉👉 移动到https://github.com/microsoft/mcp-dotnet-samples 👈👈👈
这是一个MCP服务器,从给定的YouTube链接中提取字幕。
先决条件
- .NET 9 SDK
- Visual Studio Code 随着
- C#开发工具包 扩展
- Azure功能扩展 扩展
- Azure功能核心工具
- Azure命令行界面
- Azure开发者命令行界面
- Docker桌面
入门指南
- 在本地运行Azure Functions MCP服务器
- 远程运行Azure Functions MCP服务器
- 将MCP服务器连接到MCP主机/客户端
- VS代码+代理模式+本地MCP服务器
- MCP检查器+本地MCP服务器
- VS代码+代理模式+远程MCP服务器
- MCP检查器+远程MCP服务器
在本地运行Azure Functions MCP服务器
- 获取存储库根目录```bash
bash/zsh
REPOSITORY_ROOT=$(git rev-parse --show-toplevel)
``````powershell
PowerShell
$REPOSITORY_ROOT = git rev-parse --show-toplevel
1. 运行功能应用程序```bash
cd $REPOSITORY_ROOT/src/McpYouTubeSubtitlesExtractor.FunctionApp
func start
远程运行Azure Functions MCP服务器
- 登录Azure```bash
Login with Azure CLI
az login
Login with Azure Developer CLI
azd auth login
1. 将Function应用程序部署到Azure```bash
azd up
在配置和部署时,系统会要求您提供订阅ID、位置、环境名称和vNet
- 部署完成后,通过运行以下命令获取信息:
- 功能应用程序名称:```bash
azd env get-value AZURE_FUNCTION_NAME
- MCP服务器访问密钥:```bash
# bash/zsh
az functionapp keys list \
-g rg-$(azd env get-value AZURE_ENV_NAME) \
-n $(azd env get-value AZURE_FUNCTION_NAME) \
--query "systemKeys.mcp_extension" -o tsv
``````bash
# PowerShell
az functionapp keys list `
-g rg-$(azd env get-value AZURE_ENV_NAME) `
-n $(azd env get-value AZURE_FUNCTION_NAME) `
--query "systemKeys.mcp_extension" -o tsv
将MCP服务器连接到MCP主机/客户端
VS代码+代理模式+本地MCP服务器
-
通过键入打开命令面板
F1或Ctrl+Shift+P在Windows或Cmd+Shift+P在Mac OS上,搜索MCP: List Servers. -
选择
mcp-youtube-subtitles-extractor-function-local然后单击Start Server. -
输入如下提示:```text
Summarise this YouTube video link in 5 bullet points: https://youtu.be/XwnEtZxaokg?si=V39ta45iMni_Uc_m
1. 它会要求你逃跑 `get_available_languages` 随后 `get_subtitle`。您可能会被要求为字幕选择语言。
1. 确认视频摘要。
#### MCP检查器+本地MCP服务器
1. 运行MCP检查器```bash
npx @modelcontextprotocol/inspector node build/index.js
-
打开web浏览器,从应用程序显示的URL导航到MCP Inspector web应用程序(例如。http://0.0.0.0:5173)
-
将运输类型设置为
SSE -
将URL设置为正在运行的Function应用程序的SSE端点,然后 连接:```text
http://0.0.0.0:7071/runtime/webhooks/mcp/sse
1. 点击 **列出工具**.
1. 点击工具 **运行工具** 带有YouTube链接和语言代码,如 `en` 或 `ko`.
#### VS代码+代理模式+远程MCP服务器
1. 通过键入打开命令面板 `F1` 或 `Ctrl`+`Shift`+`P` 在Windows或 `Cmd`+`Shift`+`P` 在Mac OS上,搜索 `MCP: List Servers`.
1. 选择 `mcp-youtube-subtitles-extractor-function-remote` 然后单击 `Start Server`.
1. 输入功能应用程序名称。
1. 输入MCP服务器访问密钥。
1. 输入如下提示:```text
Summarise this YouTube video link in 5 bullet points: https://youtu.be/XwnEtZxaokg?si=V39ta45iMni_Uc_m
-
它会要求你逃跑
get_available_languages随后get_subtitle。您可能会被要求为字幕选择语言。 -
确认视频摘要。
MCP检查器+远程MCP服务器
- 运行MCP检查器```bash
npx @modelcontextprotocol/inspector node build/index.js
1. 打开web浏览器,从应用程序显示的URL导航到MCP Inspector web应用程序(例如。http://0.0.0.0:5173)
1. 将运输类型设置为 `SSE`
1. 将URL设置为正在运行的Function应用程序的SSE端点,然后 **连接**:```text
https://.azurewebsites.net/runtime/webhooks/mcp/sse?code=
-
点击 列出工具.
-
点击工具 运行工具 带有YouTube链接和语言代码,如
en或ko.
