
playwright fetch mcp
一个使用 Playwright 抓取网页内容的工具,支持 JSON、纯文本和 Markdown 格式。
Repository Info
About This Server
一个使用 Playwright 抓取网页内容的工具,支持 JSON、纯文本和 Markdown 格式。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Playwright Fetch MCP Server
This MCP server provides functionality to fetch web content in various formats, including JSON, plain text, and Markdown.
Installation
Prerequisites
Before using this tool, you need to install Playwright and its browser dependencies:
Windows
npm install -g playwright
npx playwright install chromium
macOS
npm install -g playwright
npx playwright install chromium
Linux
npm install -g playwright
npx playwright install chromium
Installation Methods
Via npm
npm install @kevinwatt/playwright-fetch-mcp
From source code
git clone https://github.com/kevinwatt/playwright-fetch-mcp.git
cd playwright-fetch-mcp
npm install
npm run build
Components
Tools
-
fetch_json
- Fetches JSON content from a URL
- Input:
url(string, required): The URL of the JSON resource to fetchheaders(object, optional): Custom headers to include in the request
- Returns the parsed JSON content
-
fetch_txt
- Fetches a website and returns plain text content (HTML tags removed)
- Input:
url(string, required): The URL of the website to fetchheaders(object, optional): Custom headers to include in the request
- Returns the plain text content of the webpage with HTML tags, scripts, and styles removed
-
fetch_markdown
- Fetches a website and converts its content to Markdown format
- Input:
url(string, required): The URL of the website to fetchheaders(object, optional): Custom headers to include in the request
- Returns the webpage content converted to Markdown format
Resources
This server does not provide any persistent resources. It is designed to fetch and transform web content on demand.
Quick Start
- Clone this repository
- Install dependencies:
npm install - Build the server:
npm run build
Usage
Run the server directly:
npm start
This will start the Fetch MCP server in stdio mode.
Integration with Desktop Applications
To integrate this server with a desktop application, add the following to your server configuration:
Using local installation
{
"mcpServers": {
"playwright-fetch": {
"command": "node",
"args": [
"/path/to/your/dist/index.js"
],
"enabled": true
}
}
}
Using npx (recommended)
{
"mcpServers": {
"playwright-fetch": {
"command": "npx",
"args": [
"-y",
"@kevinwatt/playwright-fetch-mcp"
],
"enabled": true
}
}
}
Features
- Uses Playwright to fetch web content, supporting modern websites and dynamic content
- Supports custom headers in requests
- Provides content in multiple formats: JSON, plain text, and Markdown
- Uses JSDOM to parse HTML and extract text
- Uses TurndownService to convert HTML to Markdown
- Supports redirects, with a maximum of 3 redirect levels
- Implements retry mechanism, with up to 2 retries
- Automatically installs Chromium browser on package installation
Development
- Run
npm run devto start the TypeScript compiler in watch mode - Use
npm testto run the test suite
License
This project is licensed under the MIT License.
Quick Start
Clone the repository
git clone https://github.com/kevinwatt/playwright-fetch-mcpInstall dependencies
cd playwright-fetch-mcp
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.