File size: 1,712 Bytes
6a67684
 
 
 
 
0794bda
 
6a67684
0794bda
6a67684
 
0794bda
 
 
 
 
 
 
 
 
 
 
8027f40
0794bda
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6a67684
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
title: Basicsearch
emoji: 🦀
colorFrom: purple
colorTo: indigo
sdk: docker
app_port: 7860
pinned: false
short_description: MCP server for YouTube video search
---

# Basicsearch MCP Server

This is an MCP (Model Context Protocol) server that provides YouTube video search functionality.

## Features

- Search YouTube videos using the YouTube Data API v3
- Returns video titles, IDs, and descriptions

## Configuration

### Environment Variables ##
- `YOUTUBE_API_KEY`: Your YouTube Data API v3 key (required)
- `PORT`: HTTP server port (optional, default: 7860)

### Local Setup
Create a `.env` file in the project root:
```bash
YOUTUBE_API_KEY=your_youtube_api_key_here
```

### Hugging Face Spaces
Set the `YOUTUBE_API_KEY` in your Space's Repository secrets (Settings → Repository secrets)

## Local Development

### MCP Server (STDIO)
```bash
# Install dependencies
uv sync

# Run the server in development mode
uv run mcp dev server.py
```

### HTTP Server (for testing Hugging Face deployment)
```bash
# Install dependencies
uv sync

# Run the HTTP wrapper
uv run python app.py
```

Then visit `http://localhost:7860` for the health check or use the following endpoints:
- `GET /` - Service info
- `GET /health` - Health check
- `GET /tools` - List available tools
- `POST /search` - Search YouTube videos (JSON body: `{"query": "your search", "max_results": 5}`)

## Deployment to Hugging Face Spaces

1. Push this repository to Hugging Face Spaces
2. Set the `YOUTUBE_API_KEY` environment variable in your Space settings
3. The Dockerfile will automatically be used to build and deploy the server

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference