diff --git a/mcp_codebase.py b/mcp_codebase.py index 693df57..0d57198 100644 --- a/mcp_codebase.py +++ b/mcp_codebase.py @@ -34,7 +34,14 @@ os.environ["ANONYMIZED_TELEMETRY"] = "False" # ----------------------------- # Configuration # ----------------------------- -logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s") +logging.basicConfig( + level=logging.INFO, + format="%(asctime)s - %(levelname)s - %(message)s", + handlers=[ + logging.FileHandler("mcp_codebase.log"), # Log to file + logging.StreamHandler() # Also log to console + ] +) logger = logging.getLogger("rag-mcp") OLLAMA_BASE_URL = "http://127.0.0.1:11434" @@ -2090,6 +2097,13 @@ def build_indexes(): # ------------------------------------------------- texts, metadatas = index_codebase(CODEBASE_PATH) + logger.info("=== Sample metadata inspection ===") + for i, m in enumerate(metadatas[:5]): # Check first 5 + logger.info(f"Chunk {i}: type={m.get('type')}, name={m.get('name')}") + logger.info(f" imports={m.get('imports')}") + logger.info(f" calls={m.get('calls')}") + logger.info(f" parameters={m.get('parameters')}") + # FIX: Convert Path to string for LocalGraph graph = LocalGraph(root_path=str(CODEBASE_PATH)) graph.clear()