Skip to main content
Glama

YouTube Search MCP Server

by KnightMode
test_server.py2.04 kB
#!/usr/bin/env python3 """Test script to verify YouTube Search MCP server works""" import subprocess import json import sys import os def test_mcp_server(): """Test the MCP server by sending a test message""" # Add the current directory to Python path current_dir = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, current_dir) # Activate virtual environment venv_python = os.path.join(current_dir, 'venv', 'bin', 'python') server_script = os.path.join(current_dir, 'youtube_search_mcp.py') # Test message to get server info test_message = { "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "protocolVersion": "2024-11-05", "capabilities": { "tools": {} }, "clientInfo": { "name": "test-client", "version": "1.0.0" } } } try: # Start the server process process = subprocess.Popen( [venv_python, server_script], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True ) # Send the test message message_str = json.dumps(test_message) + '\n' stdout, stderr = process.communicate(input=message_str, timeout=10) print("=== Server Response ===") print(stdout) if stderr: print("\n=== Server Errors ===") print(stderr) return True except subprocess.TimeoutExpired: print("Server test timed out") process.kill() return False except Exception as e: print(f"Error testing server: {e}") return False if __name__ == "__main__": print("Testing YouTube Search MCP Server...") success = test_mcp_server() if success: print("\n✅ Server test completed!") else: print("\n❌ Server test failed!")

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/KnightMode/youtube-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server