#2528·mempalace

mcp_server 在导入时解析 sys.argv: mempalace-light-mcp --help 显示完整的服务器选项,任何导入程序的 argv 都会被消耗

作者: audrum创建于 2026年9月16日更新于 2026年9月16日

What happened?

mempalace/mcp_server/_guards.py calls parse_known_args() on sys.argv at the module scope (line 73, _args = _parse_args()), and then acts on the result — setting os.environ["MEMPALACE_PALACE_PATH"], selecting a backend, and so on. Because mempalace.mcp_server is an ordinary importable module, this runs on import, not on entry, so it reads the argv of whatever process imports it.

内容来源: MemPalace/mempalace