#!/usr/bin/env python3
"""
MCP-OS Database Initialization Script
MCP-OS 시스템의 모든 필요한 데이터베이스를 초기화합니다.
"""
import sqlite3
import os
from pathlib import Path
def init_database(db_path: str, schema_sql: str = None):
"""데이터베이스 초기화"""
try:
conn = sqlite3.connect(db_path)
if schema_sql:
conn.executescript(schema_sql)
conn.commit()
conn.close()
print(f"✅ 데이터베이스 초기화 완료: {db_path}")
except Exception as e:
print(f"❌ 데이터베이스 초기화 실패 {db_path}: {e}")
def main():
"""모든 MCP-OS 데이터베이스 초기화"""
db_dir = Path(__file__).parent
# 핵심 시스템 데이터베이스들
databases = [
"mcp_settings_policy.db",
"research_policy.db",
"mcp_orchestrator.db",
"shrimp_tasks.db",
"context7_cache.db",
"debugger_sessions.db",
"browser_tools.db",
"filesystem_mcp.db",
"terminal_mcp.db",
"edit_file_lines.db"
]
print("🔄 MCP-OS 데이터베이스 초기화 시작...")
for db_name in databases:
db_path = db_dir / db_name
init_database(str(db_path))
print("✅ 모든 MCP-OS 데이터베이스 초기화 완료!")
if __name__ == "__main__":
main()