#!/usr/bin/env python3 """ Debug script to identify where /app/data error is coming from """ import sys import os from pathlib import Path # Change to backend directory backend_dir = "/home/rpm/claude/mcpmc/src/backend" os.chdir(backend_dir) sys.path.append('.') print(f"Working directory: {os.getcwd()}") print(f"Python path: {sys.path[:3]}...") try: print("1. Testing KnowledgeBase creation...") from knowledge.base import KnowledgeBase # Test path logic app_exists = Path("/app").exists() print(f"Path('/app').exists(): {app_exists}") default_path = Path("/app/data/knowledge") if app_exists else Path("./data/knowledge") print(f"Default path would be: {default_path}") # Try creating knowledge base kb = KnowledgeBase() print(f"✅ KnowledgeBase created with path: {kb.storage_path}") except Exception as e: print(f"❌ KnowledgeBase creation failed: {e}") import traceback traceback.print_exc() try: print("\n2. Testing ExpertConsultationTools...") from fastmcp import FastMCP app = FastMCP("Test") from tools.expert_consultation import ExpertConsultationTools expert_tools = ExpertConsultationTools(app) print("✅ ExpertConsultationTools created") except Exception as e: print(f"❌ ExpertConsultationTools creation failed: {e}") import traceback traceback.print_exc() try: print("\n3. Testing KnowledgeSearchEngine...") from knowledge.search_engine import KnowledgeSearchEngine search_engine = KnowledgeSearchEngine(app) print("✅ KnowledgeSearchEngine created") except Exception as e: print(f"❌ KnowledgeSearchEngine creation failed: {e}") import traceback traceback.print_exc()