浏览器代理服务

MCPO浏览器代理服务,用于配置和启动可流式HTTP服务器,支持与预运行的MCP服务(如Playwright、TARS等)连接。

  • by Jacobocpe12
  • JavaScript
  • 混合部署
  • 更新于
在 GitHub 查看 Jacobocpe12/MCPO_Browser-Agent

使用说明

MCPO_浏览器代理

MCP->MCPO代理浏览器代理。

MCPO修复-流式HTTP服务器的仅配置启动

问题

mcpo 之前已立即退出 TypeError: 'NoneType' object is not subscriptable 每当a --server-type 争论与 --config 或者当使用JSON配置时 "streamable_http"在这种状态下, server_command 是 None,因此MCPO采用stdio模式而不是HTTP并关闭。

根本原因

这 type 字段必须使用连字符值(streamable-http)当连接到预运行的MCP服务(Playwright、TARS等)时,MCPO必须在仅配置模式下启动。传递CLI和配置参数混淆了MCPO的启动逻辑。

解决方案

  1. 删除尾随 --server-type … -- <url> 论据。
  2. 创建 /config/config.json 与适当 streamable-http 条目。
  3. 仅使用以下命令启动MCPO --config 旗帜。

参考config.json

{
  "mcpServers": {
    "mcp_playwright": {
      "type": "streamable-http",
      "url": "http://playwright-mcp:8931/mcp"
    },
    "mcp_tars": {
      "type": "streamable-http",
      "url": "http://ui-tars-mcp:8000/mcp"
    }
  }
}

启动命令

docker run -it --rm \
  --name mcpo-debug \
  --network mcpo_browser-agent_v1_mcpnet \
  -v $(pwd)/mcpo:/config \
  -p 3880:3879 \
  ghcr.io/open-webui/mcpo:latest \
  mcpo --config /config/config.json --host 0.0.0.0 --port 3879

预期结果

Starting MCP OpenAPI Proxy with config file: /config/config.json
INFO - Loaded MCP server: mcp_playwright
INFO - Loaded MCP server: mcp_tars
INFO - Connecting to http://playwright-mcp:8931/mcp
INFO - Connecting to http://ui-tars-mcp:8000/mcp
INFO - Uvicorn running on http://0.0.0.0:3879

实现注意事项

  • MCPO仅使用配置启动。
  • 确保 type JSON中的键使用 streamable-http.
  • 删除冗余 --server-type 来自所有docker compose和CLI调用的标志。
  • 如果需要,在启动MCPO之前添加健康检查逻辑。
  • Docker堆栈现在构建了一个修补的MCPO映像,其启动器将默认配置复制到 /config/config.json 如果绑定挂载为空,则消除 FileNotFoundError 启动崩溃。