"""
Quick test script to verify YtMCP server functionality.
This script tests that the server can:
1. Initialize without errors
2. List all registered tools
3. Execute a simple search tool
"""
import asyncio
from ytmcp.server import mcp
async def test_server():
"""Test basic server functionality."""
print("=" * 60)
print("๐งช YtMCP Server Test Suite")
print("=" * 60)
# Test 1: Server initialization
print("\nโ
Test 1: Server Initialization")
print(f" Server Name: {mcp.name}")
print(f" Instructions Length: {len(mcp.instructions)} chars")
# Test 2: List tools
print("\nโ
Test 2: Tool Registration")
tools = await mcp.list_tools()
print(f" Total Tools Registered: {len(tools)}")
# Group tools by category
categories = {
"Search": [],
"Video": [],
"Channel": [],
"Playlist": [],
"Utility": []
}
for tool in tools:
name = tool.name
if "search" in name or "trending" in name or "find" in name:
categories["Search"].append(name)
elif "video" in name or "transcript" in name or "metadata" in name or "chapter" in name or "thumbnail" in name or "comment" in name:
categories["Video"].append(name)
elif "channel" in name:
categories["Channel"].append(name)
elif "playlist" in name:
categories["Playlist"].append(name)
else:
categories["Utility"].append(name)
for category, tool_names in categories.items():
if tool_names:
print(f"\n ๐ {category} Tools ({len(tool_names)}):")
for tool_name in tool_names:
print(f" - {tool_name}")
print("\n" + "=" * 60)
print(f"โ
All tests passed! Server is ready to use.")
print("=" * 60)
print("\n๐ To start the server:")
print(" uv run ytmcp")
print("\n๐ To connect from MCP clients:")
print(" See README.md for configuration examples")
print("=" * 60)
if __name__ == "__main__":
asyncio.run(test_server())