YouTube Semantic Search MCP server

Leverages LanceDB for vector storage to enable semantic search and multilingual transcript retrieval from YouTube videos using Google's generative AI embeddings.
Back to servers
Setup instructions
Provider
FarhaParveen919
Release date
Mar 26, 2025
Language
Python
Stats
5 stars

The YouTube MCP Server provides a powerful interface for searching YouTube videos, retrieving transcripts, and performing semantic search over video content through the Model Context Protocol. This server integrates with MCP-compatible clients, enabling AI assistants to interact with YouTube content.

Prerequisites

  • Python 3.8+
  • Google API key for embeddings
  • uv package manager

Installation

  1. Clone the repository

  2. Create and activate a virtual environment using uv:

    uv venv
    # On Windows:
    .venv\Scripts\activate
    # On Unix/MacOS:
    source .venv/bin/activate
    
  3. Install dependencies:

    uv pip install -r requirements.txt
    
  4. Create a .env file with your Google API key:

    GOOGLE_API_KEY=your_api_key_here
    

Running the Server

You can run the MCP server in two different ways:

Direct Method

Start the server directly from the command line:

uv run python server.py

Configure for Claude.app

For Windows without package manager:

"mcpServers": {
  "youtube": {
    "command": "C:\\Path\\To\\Your\\Project\\.venv\\Scripts\\python.exe",
    "args": ["C:\\Path\\To\\Your\\Project\\server.py"],
    "env": {
      "GOOGLE_API_KEY": "your_api_key_here"
    }
  }
}

For Windows with Uv package manager:

"mcpServers": {
  "youtube": {
    "command": "uv",
    "args": ["--directory", "C:\\Path\\To\\Your\\Project", "run", "server.py"],
    "env": {
      "GOOGLE_API_KEY": "your_api_key_here"
    }
  }
}

Available Tools

The server provides four main tools:

Search YouTube

Search for videos based on a query:

  • Parameters:
    • query: Search query string
    • max_results: Maximum number of results (default: 5)

Get Transcript

Retrieve a video's transcript:

  • Parameters:
    • video_url: URL of the YouTube video

Store Video Info

Save video information and transcript in the vector database:

  • Parameters:
    • video_url: URL of the YouTube video
    • metadata: Optional metadata about the video

Search Transcripts

Perform semantic search over stored video transcripts:

  • Parameters:
    • query: Search query
    • limit: Maximum number of results (default: 3)

Using with MCP Clients

Connect the server with any MCP-compatible client, such as Claude Desktop App:

  1. Start the server using one of the methods above
  2. Open your MCP-compatible client (e.g., Claude Desktop App)
  3. Look for the hammer icon to verify that YouTube tools are available
  4. Use commands like:
    • "Search for Python tutorial videos"
    • "Get the transcript of this video: [video_url]"
    • "Search through stored video transcripts about machine learning"

Troubleshooting

If you encounter issues:

  • Verify your Google API key is correctly set in the .env file
  • Ensure all dependencies are properly installed
  • Check that the server is running and listening for connections
  • Review server output for any error messages

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" '{"command":"uv","args":["--directory","C:\\Path\\To\\Your\\Project","run","server.py"],"env":{"GOOGLE_API_KEY":"your_api_key_here"}}'

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": {
            "command": "uv",
            "args": [
                "--directory",
                "C:\\Path\\To\\Your\\Project",
                "run",
                "server.py"
            ],
            "env": {
                "GOOGLE_API_KEY": "your_api_key_here"
            }
        }
    }
}

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": {
            "command": "uv",
            "args": [
                "--directory",
                "C:\\Path\\To\\Your\\Project",
                "run",
                "server.py"
            ],
            "env": {
                "GOOGLE_API_KEY": "your_api_key_here"
            }
        }
    }
}

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