mcpmc/debug_stdio.py
Ryan Malloy 8e3cee4f18 Security hardening: Fix CORS configuration and add security documentation
- Replace wildcard CORS origins with restricted domain list
- Add comprehensive security patterns to .gitignore
- Create SECURITY.md with deployment security guidelines
- Restrict CORS methods and headers to minimum required
- Add security documentation for production deployment
2025-09-17 17:36:05 -06:00

61 lines
1.7 KiB
Python

#!/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()