202def main(argv: list[str] |
None =
None) ->
None:
203 """Parse CLI arguments and start the MCP server.
205 Under the ``stdio`` transport, standard output is diverted to
206 standard error right after parsing, before the first ``_dbg`` call,
207 and :func:`oct.mcp.server.start_server` hands it back to the SDK
208 transport immediately before serving (or exits with code 1 when it
209 cannot). The ``finally`` clause hands it back after a startup
210 failure too; after a normal run it is a no-op.
214 config_path = Path(args.config)
if args.config
else None
217 if args.transport ==
"stdio":
219 _dbg(
"MCP", func, f
"oct-mcp server entry transport={args.transport}", 3)
222 project_root=args.project_root,
223 profile=args.profile,
224 config_path=config_path,
225 transport=args.transport,
228 metrics_port=args.metrics_port,
230 except KeyboardInterrupt:
None main(list[str]|None argv=None)
argparse.Namespace _parse_args(list[str]|None argv=None)
argparse.ArgumentParser _build_parser()