YouTube Research MCP server

Integrates with YouTube API to perform aggregated video searches, enabling efficient content curation and trend analysis on specified topics.
Back to servers
Setup instructions
Provider
Dan Hilse
Release date
Dec 22, 2024
Language
TypeScript
Stats
7 stars

This MCP server enhances model capabilities by providing YouTube search integration. It brings sequential thinking and aggregated search results from YouTube based on user topics, making comprehensive video content accessible to your models.

Installation

Prerequisites

  • Python 3.8 or higher
  • A YouTube API key from Google Cloud Platform

Setup Steps

  1. Clone the repository:

    git clone https://github.com/yourusername/my-youtube-server.git
    cd my-youtube-server
    
  2. Install the required dependencies:

    pip install -r requirements.txt
    
  3. Set up your YouTube API key:

    export YOUTUBE_API_KEY="your-api-key-here"
    

    Or add it to your environment variables permanently.

Usage

Starting the Server

To start the MCP server:

python server.py

By default, the server runs on port 8000. You can change this by setting the PORT environment variable:

PORT=8080 python server.py

Configuring with Models

Add the server to your model context protocol configuration:

{
  "tools": [
    {
      "type": "mcp",
      "server": "http://localhost:8000"
    }
  ]
}

Making YouTube Search Requests

When interacting with a model, you can trigger YouTube searches by mentioning topics you'd like to explore. The server will:

  1. Generate relevant search queries based on your topic
  2. Fetch both short and long-form videos for each query
  3. Return aggregated results with video IDs and metadata

Example Interactions

To search for content about "machine learning basics":

User: I'd like to learn about machine learning basics. Can you find some good YouTube videos?

Model: [Uses the MCP server to search and return relevant videos]

The response will include video links, titles, and potentially other metadata depending on your configuration.

Troubleshooting

Common Issues

  • API Key Errors: Ensure your YouTube API key is correctly set and has the YouTube Data API v3 enabled
  • Rate Limiting: YouTube API has daily quotas. Consider implementing caching if you hit limits
  • Connection Issues: Verify the server is running and the port is accessible to your model

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "youtube-research" '{"command":"npx","args":["-y","youtube_research_mcp"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "youtube-research": {
            "command": "npx",
            "args": [
                "-y",
                "youtube_research_mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "youtube-research": {
            "command": "npx",
            "args": [
                "-y",
                "youtube_research_mcp"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later