YouTube MCP Server

YouTube MCP Server

Provides YouTube video search, comment analysis, AI-powered text tools, and content generation via MCP protocol and REST API.

Category
访问服务器

README

YouTube MCP Server

A powerful Model Context Protocol (MCP) server that provides comprehensive YouTube functionality and AI-powered text processing tools, deployed as a Cloudflare Worker.

🚀 Live Server

The server is deployed at: https://youtube-mcp-server.anis-ayari-perso.workers.dev

📋 Features

  • YouTube Video Search: Search and analyze YouTube videos with detailed metadata
  • Comment Analysis: Analyze video comments for sentiment and insights
  • AI-Powered Text Tools: Rewrite, summarize, expand, translate, and enhance text
  • SEO Optimization: Extract keywords and tags from successful videos
  • Video Comparison: Compare performance metrics across multiple videos
  • Script Generation: Create complete YouTube video scripts
  • Caching: KV-based caching for improved performance
  • MCP Protocol Support: Full MCP protocol implementation
  • REST API: Direct REST endpoints for easy integration
  • CORS Enabled: Can be called from web browsers

🛠️ Available Tools (13 Total)

YouTube Tools

1. YouTube Video Search (search_youtube_videos)

Search YouTube videos with detailed metadata.

Parameters:

  • query (string, required): Search query
  • maxResults (number, optional): Maximum results (default: 20)

Returns: Video ID, title, description, URL, thumbnails, view count, duration, channel info

2. Analyze Video Comments (analyze_video_comments)

Analyze comments sentiment and themes for a video.

Parameters:

  • videoId (string, required): YouTube video ID
  • maxComments (number, optional): Maximum comments to analyze (default: 100)

Returns: Sentiment analysis, recurring themes, viewer feedback insights

3. Generate Video Script (generate_video_script)

Generate complete YouTube video scripts with hooks, content, and CTAs.

Parameters:

  • topic (string, required): Video topic
  • duration (string, optional): "short", "medium", "long" (default: "medium")
  • style (string, optional): "educational", "entertainment", "tutorial", "vlog" (default: "educational")
  • targetAudience (string, optional): Target audience description

Returns: Complete script with timestamps, visual suggestions, and engagement prompts

4. Extract YouTube SEO (extract_youtube_seo)

Extract SEO keywords and tags from successful videos.

Parameters:

  • query (string, required): Topic to analyze
  • competitors (number, optional): Number of videos to analyze (default: 10)

Returns: Keywords, title formulas, tags, optimization techniques

5. Compare Videos (compare_videos)

Compare performance metrics of multiple videos.

Parameters:

  • videoIds (array, required): Array of video IDs to compare

Returns: Performance rankings, success factors, improvement recommendations

6. Analyze Video Landscape (analyze_video_landscape)

Analyze existing videos and suggest unique content angles.

Parameters:

  • query (string, required): Topic to analyze
  • maxVideos (number, optional): Number of videos to analyze (default: 10)

Returns: Content gaps, unique video ideas, target audiences

AI Text Tools

7. OpenAI Completion (openai_completion)

Generate text using OpenAI models.

Parameters:

  • prompt (string, required): Text prompt
  • model (string, optional): OpenAI model (default: "gpt-4o-mini")
  • maxTokens (number, optional): Maximum tokens (default: 1000)

8. Rewrite Text (rewrite_text)

Rewrite text in different styles.

Parameters:

  • text (string, required): Text to rewrite
  • style (string, optional): "professional", "casual", "formal", "creative" (default: "professional")

9. Summarize Text (summarize_text)

Create concise summaries.

Parameters:

  • text (string, required): Text to summarize
  • length (string, optional): "short", "medium", "long" (default: "medium")

10. Expand Text (expand_text)

Expand text with additional details.

Parameters:

  • text (string, required): Text to expand
  • targetLength (string, optional): Target expansion (default: "double")

11. Fix Grammar (fix_grammar)

Fix grammar, spelling, and punctuation.

Parameters:

  • text (string, required): Text to fix

12. Translate Text (translate_text)

Translate text to other languages.

Parameters:

  • text (string, required): Text to translate
  • targetLanguage (string, optional): Target language (default: "Spanish")

13. Simplify Text (simplify_text)

Simplify text for easier reading.

Parameters:

  • text (string, required): Text to simplify
  • readingLevel (string, optional): "elementary", "high-school", "general" (default: "general")

📡 API Endpoints

REST Endpoints

YouTube Search

GET /youtube/search?query=<search_term>&maxResults=<number>

OpenAI Completion

