@kevinwatt/playwright-fetch-mcp
v1.0.8
Published
A tool for fetching content from e-commerce websites using Playwright
Readme
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 chromiummacOS
npm install -g playwright
npx playwright install chromiumLinux
npm install -g playwright
npx playwright install chromiumInstallation Methods
Via npm
npm install @kevinwatt/playwright-fetch-mcpFrom source code
git clone https://github.com/kevinwatt/playwright-fetch-mcp.git
cd playwright-fetch-mcp
npm install
npm run buildComponents
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 startThis 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.
