-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.py
More file actions
38 lines (26 loc) · 1.16 KB
/
server.py
File metadata and controls
38 lines (26 loc) · 1.16 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
"""Standalone server for ra-guide-mcp.
Run this module directly to start the guide MCP server in isolation,
useful for development and testing without the full composed server.
python -m ra_mcp_guide_mcp.server
python -m ra_mcp_guide_mcp.server --stdio
"""
import argparse
import logging
import os
from .tools import guide_mcp
logging.basicConfig(level=logging.INFO)
logging.getLogger("httpcore").setLevel(logging.WARNING)
logging.getLogger("httpx").setLevel(logging.WARNING)
logger = logging.getLogger(__name__)
def main() -> None:
parser = argparse.ArgumentParser(description="Riksarkivet Guide MCP Server")
parser.add_argument("--stdio", action="store_true", help="Run with stdio transport (default is HTTP)")
parser.add_argument("--port", type=int, default=int(os.environ.get("PORT", "3001")), help="Port for HTTP server (default: 3001)")
args = parser.parse_args()
if args.stdio:
guide_mcp.run(transport="stdio")
else:
logger.info("MCP Server listening on http://localhost:%d/mcp", args.port)
guide_mcp.run(transport="streamable-http", host="0.0.0.0", port=args.port, path="/mcp")
if __name__ == "__main__":
main()