-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpartuno.py
More file actions
59 lines (48 loc) · 1.56 KB
/
Copy pathpartuno.py
File metadata and controls
59 lines (48 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""Local-first Partuno MCP entry point."""
from __future__ import annotations
import argparse
from collections.abc import Sequence
from mcp_server import build_mcp_server
def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
prog="partuno-mcp",
description="Run Partuno locally for a desktop MCP client.",
)
parser.add_argument(
"--transport",
choices=("stdio", "streamable-http"),
default="stdio",
help="MCP transport (default: stdio).",
)
parser.add_argument(
"--host",
default="127.0.0.1",
help="Bind host for streamable HTTP (default: 127.0.0.1).",
)
parser.add_argument(
"--port",
type=int,
default=8000,
help="Bind port for streamable HTTP (default: 8000).",
)
return parser
def main(argv: Sequence[str] | None = None) -> None:
args = build_parser().parse_args(argv)
server = build_mcp_server(local=True)
if server is None: # pragma: no cover - defensive guard for future modes
raise RuntimeError("Partuno local MCP server could not be initialized")
try:
if args.transport == "stdio":
server.run(transport="stdio", show_banner=False)
return
server.run(
transport="streamable-http",
host=args.host,
port=args.port,
path="/mcp",
show_banner=False,
)
except KeyboardInterrupt:
return
if __name__ == "__main__": # pragma: no cover - exercised by the console script
main()