MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _cmd_serve

Function _cmd_serve

uncommon_route/cli.py:586–621  ·  view source on GitHub ↗
(args: list[str])

Source from the content-addressed store, hash-verified

584
585
586def _cmd_serve(args: list[str]) -> None:
587 flags, _ = _parse_flags(args, {
588 "port": True,
589 "host": True,
590 "upstream": True,
591 "composition-config": True,
592 "daemon": False,
593 "background": False,
594 })
595
596 from uncommon_route.proxy import DEFAULT_PORT
597
598 port = int(flags.get("port", DEFAULT_PORT))
599 host = str(flags.get("host", "127.0.0.1"))
600 upstream = str(flags.get("upstream", "")).strip() or None
601 composition_config = str(flags.get("composition-config", "")).strip()
602 daemon = bool(flags.get("daemon") or flags.get("background"))
603
604 if daemon:
605 started, message = _start_background_proxy(
606 port=port,
607 host=host,
608 upstream=upstream,
609 composition_config=composition_config,
610 )
611 print(f" {message}")
612 if not started:
613 return
614 print(f" Logs: {_LOG_FILE}")
615 print(" Stop: uncommon-route stop")
616 return
617
618 from uncommon_route.proxy import serve
619 if composition_config:
620 os.environ["UNCOMMON_ROUTE_COMPOSITION_CONFIG"] = composition_config
621 serve(port=port, host=host, upstream=upstream)
622
623
624def _cmd_stop(args: list[str]) -> None:

Callers

nothing calls this directly

Calls 4

serveFunction · 0.90
_parse_flagsFunction · 0.85
_start_background_proxyFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected