test_mcp_structure.py•1.5 kB
"""
Test script to verify MCP server structure
This doesn't actually run the server, just verifies imports and structure
"""
import sys
print("Testing MCP Server Structure...")
print("=" * 60)
# Test imports
try:
from mcp.server.models import InitializationOptions
from mcp.server import NotificationOptions, Server
from mcp.server.stdio import stdio_server
from mcp.types import Tool, TextContent
print("✅ All MCP imports successful")
except ImportError as e:
print(f"❌ Import error: {e}")
print(" Run: pip install -r requirements.txt")
sys.exit(1)
# Test server creation
try:
server = Server("test-server")
print("✅ Server creation successful")
except Exception as e:
print(f"❌ Server creation error: {e}")
sys.exit(1)
# Test tool definition
try:
tool = Tool(
name="test_tool",
description="Test tool",
inputSchema={
"type": "object",
"properties": {},
}
)
print("✅ Tool definition successful")
except Exception as e:
print(f"❌ Tool definition error: {e}")
sys.exit(1)
# Test TextContent
try:
content = TextContent(type="text", text="test")
print("✅ TextContent creation successful")
except Exception as e:
print(f"❌ TextContent error: {e}")
sys.exit(1)
print("=" * 60)
print("✅ All structure tests passed!")
print("=" * 60)
print("\nMCP server structure is correct.")
print("You can proceed with testing the actual server.")