fix: isolate subprocess stdin and decouple startup to prevent MCP stdio deadlocks
- Set stdin=subprocess.DEVNULL across runtime, client, and utility subprocess calls to avoid hijacking the parent process's stdin. - Run awake service initialization asynchronously on a daemon thread in MCP server startup. - Redirect logger header printing to stderr to ensure stdio JSON-RPC purity. - Add unit and lifecycle tests for MCP stdio protocol handshake and stdin isolation.
This commit is contained in:
1 parent
8fdecf23d7
commit
e984d17635
12 files changed
+237
-13
No files matched your search
@@ -59,9 +59,13 @@ import mcp_server.tools # noqa: F401
|
||||
from artemis.runtime import shutdown_awake_service, start_awake_service
|
||||
|
||||
|
||||
import threading
|
||||
|
||||
def main(transport: str = "stdio", host: str = "127.0.0.1", port: int = 8001):
|
||||
"""Main entrypoint to run the Artemis Mobile Agent MCP server."""
|
||||
start_awake_service()
|
||||
threading.Thread(
|
||||
target=start_awake_service, daemon=True, name="artemis-awake-init"
|
||||
).start()
|
||||
try:
|
||||
if transport.lower() == "sse":
|
||||
mcp.run(transport="sse", host=host, port=port)
|
||||
|
||||
Reference in new issue
Block a user