MCP服务器:Youtube字幕提取器
👉👉👉 移动到https://github.com/microsoft/mcp-dotnet-samples 👈👈👈
这是一个MCP服务器,从给定的YouTube链接中提取字幕。
先决条件
入门指南
- VS代码+代理模式+本地MCP服务器 - MCP检查器+本地MCP服务器 - VS代码+代理模式+远程MCP服务器 - MCP检查器+远程MCP服务器
在本地运行Azure Functions MCP服务器
- 获取存储库根目录
# bash/zsh
REPOSITORY_ROOT=$(git rev-parse --show-toplevel) # PowerShell
$REPOSITORY_ROOT = git rev-parse --show-toplevel- 运行功能应用程序
cd $REPOSITORY_ROOT/src/McpYouTubeSubtitlesExtractor.FunctionApp
func start远程运行Azure Functions MCP服务器
- 登录Azure
# Login with Azure CLI
az login
# Login with Azure Developer CLI
azd auth login- 将Function应用程序部署到Azure
azd up在配置和部署时,系统会要求您提供订阅ID、位置、环境名称和vNet
- 部署完成后,通过运行以下命令获取信息:
- 功能应用程序名称:
azd env get-value AZURE_FUNCTION_NAME- MCP服务器访问密钥:
# 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 # 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.
- 输入如下提示:
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检查器
npx @modelcontextprotocol/inspector node build/index.js- 打开web浏览器,从应用程序显示的URL导航到MCP Inspector web应用程序(例如。http://0.0.0.0:5173)
- 将运输类型设置为
SSE
- 将URL设置为正在运行的Function应用程序的SSE端点,然后 连接:
http://0.0.0.0:7071/runtime/webhooks/mcp/sse- 点击 列出工具.
- 点击工具 运行工具 带有YouTube链接和语言代码,如
en或ko.
VS代码+代理模式+远程MCP服务器
- 通过键入打开命令面板
F1或Ctrl+Shift+P在Windows或Cmd+Shift+P在Mac OS上,搜索MCP: List Servers.
- 选择
mcp-youtube-subtitles-extractor-function-remote然后单击Start Server.
- 输入功能应用程序名称。
- 输入MCP服务器访问密钥。
- 输入如下提示:
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检查器
npx @modelcontextprotocol/inspector node build/index.js- 打开web浏览器,从应用程序显示的URL导航到MCP Inspector web应用程序(例如。http://0.0.0.0:5173)
- 将运输类型设置为
SSE
- 将URL设置为正在运行的Function应用程序的SSE端点,然后 连接:
https://.azurewebsites.net/runtime/webhooks/mcp/sse?code=- 点击 列出工具.
- 点击工具 运行工具 带有YouTube链接和语言代码,如
en或ko.
