Skip to content

[Bug] Windows 下 MCP Stdio 模式未继承 PATHEXT,导致 uvx --from git+... 无法找到 git.exe #5820

@XXXxx7258

Description

@XXXxx7258

What happened / 发生了什么

AstrBot 在 astrbot/core/agent/mcp_client.py 中通过 mcp.StdioServerParameters(**cfg) 启动 stdio MCP 服务。
当前依赖的 mcp==1.12.4 在 Windows 下默认只继承一组白名单环境变量,其中包含 PATH,但不包含 PATHEXT。
手动补充env后恢复正常:

Image

Reproduce / 如何复现?

由于缺少PATHEXT,使用如下配置时,虽然 PATH 中已经有 Git 目录,uvx 仍然报错找不到 Git
{
"command": "uvx",
"args": [
"--from",
"git+https://github.com/macsymwang/hello-mcp-server.git@main",
"hello-mcp-server"
]
}

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

astrbot版本:4.19.2
使用windows部署,uv,aiocqhttp

OS

Windows

Logs / 报错日志

Image

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • Yes!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreThe bug / feature is about astrbot's core, backendbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions