diff --git a/scripts/atocore_mcp.py b/scripts/atocore_mcp.py index 9474e13..13f382d 100644 --- a/scripts/atocore_mcp.py +++ b/scripts/atocore_mcp.py @@ -37,6 +37,17 @@ import urllib.error import urllib.parse import urllib.request +# Force UTF-8 on stdio — MCP protocol expects UTF-8 but Windows Python +# defaults stdout to cp1252, which crashes on any non-ASCII char (emojis, +# ≥, →, etc.) in tool responses. This call is a no-op on Linux/macOS +# where UTF-8 is already the default. +try: + sys.stdin.reconfigure(encoding="utf-8") + sys.stdout.reconfigure(encoding="utf-8") + sys.stderr.reconfigure(encoding="utf-8") +except Exception: + pass + # --- Configuration --- ATOCORE_URL = os.environ.get("ATOCORE_URL", "http://dalidou:8100").rstrip("/")