YouTube MCP Server logo

YouTube MCP Server

by rakeshjayanna

A Flask server that interacts with the YouTube Data API to search for songs and retrieve video links. It's free to use and doesn't require a Premium subscription.

View on GitHub

Last updated: N/A

YouTube MCP Server

A Flask server that interacts with the YouTube Data API to search for songs and retrieve video links.


Features

  • Search for songs using the YouTube Data API.
  • Retrieve video titles and URLs.
  • Free to use (no Premium subscription required).

Prerequisites

  1. Python 3.x: Install from python.org.
  2. YouTube Data API Key: Get it from the Google Cloud Console.

Setup

1. Clone the Repository

git clone https://github.com/your-username/mcp-server.git cd youtube-mcp-server

2. Set Up a Virtual Environment

Create and activate a virtual environment: python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate

3. Install Dependencies

Install the required Python packages

4. Set Up Environment Variables

Create a .env file in the project folder. Add your YouTube API key to the .env file: YOUTUBE_API_KEY=your_api_key_here

5. Run the Server

Start the Flask server:python app.py The server will run at http://localhost:5000.

Usage

Search for a Song Send a POST request to the /search endpoint with the following JSON body: { "song_name": "Shape of You" }

Example Response If the song is found, the server will return: { "status": "success", "message": "Found video: Shape of You - Ed Sheeran", "video_title": "Shape of You - Ed Sheeran", "video_url": "https://www.youtube.com/watch?v=JGwWNGJdvx8" } If no results are found, the server will return: { "status": "error", "message": "No videos found for 'Shape of You'" }

API Endpoints

GET /: Home page (returns "YouTube MCP Server is running!").

POST /search: Search for a song and retrieve video details.

Contributing

Contributions are welcome! Follow these steps to contribute: Fork the repository. Create a new branch (git checkout -b feature/your-feature). Commit your changes (git commit -m 'Add some feature'). Push to the branch (git push origin feature/your-feature). Open a pull request.

Contact

For questions or feedback, feel free to reach out: Your Name: [email protected] GitHub: rakeshjayanna


How to Use This README

  1. Copy the content above into a file named README.md in your project folder.
  2. Replace your-username in the clone URL with your GitHub username.
  3. Replace your_api_key_here with your actual YouTube Data API key.
  4. Customize the Contact section with your details.

Final Notes

  • The README file is the first thing people see when they visit your GitHub repository. Make sure itโ€™s clear, concise, and easy to follow.
  • If you need further customization or have questions, let me know! ๐Ÿ˜Š