mcp-web-engine 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main.py +5 -9
- package/package.json +1 -1
package/main.py
CHANGED
|
@@ -196,18 +196,14 @@ async def extract_endpoint(body: ExtractMarkdownInput, api_key: str = Depends(ve
|
|
|
196
196
|
|
|
197
197
|
async def run_mcp_stdio_server():
|
|
198
198
|
"""
|
|
199
|
-
Stdio MCP protocol handler
|
|
199
|
+
Robust Stdio MCP protocol handler using asyncio.to_thread for cross-platform compatibility
|
|
200
|
+
(Works on Linux RPi5, x86_64, Windows, macOS without epoll PermissionError)
|
|
200
201
|
"""
|
|
201
|
-
loop = asyncio.get_event_loop()
|
|
202
|
-
reader = asyncio.StreamReader()
|
|
203
|
-
protocol = asyncio.StreamReaderProtocol(reader)
|
|
204
|
-
await loop.connect_read_pipe(lambda: protocol, sys.stdin)
|
|
205
|
-
|
|
206
202
|
while True:
|
|
207
|
-
|
|
208
|
-
if not
|
|
203
|
+
line_str = await asyncio.to_thread(sys.stdin.readline)
|
|
204
|
+
if not line_str:
|
|
209
205
|
break
|
|
210
|
-
line_str =
|
|
206
|
+
line_str = line_str.strip()
|
|
211
207
|
if not line_str:
|
|
212
208
|
continue
|
|
213
209
|
try:
|