modelscope·@microsoft/playwright-mcp
一种模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页交互,而无需使用视觉模型或截图。
一个使用 Playwright 提供浏览器自动化功能的 Model Context Protocol (MCP) 服务器。该服务器使 LLM 能够通过结构化的无障碍快照与网页进行交互,从而绕过了对屏幕截图或视觉调优模型的需求。
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}
使用以下按钮之一在 VS Code 中安装 Playwright MCP 服务器:
<!-- // Generate using?: const config = JSON.stringify({ name: 'playwright', command: 'npx', args: ["-y", "@playwright/mcp@latest"] }); const urlForWebsites = `vscode:mcp/install?${encodeURIComponent(config)}`; // Github markdown does not allow linking to `vscode:` directly, so you can use our redirect: const urlForGithub = `https://insiders.vscode.dev/redirect?url=${encodeURIComponent(urlForWebsites)}`; -->或者,您可以使用 VS Code CLI 安装 Playwright MCP 服务器:
# For VS Code
code --add-mcp '{"name":"playwright","command":"npx","args":["@playwright/mcp@latest"]}'
# For VS Code Insiders
code-insiders --add-mcp '{"name":"playwright","command":"npx","args":["@playwright/mcp@latest"]}'
安装后,您可以在 VS Code 中使用 GitHub Copilot 代理来使用 Playwright MCP 服务器。
Playwright MCP 服务器支持以下命令行选项:
--browser <browser>:使用的浏览器或 Chrome 通道。可能的值:
chrome, firefox, webkit, msedgechrome-beta, chrome-canary, chrome-devmsedge-beta, msedge-canary, msedge-devchrome--cdp-endpoint <endpoint>:连接到的 CDP 端点--executable-path <path>:浏览器可执行文件的路径--headless:以无头模式运行浏览器(默认为有头模式)--port <port>:监听的端口用于 SSE 传输--user-data-dir <path>:用户数据目录的路径--vision:运行使用屏幕截图的服务器(默认使用 Aria 快照)Playwright MCP 将使用新的配置文件启动浏览器,位于
- `%USERPROFILE%\AppData\Local\ms-playwright\mcp-chrome-profile` on Windows
- `~/Library/Caches/ms-playwright/mcp-chrome-profile` on macOS
- `~/.cache/ms-playwright/mcp-chrome-profile` on Linux
所有登录信息将存储在该配置文件中,您可以在会话之间删除它以清除离线状态。
此模式对于后台或批处理操作非常有用。
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest",
"--headless"
]
}
}
}
当在没有显示的系统上运行有头浏览器或从IDE的工作进程中运行时,请在具有DISPLAY环境的环境中运行MCP服务器,并传递--port标志以启用SSE传输。
npx @playwright/mcp@latest --port 8931
然后,在MCP客户端配置中,将url设置为SSE端点:
{
"mcpServers": {
"playwright": {
"url": "http://localhost:8931/sse"
}
}
}
这些工具提供两种模式:
要使用视觉模式,在启动服务器时添加--vision标志:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest",
"--vision"
]
}
}
}
视觉模式最适合那些能够根据提供的屏幕截图使用X Y坐标空间与元素交互的计算机使用模型。
import { createServer } from '@playwright/mcp';
// ...
const server = createServer({
launchOptions: { headless: true }
});
transport = new SSEServerTransport("/messages", res);
server.connect(transport);
Playwright MCP 提供了一组用于浏览器自动化的工具。以下是所有可用工具:
browser_navigate
url (string): The URL to navigate tobrowser_go_back
browser_go_forward
browser_click
element (string): Human-readable element description used to obtain permission to interact with the elementref (string): Exact target element reference from the page snapshotbrowser_hover
element (string): Human-readable element description used to obtain permission to interact with the elementref (string): Exact target element reference from the page snapshotbrowser_drag
startElement (string): Human-readable source element description used to obtain permission to interact with the elementstartRef (string): Exact source element reference from the page snapshotendElement (string): Human-readable target element description used to obtain permission to interact with the elementendRef (string): Exact target element reference from the page snapshotbrowser_type
element (string): Human-readable element description used to obtain permission to interact with the elementref (string): Exact target element reference from the page snapshottext (string): Text to type into the elementsubmit (boolean): Whether to submit entered text (press Enter after)browser_select_option
element (string): Human-readable element description used to obtain permission to interact with the elementref (string): Exact target element reference from the page snapshotvalues (array): Array of values to select in the dropdown.browser_choose_file
paths (array): The absolute paths to the files to upload. Can be a single file or mult…快递100 MCP Server提供快递信息查询、快递运费预估比价、快递时效查询(含发货前时效查询与在途动态时效查询)等功能。
暂无描述。
一个提供网页开发工具的MCP服务器,例如屏幕捕捉功能,可以让AI代理获取并处理用户屏幕的截图。
一个从网站提取有意义内容并将HTML转换为高质量Markdown的MCP服务器,使用Mozilla的Readability引擎。
桌面通知、个性化声音、ntfy 手机应用通知、邮件通知和 API 推送,减少 AI 任务等待焦虑,舒适地享用一杯咖啡。
将各种文件类型和网页内容转换为Markdown格式。它提供了一套工具,可以将PDF、图像、音频文件、网页等转换为易读且易于分享的Markdown文本。