2Command line interface for DaVinci Resolve MCP Server.
11from colorama
import init
as init_colorama, Fore, Style
15 os.environ[
"PYTHONIOENCODING"] =
"utf-8"
18 if hasattr(sys.stdout,
"isatty")
and sys.stdout.isatty():
21 _original_stdout = sys.stdout
22 _original_stderr = sys.stderr
23 except (AttributeError, OSError):
26from .
import __version__
27from .server
import DaVinciMCPServer
28from .utils
import check_resolve_running, check_resolve_installation
37 format=f
"{Fore.CYAN}%(asctime)s{Style.RESET_ALL} - "
38 f
"{Fore.YELLOW}%(name)s{Style.RESET_ALL} - "
39 f
"%(levelname)s - %(message)s",
42logger = logging.getLogger(__name__)
46 """Print a colored status message."""
48 click.echo(f
"{Fore.GREEN}[OK]{Style.RESET_ALL} {message}")
49 elif status ==
"ERROR":
50 click.echo(f
"{Fore.RED}[ERROR]{Style.RESET_ALL} {message}")
51 elif status ==
"WARNING":
52 click.echo(f
"{Fore.YELLOW}[WARNING]{Style.RESET_ALL} {message}")
54 click.echo(f
"{Fore.CYAN}[INFO]{Style.RESET_ALL} {message}")
58 """Check if prerequisites are met."""
61 installation = check_resolve_installation()
63 if not installation[
"api_path_exists"]:
64 print_status(
"DaVinci Resolve API path not found",
"ERROR")
67 if not installation[
"lib_path_exists"]:
68 print_status(
"DaVinci Resolve library not found",
"ERROR")
71 if not installation[
"modules_path_exists"]:
72 print_status(
"DaVinci Resolve modules path not found",
"ERROR")
75 print_status(
"DaVinci Resolve installation verified",
"OK")
77 print_status(
"Checking if DaVinci Resolve is running...")
78 if not check_resolve_running():
81 "Please start DaVinci Resolve before running the MCP server",
"WARNING"
90@click.option("--debug", is_flag=True, help="Enable debug logging")
91@click.option("--skip-checks", is_flag=True, help="Skip prerequisite checks")
92def main(debug: bool =
False, skip_checks: bool =
False) ->
None:
93 """Start the DaVinci Resolve MCP Server."""
96 logging.getLogger().setLevel(logging.DEBUG)
97 logging.getLogger(
"davinci_mcp").setLevel(logging.DEBUG)
101 click.echo(f
"\n{Fore.MAGENTA}{'=' * 60}{Style.RESET_ALL}")
102 click.echo(f
"{Fore.MAGENTA} DaVinci MCP Professional v{__version__}{Style.RESET_ALL}")
103 click.echo(f
"{Fore.MAGENTA}{'=' * 60}{Style.RESET_ALL}\n")
108 print_status(
"Prerequisites not met. Exiting.",
"ERROR")
118 asyncio.run(server.run())
120 except KeyboardInterrupt:
123 except Exception
as e:
128 traceback.print_exc()
132if __name__ ==
"__main__":
bool check_prerequisites()
None print_status(str message, str status="INFO")
None main(bool debug=False, bool skip_checks=False)