Playwright mcp - navigate fails on localhost
未关闭
还没有人认领这个 Issue。
area:mcp
area:networking
- 主要语言
- Shell
- 星标
- 11.2k
- 派生
- 1.9k
- 平均合并
- 14 小时 16 分钟
- 30 天内合并 PR
- 6
描述
Describe the bug
In the agents tab, Playwright MCP browser_navigate never reaches a web server running on localhost. This might be a regression as I have seen this work.
Apologies if this is the wrong place to report this!
Affected version
cloud
Steps to reproduce the behavior
- Create a new repo
- Include test-ui.js
- Start new agents tab. Ask co-pilot to start the app and take a screenshot
Expected behavior
Co-pilot uses browser_navigate tool to access UI on localhost
Additional context
test-ui.js:
#!/usr/bin/env node
/*
* test-ui.js — a minimal, zero-dependency, NO-AUTH frontend.
*
* Purpose: isolate whether the Copilot screenshot problem is Backstage-specific
* or lives in the MCP/screenshot pipeline. This serves a single static page with
* no sign-in, no catalog, no build step, no framework — just Node's built-in http.
*
* Run from the repo root: node test-ui.js
* Then open: http://127.0.0.1:8080 (also http://localhost:8080)
* Override the port with: PORT=1234 node test-ui.js
*/
const http = require('http');
const PORT = Number(process.env.PORT) || 8080;
// Loopback by default: a "normal" app that does NOT do the all-interfaces workaround.
// Flip to all-interfaces for comparison with: HOST=0.0.0.0 node test-ui.js
const HOST = process.env.HOST || '127.0.0.1';
const html = `<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Test UI</title>
</head>
<body style="margin:0;font-family:system-ui,sans-serif;background:#0a7d55;color:#fff;">
<main style="min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;">
<h1 style="font-size:56px;margin:0;letter-spacing:1px;">TEST UI OK</h1>
<p style="font-size:20px;margin:0;opacity:.9;">No auth. Static page served by test-ui.js on port ${PORT}.</p>
<div style="width:320px;height:140px;background:#fff;color:#0a7d55;display:flex;align-items:center;justify-content:center;border-radius:16px;font-size:26px;font-weight:700;box-shadow:0 8px 30px rgba(0,0,0,.25);">
Screenshot me
</div>
</main>
</body>
</html>`;
const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
res.end(html);
});
server.listen(PORT, HOST, () => {
console.log(`test-ui listening on http://${HOST}:${PORT}`);
console.log(`open http://127.0.0.1:${PORT} or http://localhost:${PORT}`);
});
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 browser_navigate 入口开始,并在仓库根目录运行 node test-ui.js。比较对 localhost 和 127.0.0.1 的访问,然后在新的 agents 标签页中使用 HOST=0.0.0.0 node test-ui.js 重复测试。完成标准是 Playwright MCP 能访问本地页面,并且 Copilot 能截取该页面的屏幕截图。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, node.js, playwright
- 领域
- devtools, networking
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100