Back to MCP directory
publicPublicdnsLocal runtime

jakedahn_deno2-playwright-mcp-server

一个基于Deno 2和Playwright的浏览器自动化MCP服务器,提供网页交互和截图功能

article

README

🚀 使用 Playwright 的模型上下文协议服务器示例

本项目是一个运用 Playwright 来提供浏览器自动化功能的模型上下文协议 (Model Context Protocol) 服务器。它为大语言模型 (LLMs) 创造了与网页交互的条件,支持截取屏幕截图,还能在真实的浏览器环境中执行 JavaScript,极大地拓展了大语言模型的应用场景。

代码库选用 Deno 2 作为开发环境,主要是因为它具有出色的人体工学设计。借助 Deno 2,我们可以将代码编译为二进制文件,并且在运行时无需依赖其他环境,使用起来更加便捷。

需要说明的是,此代码高度借鉴了官方的 Puppeteer MCP 服务器,您可以通过以下链接查看相关内容:https://github.com/modelcontextprotocol/servers/tree/main/src/puppeteer

🚀 快速开始

📦 安装指南

目前,仅对 mac 二进制文件的构建进行了测试。不过,您应该可以为 Linux x86_64、Linux ARM64 和 Windows x86_64 构建可执行二进制文件。具体的构建命令如下:

  • deno task build-mac
  • deno task build-linux-x86_64
  • deno task build-linux-ARM64
  • deno task build-windows-x86_64

💻 使用示例

要调用 playwright-server 二进制文件,您需要更新 ~/Library/Application\ Support/Claude/claude_desktop_config.json 文件,使其指向该二进制文件。以下是具体的配置示例:

{
  "mcpServers": {
    "playwright": {
      "command": "/path/to/deno2-playwright-mcp-server/playwright-server"
    }
  }
}
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client