Skip to main content
Glama
twolven

Puppeteer MCP Server

by twolven

Puppeteer MCP 服务器(Python 实现)

一个模型上下文协议 (MLM) 服务器,使用 Playwright(Python 版 Puppeteer)提供浏览器自动化功能。该服务器使 LLM 能够在真实的浏览器环境中与网页交互、截取屏幕截图并执行 JavaScript。

概述

此 Python 实现提供了 TypeScript 版本的稳定替代方案,在提供相同功能的同时,还改进了错误处理和日志记录功能。它使用了 Playwright(相当于 Puppeteer 的 Python 版本),提供强大的浏览器自动化功能。

Related MCP server: Puppeteer MCP Server

主要特点

  • 完全浏览器自动化

  • 页面导航

  • 屏幕截图(整页或元素)

  • 表单交互(点击和填写)

  • JavaScript 执行

  • 控制台日志监控

  • 可配置超时

  • 详细的错误处理

  • 综合日志记录

先决条件

  • Python 3.8+

  • pip(Python 包安装程序)

安装

  1. 安装所需的软件包:

pip install -r requirements.txt
  1. 安装 Playwright 浏览器:

playwright install

用法

启动服务器

直接运行服务器:

python puppeteer_server.py

Claude桌面配置

将其添加到您的 Claude 配置文件中:

{
  "mcpServers": {
    "puppeteer": {
      "command": "python",
      "args": ["path/to/puppeteer.py"]
    }
  }
}

可用工具

puppeteer_navigate

导航到浏览器中的任意 URL。

{
  "name": "puppeteer_navigate",
  "arguments": {
    "url": "https://example.com",
    "timeout": 60000  // optional, defaults to 60000ms
  }
}

puppeteer_screenshot

捕获整个页面或特定元素的屏幕截图。

{
  "name": "puppeteer_screenshot",
  "arguments": {
    "name": "my_screenshot",
    "selector": "#specific-element",  // optional
    "width": 1280,  // optional, default: 1280
    "height": 720,  // optional, default: 720
    "timeout": 30000  // optional, defaults to 30000ms
  }
}

puppeteer_click

单击页面上的元素。

{
  "name": "puppeteer_click",
  "arguments": {
    "selector": ".button-class",
    "timeout": 30000  // optional, defaults to 30000ms
  }
}

puppeteer_fill

填写输入字段。

{
  "name": "puppeteer_fill",
  "arguments": {
    "selector": "#input-id",
    "value": "text to fill",
    "timeout": 30000  // optional, defaults to 30000ms
  }
}

puppeteer_evaluate

在浏览器控制台中执行 JavaScript。

{
  "name": "puppeteer_evaluate",
  "arguments": {
    "script": "document.title",
    "timeout": 30000  // optional, defaults to 30000ms
  }
}

错误处理

服务器提供了常见场景的详细错误信息:

  • 导航失败

  • 未找到元素

  • 超时错误

  • JavaScript 执行错误

  • 截图失败

日志记录

全面的日志记录以不同的级别实现:

  • 信息:标准操作

  • 错误:操作失败

  • DEBUG:详细的执行信息

笔记

  • 浏览器以非无头模式启动,以便更好地调试

  • 默认视口尺寸为 1280x720

  • 所有超时都是可配置的

  • 捕获并存储控制台日志

  • 屏幕截图以base64编码存储在内存中

贡献

欢迎贡献!提交拉取请求之前,请阅读代码库的贡献指南。

执照

该项目根据 Apache 2.0 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    A Model Context Protocol server that provides browser automation capabilities using Playwright. This server enables LLMs to interact with web pages, take screenshots, and execute JavaScript in a real browser environment.
    32
    19,640
    5,633
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    A Model Context Protocol server that provides browser automation capabilities using Puppeteer, enabling LLMs to interact with web pages, take screenshots, and execute JavaScript in a real browser environment.
    7
    23,406
    1
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    A Model Context Protocol server that provides browser automation capabilities using Playwright, enabling LLMs to interact with web pages, take screenshots, generate test code, scrape web content, and execute JavaScript in real browser environments.
    31
    19,640
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that enables AI assistants to interact with web pages through browser automation, supporting web scraping, form filling, navigation, and other browser-based tasks using Playwright.
    1
    MIT

View all related MCP servers

Related MCP Connectors

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

  • Provides cloud browser automation capabilities using Stagehand and Browserbase, enabling LLMs to i…

  • A Model Context Protocol server for Wix AI tools

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/twolven/mcp-server-puppeteer-py'

If you have feedback or need assistance with the MCP directory API, please join our Discord server