POST /openai/completion
Content-Type: application/json

{
  "prompt": "Your prompt here",
  "model": "gpt-4o-mini",
  "maxTokens": 1000
}

Text Enhancement Endpoints

POST /text/rewrite
POST /text/summarize
POST /text/expand
POST /text/fix-grammar
POST /text/translate
POST /text/simplify

Content-Type: application/json
{
  "text": "Your text here",
  // Additional parameters based on endpoint
}

MCP Endpoint

List All Tools

POST /mcp
Content-Type: application/json

{
  "method": "tools/list"
}

Call a Tool

POST /mcp
Content-Type: application/json

{
  "method": "tools/call",
  "params": {
    "name": "tool_name",
    "arguments": {
      // tool-specific arguments
    }
  }
}

💻 Usage Examples

Example 1: Analyze Video Performance

// Search for videos
const searchResponse = await fetch('https://youtube-mcp-server.anis-ayari-perso.workers.dev/mcp', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    method: 'tools/call',
    params: {
      name: 'search_youtube_videos',
      arguments: { query: 'javascript tutorial', maxResults: 5 }
    }
  })
});

// Analyze comments from top video
const videoId = 'VIDEO_ID_HERE';
const commentsResponse = await fetch('https://youtube-mcp-server.anis-ayari-perso.workers.dev/mcp', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    method: 'tools/call',
    params: {
      name: 'analyze_video_comments',
      arguments: { videoId, maxComments: 100 }
    }
  })
});

Example 2: Generate Optimized Content

// Extract SEO insights
const seoResponse = await fetch('https://youtube-mcp-server.anis-ayari-perso.workers.dev/mcp', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    method: 'tools/call',
    params: {
      name: 'extract_youtube_seo',
      arguments: { query: 'web development', competitors: 10 }
    }
  })
});

// Generate script based on insights
const scriptResponse = await fetch('https://youtube-mcp-server.anis-ayari-perso.workers.dev/mcp', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    method: 'tools/call',
    params: {
      name: 'generate_video_script',
      arguments: {
        topic: 'Web Development for Beginners',
        duration: 'medium',
        style: 'tutorial',
        targetAudience: 'Complete beginners'
      }
    }
  })
});

Example 3: Compare Competitor Videos

const compareResponse = await fetch('https://youtube-mcp-server.anis-ayari-perso.workers.dev/mcp', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    method: 'tools/call',
    params: {
      name: 'compare_videos',
      arguments: {
        videoIds: ['VIDEO_ID_1', 'VIDEO_ID_2', 'VIDEO_ID_3']
      }
    }
  })
});

📝 Response Formats

YouTube Search Response

{
  "videoId": "dQw4w9WgXcQ",
  "title": "Video Title",
  "description": "Video description...",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "thumbnail": {
    "default": "https://i.ytimg.com/vi/dQw4w9WgXcQ/default.jpg",
    "medium": "https://i.ytimg.com/vi/dQw4w9WgXcQ/mqdefault.jpg",
    "high": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg"
  },
  "publishedAt": "2024-01-01T00:00:00Z",
  "channelTitle": "Channel Name",
  "viewCount": "1000000",
  "duration": "10:30",
  "captions": []
}

MCP Tool Response

{
  "content": [
    {
      "type": "text",
      "text": "Tool execution result..."
    }
  ],
  "metadata": {
    // Optional metadata specific to each tool
  }
}

🚀 Performance Features

  • Caching: Results are cached for 1 hour using Cloudflare KV
  • Concurrent Processing: Multiple tools can be called in parallel
  • Optimized Responses: Large responses are efficiently structured

🔧 Development

Local Development

npm install
npm run dev

Deploy to Cloudflare

npm run deploy

Environment Variables

  • YOUTUBE_API_KEY: YouTube Data API v3 key
  • OPENAI_API_KEY: OpenAI API key
  • CACHE: KV namespace binding (configured in wrangler.toml)

🔒 Security

  • API keys stored as Cloudflare Worker secrets
  • CORS enabled for browser access
  • Rate limiting handled by Cloudflare

📊 Use Cases

  1. Content Creators: Research trends, analyze competition, generate scripts
  2. SEO Specialists: Extract keywords, optimize titles and descriptions
  3. Market Researchers: Analyze viewer sentiment and engagement
  4. Educators: Create educational content with proper structure
  5. Marketers: Compare campaign performance, identify content gaps

🤝 Contributing

Contributions welcome! Please open an issue or submit a pull request.

📄 License

MIT License

📧 Support

For issues and questions, please open an issue on GitHub.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选