TF

tontoko/fast-playwright-mcp

浏览器自动化

本页由 AI 翻译,技术细节请以原文为准。 查看原文

40 stars 9 forks 质量 78 趋势 4Apache-2.0

tontoko/fast-playwright-mcp 是从 https://github.com/tontoko/fast-playwright-mcp. 导入的 MCP 服务器候选

概览

tontoko/fast-playwright-mcp 是从 https://github.com/tontoko/fast-playwright-mcp. 导入的 MCP 服务器候选

概述(AI 翻译)

Fast 剧作家MCP

这个MCP服务器是Microsoft服务器的一个分支。

一个模型上下文协议(MCP)服务器,利用 Playwright 提供浏览器自动化功能。该服务器使大型语言模型能够通过结构化的无障碍快照与网页交互,绕过截图或可视化调优模型的需求。

主要特色

  • 快速且轻量。使用Playwright的辅助工具树,而非基于像素的输入。
  • 支持LLM。无需视觉模型,完全基于结构化数据运行。
  • 确定性工具应用。避免基于截图的方法常见的歧义。

快速服务器功能(此分支)

  • 令牌优化。所有工具都支持expectation参数来控制响应内容:
  • includeCode: false - 抑制Playwright代码生成以减少代币
  • includeSnapshot: false - 跳过页面快照以减少响应(70-80%令牌减少)
  • includeConsole: false - 排除控制台消息
  • includeTabs: false - 隐藏标签信息
  • 图像压缩。截图工具支持 imageOptions:
  • format: 'jpeg' - 使用JPEG代替PNG
  • quality: 1-100 - 压缩图像(例如:

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Fast Playwright MCP

This MCP server is a fork of the Microsoft one.

A Model Context Protocol (MCP) server that provides browser automation capabilities using Playwright. This server enables LLMs to interact with web pages through structured accessibility snapshots, bypassing the need for screenshots or visually-tuned models.

Key Features

  • Fast and lightweight. Uses Playwright’s accessibility tree, not pixel-based input.
  • LLM-friendly. No vision models needed, operates purely on structured data.
  • Deterministic tool application. Avoids ambiguity common with screenshot-based approaches.

Fast Server Features (This Fork)

  • Token Optimization. All tools support an expectation parameter to control response content:
    • includeCode: false - Suppress Playwright code generation to reduce tokens
    • includeSnapshot: false - Skip page snapshot for minimal responses (70-80% token reduction)
    • includeConsole: false - Exclude console messages
    • includeTabs: false - Hide tab information
  • Image Compression. Screenshot tool supports imageOptions:
    • format: 'jpeg' - Use JPEG instead of PNG
    • quality: 1-100 - Compress images (e.g., 50 for 50% quality)
    • maxWidth: number - Resize images to max width
  • Batch Execution. Use browser_batch_execute for multiple operations:
    • Significant token reduction by eliminating redundant responses
    • Per-step and global expectation configuration
    • Error handling with continueOnError and stopOnFirstError options
  • Snapshot Control. Limit snapshot size with snapshotOptions:
    • selector: string - Capture only specific page sections (recommended over maxLength)
    • format: "aria" - Accessibility tree format for LLM processing
  • Diff Detection. Track only changes with diffOptions:
    • enabled: true - Show only what changed from previous state (massive token saver)
    • format: "minimal" - Ultra-compact diff output
    • Perfect for monitoring state changes during navigation or interactions
  • Diagnostic System. Advanced debugging and element discovery tools:
    • browser_find_elements - Find elements using multiple search criteria (text, role, attributes)
    • browser_diagnose - Comprehensive page analysis with performance metrics and troubleshooting
    • Enhanced error handling with alternative element suggestions
    • Page structure analysis (iframes, modals, accessibility metrics)
    • Performance monitoring with execution time under 300ms
  • Enhanced Selector System. Unified element selection with multiple strategies:
    • Selector Arrays: All element-based tools now support multiple selectors with automatic fallback
    • 4 Selector Types:
      • ref: System-generated element IDs from previous tool results (highest priority)
      • role: ARIA roles with optional text matching (e.g., {role: "button", text: "Submit"})
在 GitHub 查看完整 README

安装

npx @tontoko/fast-playwright-mcp@latest
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "playwright": { "command": "npx", "args": [ "@tontoko/fast-playwright-mcp@latest" ] } } }