-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
36 lines (27 loc) · 1.23 KB
/
Copy pathmain.py
File metadata and controls
36 lines (27 loc) · 1.23 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
"""Entrypoint for the pasta MCP server.
Runs as an HTTP server on port 8000 by default with hot module reload (see
``src.hmr_server``); pass ``--stdio`` to run over stdio instead (for an MCP client
that launches the server as a subprocess).
"""
import argparse
def main() -> None:
parser = argparse.ArgumentParser(description="Run the pasta MCP server.")
parser.add_argument(
"--stdio",
action="store_true",
help="Run over stdio (for a client that spawns the server) instead of HTTP.",
)
parser.add_argument("--host", default="0.0.0.0", help="HTTP host to bind (default: 0.0.0.0).")
parser.add_argument("--port", type=int, default=8000, help="HTTP port to bind (default: 8000).")
args = parser.parse_args()
if args.stdio:
# Local import: the stdio path has no hot reload, so importing the server module
# directly is fine. The HTTP path must NOT import it here - src.hmr_server
# imports it through the reload finder so it becomes hot-reloadable.
from src.server import mcp
mcp.run(transport="stdio")
else:
from src.hmr_server import run_dev_server
run_dev_server(host=args.host, port=args.port)
if __name__ == "__main__":
main()