File size: 2,035 Bytes
91ae7d9 |
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 |
"""Script to verify MCP routes are properly registered"""
import sys
from pathlib import Path
# Add project root to path
sys.path.insert(0, str(Path(__file__).parent))
try:
from main import app
print("=" * 60)
print("Checking registered routes...")
print("=" * 60)
mcp_routes = []
all_routes = []
for route in app.routes:
if hasattr(route, 'path') and hasattr(route, 'methods'):
path = route.path
methods = route.methods if route.methods else set()
all_routes.append((path, methods))
if '/mcp' in path:
mcp_routes.append((path, methods))
print(f"\nTotal routes found: {len(all_routes)}")
print(f"MCP-related routes found: {len(mcp_routes)}")
print("\n" + "=" * 60)
print("MCP Routes:")
print("=" * 60)
for path, methods in sorted(mcp_routes):
methods_str = ', '.join(sorted(methods)) if methods else 'N/A'
print(f" {methods_str:15} {path}")
# Check for new routes
extract_topic_found = any('/extract-topic' in path for path, _ in mcp_routes)
voice_chat_found = any('/voice-chat' in path for path, _ in mcp_routes)
print("\n" + "=" * 60)
print("Route Verification:")
print("=" * 60)
print(f" extract-topic route: {'β FOUND' if extract_topic_found else 'β NOT FOUND'}")
print(f" voice-chat route: {'β FOUND' if voice_chat_found else 'β NOT FOUND'}")
if extract_topic_found and voice_chat_found:
print("\nβ All new routes are properly registered!")
print("\nIf routes don't appear in Swagger UI:")
print(" 1. Restart the FastAPI server")
print(" 2. Clear browser cache or use Ctrl+Shift+R")
print(" 3. Check server logs for any import errors")
else:
print("\nβ Some routes are missing. Check for import errors in server logs.")
except Exception as e:
print(f"Error: {e}")
import traceback
traceback.print_exc()
|