2Command line interface for DaVinci Resolve MCP Server.
9from typing
import Optional
12from colorama
import init
as init_colorama, Fore, Style
16 os.environ[
'PYTHONIOENCODING'] =
'utf-8'
19 if hasattr(sys.stdout,
'isatty')
and sys.stdout.isatty():
23 _original_stdout = sys.stdout
24 _original_stderr = sys.stderr
25 except (AttributeError, OSError):
28from .server
import DaVinciMCPServer
29from .utils
import check_resolve_running, check_resolve_installation
38 format=f
"{Fore.CYAN}%(asctime)s{Style.RESET_ALL} - "
39 f
"{Fore.YELLOW}%(name)s{Style.RESET_ALL} - "
40 f
"%(levelname)s - %(message)s"
43logger = logging.getLogger(__name__)
47 """Print a colored status message."""
49 click.echo(f
"{Fore.GREEN}[OK]{Style.RESET_ALL} {message}")
50 elif status ==
"ERROR":
51 click.echo(f
"{Fore.RED}[ERROR]{Style.RESET_ALL} {message}")
52 elif status ==
"WARNING":
53 click.echo(f
"{Fore.YELLOW}[WARNING]{Style.RESET_ALL} {message}")
55 click.echo(f
"{Fore.CYAN}[INFO]{Style.RESET_ALL} {message}")
59 """Check if prerequisites are met."""
62 installation = check_resolve_installation()
64 if not installation[
"api_path_exists"]:
65 print_status(
"DaVinci Resolve API path not found",
"ERROR")
68 if not installation[
"lib_path_exists"]:
69 print_status(
"DaVinci Resolve library not found",
"ERROR")
72 if not installation[
"modules_path_exists"]:
73 print_status(
"DaVinci Resolve modules path not found",
"ERROR")
76 print_status(
"DaVinci Resolve installation verified",
"OK")
78 print_status(
"Checking if DaVinci Resolve is running...")
79 if not check_resolve_running():
81 print_status(
"Please start DaVinci Resolve before running the MCP server",
"WARNING")
92 help=
"Enable debug logging"
97 help=
"Skip prerequisite checks"
99def main(debug: bool =
False, skip_checks: bool =
False) ->
None:
100 """Start the DaVinci Resolve MCP Server."""
103 logging.getLogger().setLevel(logging.DEBUG)
104 logging.getLogger(
"davinci_mcp").setLevel(logging.DEBUG)
108 click.echo(f
"\n{Fore.MAGENTA}{'='*60}{Style.RESET_ALL}")
109 click.echo(f
"{Fore.MAGENTA} DaVinci MCP Professional v2.1.0{Style.RESET_ALL}")
110 click.echo(f
"{Fore.MAGENTA}{'='*60}{Style.RESET_ALL}\n")
115 print_status(
"Prerequisites not met. Exiting.",
"ERROR")
125 asyncio.run(server.run())
127 except KeyboardInterrupt:
130 except Exception
as e:
134 traceback.print_exc()
138if __name__ ==
"__main__":
bool check_prerequisites()
None print_status(str message, str status="INFO")
None main(bool debug=False, bool skip_checks=False)