Deno 2 Playwright Model Context Protocol Server Example

Deno 2 Playwright Model Context Protocol Server Example

这是一个使用Playwright和Deno 2提供浏览器自动化功能的模型上下文协议服务器。

Deno 2 Playwright MCP 服务器快速上手指南

概述

这是一个基于 Deno 2 和 Playwright 的模型上下文协议(MCP)服务器,允许语言模型在真实浏览器环境中与网页交互、截取屏幕截图和执行 JavaScript。

构建指南

根据您的操作系统选择相应的构建命令:

# macOS
deno task build-mac

# Linux x86_64
deno task build-linux-x86_64

# Linux ARM64
deno task build-linux-ARM64

# Windows x86_64
deno task build-windows-x86_64

设置与运行

  1. 构建二进制文件后,编辑 Claude 配置文件:

    # macOS 配置文件位置
    ~/Library/Application Support/Claude/claude_desktop_config.json
    
  2. 更新配置文件,添加服务器路径:

    {
      "mcpServers": {
        "playwright": {
          "command": "/path/to/deno2-playwright-mcp-server/playwright-server"
        }
      }
    }
    
  3. 重启 Claude 客户端,现在可以使用浏览器自动化功能了!

参考信息

  • 本项目基于官方 Puppeteer MCP 服务器:GitHub 仓库链接
  • 使用 Deno 2 可实现无运行时依赖的独立二进制文件