Skip to content

Commit 4924607

Browse files
committed
fix: another trying for windows
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
1 parent e598c69 commit 4924607

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import asyncio
22
import sys
33

4-
if sys.platform == "win32":
4+
# Windows: use SelectorEventLoop for HTTP transports (signal handling),
5+
# but keep ProactorEventLoop for stdio (pipe I/O support)
6+
if sys.platform == "win32" and any(t in sys.argv for t in ("sse", "streamable-http")):
57
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
68

7-
if "-m" not in sys.argv:
8-
from . import server
9-
109

1110
def main():
1211
"""Main entry point for the package."""
12+
from . import server
13+
1314
try:
1415
server.main()
1516
except KeyboardInterrupt:
@@ -19,4 +20,4 @@ def main():
1920

2021

2122
# Expose important items at package level
22-
__all__ = ["main", "server"]
23+
__all__ = ["main"]

src/greptimedb_mcp_server/server.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
"""GreptimeDB MCP Server using FastMCP API."""
22

3+
import asyncio
4+
import sys
5+
6+
# Windows: use SelectorEventLoop for HTTP transports (signal handling),
7+
# but keep ProactorEventLoop for stdio (pipe I/O support)
8+
if sys.platform == "win32" and any(t in sys.argv for t in ("sse", "streamable-http")):
9+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
10+
311
from greptimedb_mcp_server.config import Config
412
from greptimedb_mcp_server.formatter import format_results, VALID_FORMATS
513
from greptimedb_mcp_server.utils import (
@@ -15,7 +23,6 @@
1523
audit_log,
1624
)
1725

18-
import asyncio
1926
import json
2027
import logging
2128
import re

0 commit comments

Comments
 (0)