This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
"""Command-line entry point for the stdio MCP server."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from .errors import LabyricornMcpError
|
||||
from .safety import RepositoryGuard
|
||||
from .server import StdioMcpServer
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description="Run the local repository-scoped Labyricorn MCP server over stdio.")
|
||||
parser.add_argument(
|
||||
"--repository",
|
||||
help="Labyricorn repository root. Defaults to LABYRICORN_REPOSITORY, then the current directory.",
|
||||
)
|
||||
parser.add_argument("--verbose", action="store_true", help="Write diagnostic detail to stderr.")
|
||||
arguments = parser.parse_args()
|
||||
logging.basicConfig(
|
||||
stream=sys.stderr,
|
||||
level=logging.INFO if arguments.verbose else logging.WARNING,
|
||||
format="labyricorn-mcp: %(levelname)s: %(message)s",
|
||||
)
|
||||
try:
|
||||
guard = RepositoryGuard.discover(arguments.repository)
|
||||
return StdioMcpServer(guard).serve_forever()
|
||||
except LabyricornMcpError as exc:
|
||||
print(f"labyricorn-mcp: ERROR: {exc.code}: {exc.message}", file=sys.stderr)
|
||||
return 2
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user